Concatenation of two fields

Hello,

I want to concatenate/combine/merge two or three fields and assign this combined value to new field (mapping created for new field) after indexing. could you please suggest how to do this? Thanks!

Hi @prashantreddy

You can use Set Processor.

PUT _ingest/pipeline/append-pipeline
{
  "description": "append name and surname",
  "processors": [
    {
      "set": {
        "field": "_source.full_name",
        "value": "{{_source.name}} {{_source.surname}}"
      }
    }
  ]
}


POST idx_test/_doc?pipeline=append-pipeline
{
  "name":"xpto",
  "surname": "001"
}

GET idx_test/_search

Response:

"hits": [
      {
        "_index": "idx_test",
        "_id": "7XotIIQB3Jb-Mgr45_fj",
        "_score": 1,
        "_source": {
          "name": "xpto",
          "surname": "001",
          "full_name": "xpto 001"
        }
      }
    ]
2 Likes

Thank you @RabBit_BR, I will try this out.

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