# Comparing Two Indices Across Clusters

**URL:** <https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [November 14, 2022, 8:57pm UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904 "2022-11-14T20:57:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![connellyethan](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@connellyethan](https://discuss.elastic.co/u/connellyethan)\
**Post date:** [November 14, 2022, 8:57pm UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/1 "2022-11-14T20:57:20Z")

</div>

Hi All,

We are currently attempting to compare two indices across clusters to verify we did not lose any records or fields during the process of cross cluster replication, which is how we chose to do this data migration.

Our previous attempt looked to call the search api on both clusters for the max number of 10k records, then sorting on our unique IDs and then doing a deep equals locally between the two response bodies and then searching the next 10,000 records. However, we are seeing inconsistencies in the sorting on these IDs between the two clusters which are failing our deep equals.

Is there any reason that these sorts could be showing inconsistencies? They are long alphanumeric strings.

Secondly, we were looking at this transform example here:

> **[Painless examples for transforms | Elasticsearch Guide \[8.5\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/transform-painless-examples.html)**

Is there anything similar to this that we could use across two different clusters? Or perhaps a way to compare them both on the same cluster search? If you guys could point me in the right direction I would greatly appreciate it!

Thanks,  
Ethan

---

<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:** [November 14, 2022, 10:28pm UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/2 "2022-11-14T22:28:12Z")

</div>

Welcome to our community! 😃

> [@connellyethan](#):
>
> Is there any reason that these sorts could be showing inconsistencies? They are long alphanumeric strings.

Are you using `_id`? Are you defining this yourself?

> [@connellyethan](#):
>
> If you guys could point me in the right direction I would greatly appreciate it!

We aren't all guys, but I would suggest that you look at using CCR as the best option for this.

---

<div class="post-metadata">

**Author:** ![connellyethan](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@connellyethan](https://discuss.elastic.co/u/connellyethan)\
**Post date:** [November 15, 2022, 2:36pm UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/3 "2022-11-15T14:36:13Z")

</div>

Thank you! Apologies for the general use of the word 🙂

We were using a unique id we gave the records themselves.

So we already performed the CCR successfully and can verify that the counts are the same between the two clusters and the respective indices. What we were hoping to do was a granular comparison at the record and field level to make sure the data is exactly the same between the two clusters.

---

<div class="post-metadata">

**Author:** ![connellyethan](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@connellyethan](https://discuss.elastic.co/u/connellyethan)\
**Post date:** [November 15, 2022, 2:41pm UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/4 "2022-11-15T14:41:15Z")

</div>

I also forgot to mention we are currently using elasticserach 7.10.

---

<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 15, 2022, 3:10pm UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/5 "2022-11-15T15:10:05Z")

</div>

That version is very old, so I would recommnd upgrading to 7.17 as soon as possible.

---

<div class="post-metadata">

**Author:** ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)\
**Post date:** [November 16, 2022, 7:37am UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/6 "2022-11-16T07:37:08Z")

</div>

> [@connellyethan](#):
>
> Is there anything similar to this that we could use across two different clusters?

Transform supports CCS, therefore you can use it for this task.

---

<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 14, 2022, 7:37am UTC](https://discuss.elastic.co/t/comparing-two-indices-across-clusters/318904/7 "2022-12-14T07:37:18Z")

</div>

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