# What is the most efficient way to compare two indices?

**URL:** <https://discuss.elastic.co/t/what-is-the-most-efficient-way-to-compare-two-indices/171997>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-monitoring, elastic-stack-reporting, elastic-stack-alerting\
**Created:** [March 12, 2019, 4:02pm UTC](https://discuss.elastic.co/t/what-is-the-most-efficient-way-to-compare-two-indices/171997 "2019-03-12T16:02:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenmx](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@chenmx](https://discuss.elastic.co/u/chenmx)\
**Post date:** [March 12, 2019, 4:02pm UTC](https://discuss.elastic.co/t/what-is-the-most-efficient-way-to-compare-two-indices/171997/1 "2019-03-12T16:02:06Z")

</div>

In some of the old forums, comparing two indices is discussed, but it did not give a clear answer.

Given index A and Index B, both index have millions of document, and I am using Logstash to index documents. I want to create some kind of alert/log for any documents that is in A, but not in B and vise versa.

What is the best way to solve this?

Thanks in advance,  
Michael

---

<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:** [April 9, 2019, 4:02pm UTC](https://discuss.elastic.co/t/what-is-the-most-efficient-way-to-compare-two-indices/171997/2 "2019-04-09T16:02:14Z")

</div>

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