# Search two indexes and update

**URL:** <https://discuss.elastic.co/t/search-two-indexes-and-update/50940>\
**Category:** Elasticsearch\
**Created:** [May 25, 2016, 1:05pm UTC](https://discuss.elastic.co/t/search-two-indexes-and-update/50940 "2016-05-25T13:05:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [May 25, 2016, 1:05pm UTC](https://discuss.elastic.co/t/search-two-indexes-and-update/50940/1 "2016-05-25T13:05:04Z")

</div>

Hi,

I'm using ES 1.7, and I have 2 indexes:

1. names & address
2. address list

I want to compare this two, and if the address from index 1 exits in index 2, an additional field will be added to index 1 stating that the address exists.

For example:  
name =\> "John Snow", address =\> "Winterfell"

Now if the address "winterfell exists in index 2, than index one will change to:  
name =\> "John Snow", address =\> "Winterfell", exists =\> "True"  
Otherwise:  
name =\> "John Snow", address =\> "Winterfell", exists =\> "False"

How do you recommend to do this?

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2016, 11:26pm UTC](https://discuss.elastic.co/t/search-two-indexes-and-update/50940/2 "2016-05-25T23:26:17Z")

</div>

You cannot do this via any direct ES queries, you'd need to do this entirely in code, external to ES.

---

<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:** [July 5, 2017, 10:48pm UTC](https://discuss.elastic.co/t/search-two-indexes-and-update/50940/3 "2017-07-05T22:48:59Z")

</div>

Closed on July 5, 2017, 10:48pm UTC


