# How to compare hostname field in two index and create a new fild with boolean value

**URL:** <https://discuss.elastic.co/t/how-to-compare-hostname-field-in-two-index-and-create-a-new-fild-with-boolean-value/179893>\
**Category:** Elasticsearch\
**Created:** [May 7, 2019, 6:35am UTC](https://discuss.elastic.co/t/how-to-compare-hostname-field-in-two-index-and-create-a-new-fild-with-boolean-value/179893 "2019-05-07T06:35:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anand4/32/45682_2.png) [@Anand4](https://discuss.elastic.co/u/Anand4)\
**Post date:** [May 7, 2019, 6:35am UTC](https://discuss.elastic.co/t/how-to-compare-hostname-field-in-two-index-and-create-a-new-fild-with-boolean-value/179893/1 "2019-05-07T06:35:14Z")

</div>

Guys,  
New to ES, i need to compare hostname field in two index and output the result to index3 whether it is available in index2 and index2 with the hostname field.

pls guide me how to achieve it. Requirement to compare endpoint (hostname) availability in three tools ( sccm, nagios,bmc)- [These data are already populated to ES in separate index].

output:  
host1 yes no yes  
host2 no yes no

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 7, 2019, 7:25am UTC](https://discuss.elastic.co/t/how-to-compare-hostname-field-in-two-index-and-create-a-new-fild-with-boolean-value/179893/2 "2019-05-07T07:25:18Z")

</div>

You can't do that automatically. You need to do that manually I'm afraid.

So get all the documents from one index and for each run a search on the other indices.

---

<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:** [June 4, 2019, 7:25am UTC](https://discuss.elastic.co/t/how-to-compare-hostname-field-in-two-index-and-create-a-new-fild-with-boolean-value/179893/3 "2019-06-04T07:25:26Z")

</div>

Closed on June 4, 2019, 7:25am UTC

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