# Matching fields in two different indexes together

**URL:** https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563
**Category:** Elasticsearch
**Created:** [February 26, 2021, 4:33am UTC](https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563 "2021-02-26T04:33:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sagar\_Mandal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mandal/32/57073_2.png) [@Sagar\_Mandal](https://discuss.elastic.co/u/Sagar_Mandal)
#### Post date: [February 26, 2021, 4:33am UTC](https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563/1 "2021-02-26T04:33:42Z")

</div>

Hey Team,

Let just say I have two different indexes named **index1** and **index2** ,  
they both have a column/ field in them named **C1** and **C2** , what I basically want to do is I want to match where **C1** and **C2** are the same and create a new index out of it named as matched and if **C1** and **C2** are not same then-new index named as **mismatched**.

One more thing I wanna add before the matching process, I also want to remove duplicate enteries with the same C1 and C2 fields to thier respective to thier index.

Kindly suggest some solution for the same.

Regards,  
Sagar Mandal

---

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [February 26, 2021, 6:30am UTC](https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563/2 "2021-02-26T06:30:48Z")

</div>

Are the field names `C1` and `C2` different or same?  
You may have to do this outside of the stack. Maybe use Python or Java Elasticsearch libraries to compare and re-index them? This would probably be a lot easier, but could become bulky in the long run if the index is huge.

---

<div class="post-metadata">

### Author: ![Sagar\_Mandal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mandal/32/57073_2.png) [@Sagar\_Mandal](https://discuss.elastic.co/u/Sagar_Mandal)
#### Post date: [February 26, 2021, 6:37am UTC](https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563/3 "2021-02-26T06:37:18Z")

</div>

These fields are same but have different values in between like

```
C1 C2 
A B
B C
C A
D S

```

So A from C1 match A of C2 but there is no S in C1 so that's unmatched. like this

so can we use python and integrate for only visualizations ?

Regards,  
Sagar Mandal

---

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [February 26, 2021, 9:39am UTC](https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563/4 "2021-02-26T09:39:08Z")

</div>

Yes. That should be possible.

---

<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: [March 26, 2021, 9:39am UTC](https://discuss.elastic.co/t/matching-fields-in-two-different-indexes-together/265563/5 "2021-03-26T09:39:39Z")

</div>

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