Skip to main content

Join

Mutate Elastic Compatible

Synopsis

Combines elements from an array into a single string using a specified separator.

Schema

join:
- field: <ident>
- separator: <string>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
- target_field: <ident>

Configuration

FieldRequiredDefaultDescription
fieldY-Source field containing array of strings
separatorY-String to insert between elements
descriptionN-Documentation note
ifN-Conditional expression
ignore_failureNfalseSkip processing errors
ignore_missingNfalseSkip if input field missing
on_failureN-Error handling processors
on_successN-Success handling processors
tagN-Identifier for logging
target_fieldNfieldOutput field for joined string

Details

The processor expects an array of strings as input and produces a concatenated string with the specified separator between elements.

warning

Empty arrays return an empty string.

Common uses are converting arrays into human-readable lists, combining path or URL segments with appropriate separators, concatenating multiple tags, creating comma-separated values from arrays.

Missing fields can be handled with the ignore_missing flag.

Examples

Basic

Joining array elements with a comma...

{
"fruits": ["apple", "banana", "cherry"]
}
join:
- field: fruits
- separator: ", "
- target_field: result

creates a comma-separated string:

{
"fruits": ["apple", "banana", "cherry"],
"result": "apple, banana, cherry"
}

Empty Arrays

Joining an empty array...

{
"tags": []
}
join:
- field: tags
- separator: ";"
- target_field: tag_string

creates an empty string:

{
"tags": [],
"tag_string": ""
}

Separator

Joining with a slash...

{
"paths": ["/home", "user", "documents"]
}
join:
- field: paths
- separator: "/"
- target_field: full_path

creates a path string:

{
"paths": ["/home", "user", "documents"],
"full_path": "/home/user/documents"
}

Error Handling

Handling missing source field...

{
"other_field": "value"
}
join:
- field: missing_field
- separator: ", "
- ignore_missing: true
- on_failure:
- set:
- field: status
- value: "field_missing"

continues execution:

{
"other_field": "value",
"status": "field_missing"
}