# Document Matching between TWO Indexes

**URL:** <https://discuss.elastic.co/t/document-matching-between-two-indexes/77312>\
**Category:** Elasticsearch\
**Created:** [March 3, 2017, 12:44pm UTC](https://discuss.elastic.co/t/document-matching-between-two-indexes/77312 "2017-03-03T12:44:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sathvik](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@Sathvik](https://discuss.elastic.co/u/Sathvik)\
**Post date:** [March 3, 2017, 12:44pm UTC](https://discuss.elastic.co/t/document-matching-between-two-indexes/77312/1 "2017-03-03T12:44:48Z")

</div>

Hi,

I started working on elasticsearch recently.

I have been working on fuzzy search for matching selected fields of a document in one index (say index1) with the corresponding fields in all documents in another index(say index2).

Is there any way I can search all the documents of index1 one by one and export all the corresponding matches found for each document of index1 in index2 ?

Below is the schema  
 ![](https://us1.discourse-cdn.com/elastic/original/3X/d/e/de257f6e99b7d672629bd8c32753e4d7ce501254.png)

I already have the query for matching

I would like to know if there is any way we can write a loop to take all the documents to be searched and export the matching results for each document

Thanks.

---

<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 31, 2017, 12:44pm UTC](https://discuss.elastic.co/t/document-matching-between-two-indexes/77312/2 "2017-03-31T12:44:47Z")

</div>

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