Append
Synopsis
Appends one or more values to an array field.
Schema
append:
- description: <text>
- field: <ident>
- value: <any>
- allow_duplicates: <boolean>
- if: <script>
- ignore_failure: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | Field to append the value to | |
value | Y | The value to be appended | |
allow_duplicates | N | true | If false , only distinct values are appended |
description | N | - | Explanatory notes |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
If the field exists and is an array, the operation is carried out. If the field exists and is a scalar, the field is converted to an array before the operation. If the field doesn't exist, an array is created containing the provided values.
note
The append processor can be combined with foreach
to append values from another array field.
Examples
Basic Usage
When appending to a non-existent field... |
|
a new array is created: |
|
Multiple Values
Multiple values can be appended at once... |
|
which extends the existing array: |
|
Handling Duplicates
With |
|
duplicate values are skipped: |
|
Converting Scalar to Array
When appending to a scalar field... |
|
it's automatically converted to an array: |
|
Using Templates
Template values can be used with mustache syntax... |
|
which get evaluated during processing: |
|