Skip to content

Latest commit

 

History

History
99 lines (82 loc) · 1.94 KB

File metadata and controls

99 lines (82 loc) · 1.94 KB

assign_keys operator

The assign_keys assigns keys from the configuration to an input list. the output is a map containing these key-value pairs

Configuration Fields

Field Default Description
id assign_keys 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 assign keys to.
keys required The list of strings to be used as the keys to the input list's values.
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.

Example Configurations:


Assign keys to a list in body

- type: assign_keys
  field: body
  keys: ["foo", "bar", "charlie", "foxtrot"]
Input Entry Output Entry
{
  "body": [1, "debug", "Debug Message", true]
}
  {
    "body": {
      "foo": 1,
      "bar": "debug",
      "charlie": "Debug Message",
      "foxtrot": true,
    }
  }

Assign keys to a list in an attributes field

- type: assign_keys
  field: attributes.input
  keys: ["foo", "bar"]
Input Entry Output Entry
{
  "attributes": {
    "input": [1, "debug"],
    "field2": "unchanged",
  }
}
{
  "attributes": {
    "input": {
      "foo": 1, 
      "bar": "debug",
    },
    "field2": "unchanged",
  }
}