# How to compare data on two different index bassed on common field and update into 3 index

**URL:** <https://discuss.elastic.co/t/how-to-compare-data-on-two-different-index-bassed-on-common-field-and-update-into-3-index/370080>\
**Category:** Kibana\
**Created:** [November 5, 2024, 3:28pm UTC](https://discuss.elastic.co/t/how-to-compare-data-on-two-different-index-bassed-on-common-field-and-update-into-3-index/370080 "2024-11-05T15:28:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![surinder.singh2](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@surinder.singh2](https://discuss.elastic.co/u/surinder.singh2)\
**Post date:** [November 5, 2024, 3:28pm UTC](https://discuss.elastic.co/t/how-to-compare-data-on-two-different-index-bassed-on-common-field-and-update-into-3-index/370080/1 "2024-11-05T15:28:45Z")

</div>

I have 3 indexes at elastic. want to compare the 2 index bassed on the common fields and update the data on 3 index.

1. index A { name field type keyword,phoneno}.
2. index B { name field type keyword,address}.
3. Index C has the address and phone no field to update.

index A and B has the common field "name". So based on the name field want to compare and get the "phoneno" and "address" from these indexes and want update this data at index C.

could you please help us to write any script to update the data?

Thank you

---

<div class="post-metadata">

**Author:** ![ashishtiwari1993](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishtiwari1993/32/135241_2.png) [@ashishtiwari1993](https://discuss.elastic.co/u/ashishtiwari1993)\
**Post date:** [November 6, 2024, 4:03am UTC](https://discuss.elastic.co/t/how-to-compare-data-on-two-different-index-bassed-on-common-field-and-update-into-3-index/370080/2 "2024-11-06T04:03:26Z")

</div>

Hi Surinder,

You can have a look on [Enrich processor](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-enriching-data.html). The enrich processor adds new data to incoming documents and requires a few special components:

---

<div class="post-metadata">

**Author:** ![surinder.singh2](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@surinder.singh2](https://discuss.elastic.co/u/surinder.singh2)\
**Post date:** [November 6, 2024, 4:48am UTC](https://discuss.elastic.co/t/how-to-compare-data-on-two-different-index-bassed-on-common-field-and-update-into-3-index/370080/3 "2024-11-06T04:48:41Z")

</div>

HI Ashish,

Enrich Processor we can use for the coming data. but i have the existing data which i want to update.

---

<div class="post-metadata">

**Author:** ![ashishtiwari1993](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishtiwari1993/32/135241_2.png) [@ashishtiwari1993](https://discuss.elastic.co/u/ashishtiwari1993)\
**Post date:** [November 6, 2024, 4:57am UTC](https://discuss.elastic.co/t/how-to-compare-data-on-two-different-index-bassed-on-common-field-and-update-into-3-index/370080/4 "2024-11-06T04:57:25Z")

</div>

If wanted, you can [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) any already ingested documents using ingest pipeline. It will be one time activity.
