The add
operator adds a value to an entry
's body
, attributes
, or resource
.
Field | Default | Description |
---|---|---|
id |
add |
A unique identifier for the operator. |
output |
Next in pipeline | The connected operator(s) that will receive all outbound entries. |
field |
required | The field to be added. |
value |
required | value is either a static value or an expression. If a value is specified, it will be added to each entry at the field defined by field . If an expression is specified, it will be evaluated for each entry and added at the field defined by field . |
on_error |
send |
The behavior of the operator if it encounters an error. See on_error. |
if |
An expression that, when set, will be evaluated to determine whether this operator should be used for the given entry. This allows you to do easy conditional parsing without branching logic with routers. |
Add a string to the body
- type: add
field: body.key2
value: val2
Input entry | Output entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
}
} |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
"key2": "val2"
}
} |
Add a value to the body using an expression
- type: add
field: body.key2
value: EXPR(body.key1 + "_suffix")
Input entry | Output entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
}
} |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
"key2": "val1_suffix"
}
} |
Add an object to the body
- type: add
field: body.key2
value:
nestedkey: nestedvalue
Input entry | Output entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
}
} |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
"key2": {
"nestedkey":"nestedvalue"
}
}
} |
Add a value to attributes
- type: add
field: attributes.key2
value: val2
Input entry | Output entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
}
} |
{
"resource": { },
"attributes": {
"key2": "val2"
},
"body": {
"key1": "val1"
}
} |
Add a value to resource
- type: add
field: resource.key2
value: val2
Input entry | Output entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
}
} |
{
"resource": {
"key2": "val2"
},
"attributes": { },
"body": {
"key1": "val1"
}
} |
Add a value to resource using an expression
- type: add
field: resource.key2
value: EXPR(body.key1 + "_suffix")
Input entry | Output entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
}
} |
{
"resource": {
"key2": "val1_suffix"
},
"attributes": { },
"body": {
"key1": "val1",
}
} |