# Compare 2 tables with different indices and display the records that are missing in first table

**URL:** <https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256>\
**Category:** Elasticsearch\
**Created:** [November 18, 2019, 6:01am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256 "2019-11-18T06:01:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shali93](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@shali93](https://discuss.elastic.co/u/shali93)\
**Post date:** [November 18, 2019, 6:01am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/1 "2019-11-18T06:01:31Z")

</div>

How to compare 2 tables with different indices and display the records that are missing in first table.

example:  
table 1 table 2 result  
A A B  
B Y X  
X Z  
Y   
Z

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 19, 2019, 6:51am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/2 "2019-11-19T06:51:17Z")

</div>

In a distributed system holding large amounts of data that would be very expensive. There is no built in support for this so you need to create an application or a script to do this kind of analysis.

---

<div class="post-metadata">

**Author:** ![shali93](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@shali93](https://discuss.elastic.co/u/shali93)\
**Post date:** [November 20, 2019, 4:39am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/3 "2019-11-20T04:39:17Z")

</div>

Could you please provide sample scripts or any reference URL.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 20, 2019, 6:08am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/4 "2019-11-20T06:08:20Z")

</div>

I do not have any examples. If you have large data volumes this is going to be slow and expensive so is something I do not think is done often. Why do you need to do this? What is the size of the data set?

---

<div class="post-metadata">

**Author:** ![shali93](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@shali93](https://discuss.elastic.co/u/shali93)\
**Post date:** [November 20, 2019, 7:49am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/5 "2019-11-20T07:49:26Z")

</div>

we have around 25 thousand records in each indices.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 20, 2019, 10:31am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/6 "2019-11-20T10:31:28Z")

</div>

Then you might be able to retrieve all docs in a script and compare in memory?

---

<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:** [December 18, 2019, 10:31am UTC](https://discuss.elastic.co/t/compare-2-tables-with-different-indices-and-display-the-records-that-are-missing-in-first-table/208256/7 "2019-12-18T10:31:29Z")

</div>

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