Ingest pipeline - How to stores the split values into separate new fields?

How to stores the split values (using split processor) into three new fields?
here is my pipeline but need to store split values to separate 3 fields. I have tried set array list on target_field parameter but look likes it's not supporting. Can someone pls help?

PUT _ingest/pipeline/split_act_scene_line
{
"description": "split words on line_number field",
"processors": [
{
"split": {
"field": "line_number",
"separator": "\.+",
"target_field": ["field1", "filed2", "filed3"]
}
}
]
}

ex:- "_source": {
"line_number": "1.2.3"
}

I don't think this is possible with just the split processor. Instead, you can first split into a temporary field, and then next use three set processors to assign the different array elements to the different fields:

POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "description": "split words on line_number field",
    "processors": [
      {
        "split": {
          "field": "line_number",
          "separator": "\\.+",
          "target_field": "temporary_field"
        }
      },
      {
        "set": {
          "field": "field1",
          "value": "{{temporary_field.0}}"
        }
      },
      {
        "set": {
          "field": "field2",
          "value": "{{temporary_field.1}}"
        }
      },
      {
        "set": {
          "field": "field3",
          "value": "{{temporary_field.2}}"
        }
      },
      {
        "remove": {
          "field": "temporary_field"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "line_number": "1.2.3"
      }
    }
  ]
}

It worked. @abdon Thank you very much..!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.