# Update the value of a field in index based on its value in another index

**URL:** <https://discuss.elastic.co/t/update-the-value-of-a-field-in-index-based-on-its-value-in-another-index/287952>\
**Category:** Elasticsearch\
**Created:** [October 28, 2021, 6:12pm UTC](https://discuss.elastic.co/t/update-the-value-of-a-field-in-index-based-on-its-value-in-another-index/287952 "2021-10-28T18:12:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [October 28, 2021, 6:12pm UTC](https://discuss.elastic.co/t/update-the-value-of-a-field-in-index-based-on-its-value-in-another-index/287952/1 "2021-10-28T18:12:26Z")

</div>

There's an `index_A` that contains say about `10K docs`. It has many fields like field\_1, field\_2, ...field\_n and one of the fields is `product_name`.

Then there's another `index_B` that contains about `10 docs` only and is a master catalogue sort of index. It has 2 fields: `product_name` and `product_description`.  
e.g

```auto
{
	"product_name" : "EES",
	"product_desc" : "Elastic Enterprise Search"
}
{
	"product_name" : "EO",
	"product_desc" : "Elastic Observability"
}

```

`index_A` contains many fields, from that one of the fields is `product_name`. index\_A does `not` have the field `product_desc`

I want to insert `product_desc` field into each document in `index_A` such that the value of `product_name` in `index_A` matches value of `product_name` in `index_B`.

i.e. something like `set index_A.prod_desc = index_B.prod_desc where index_A.prod_name = index_B.prod_name`

How can I achieve that?

ELK Version: 7.12

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 28, 2021, 9:13pm UTC](https://discuss.elastic.co/t/update-the-value-of-a-field-in-index-based-on-its-value-in-another-index/287952/2 "2021-10-28T21:13:06Z")

</div>

Hi @sandeepkanabar

This is exactly the use case the enrich processor was created for.

Take a look at this.

> **[Enrich your data | Elasticsearch Guide \[7.15\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-enriching-data.html)**

---

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [October 28, 2021, 9:38pm UTC](https://discuss.elastic.co/t/update-the-value-of-a-field-in-index-based-on-its-value-in-another-index/287952/3 "2021-10-28T21:38:57Z")

</div>

Thank you. I had half a mind to try enrich processor but then though it's over-kill to create enrich policies et al for this.

Let me try it.

---

<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 25, 2021, 9:38pm UTC](https://discuss.elastic.co/t/update-the-value-of-a-field-in-index-based-on-its-value-in-another-index/287952/4 "2021-11-25T21:38:59Z")

</div>

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