# Concatenation of two fields

**URL:** <https://discuss.elastic.co/t/concatenation-of-two-fields/317691>\
**Category:** Elasticsearch\
**Created:** [October 28, 2022, 2:38pm UTC](https://discuss.elastic.co/t/concatenation-of-two-fields/317691 "2022-10-28T14:38:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashantreddy](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@prashantreddy](https://discuss.elastic.co/u/prashantreddy)\
**Post date:** [October 28, 2022, 2:38pm UTC](https://discuss.elastic.co/t/concatenation-of-two-fields/317691/1 "2022-10-28T14:38:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [October 28, 2022, 8:01pm UTC](https://discuss.elastic.co/t/concatenation-of-two-fields/317691/2 "2022-10-28T20:01:57Z")

</div>

Hi @prashantreddy

You can use [Set Processor](https://www.elastic.co/guide/en/elasticsearch/reference/current/set-processor.html).

```auto
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:

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

```

---

<div class="post-metadata">

**Author:** ![prashantreddy](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@prashantreddy](https://discuss.elastic.co/u/prashantreddy)\
**Post date:** [October 31, 2022, 3:20pm UTC](https://discuss.elastic.co/t/concatenation-of-two-fields/317691/3 "2022-10-31T15:20:16Z")

</div>

Thank you @RabBit_BR, I will try this out.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 28, 2022, 3:20pm UTC](https://discuss.elastic.co/t/concatenation-of-two-fields/317691/4 "2022-11-28T15:20:48Z")

</div>

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