# How to match documents from different indexes?

**URL:** <https://discuss.elastic.co/t/how-to-match-documents-from-different-indexes/166604>\
**Category:** Elasticsearch\
**Created:** [January 31, 2019, 4:23pm UTC](https://discuss.elastic.co/t/how-to-match-documents-from-different-indexes/166604 "2019-01-31T16:23:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wassim\_Ben\_Amor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wassim_ben_amor/32/39799_2.png) [@Wassim\_Ben\_Amor](https://discuss.elastic.co/u/Wassim_Ben_Amor)\
**Post date:** [January 31, 2019, 4:23pm UTC](https://discuss.elastic.co/t/how-to-match-documents-from-different-indexes/166604/1 "2019-01-31T16:23:05Z")

</div>

Hello, I'm looking for a solution to match documents from different indexes.  
Well, I have two indexes,  
Index 1, contains documents with field message which is a string.  
Index 2, contains documents with field regex.  
How Can I apply all the regex in index2 to all the documents in Index1, to find for each string, the most matching regex ?  
Thank you.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 31, 2019, 4:37pm UTC](https://discuss.elastic.co/t/how-to-match-documents-from-different-indexes/166604/2 "2019-01-31T16:37:15Z")

</div>

You would need to solve that manually.

Scroll the index 2 and for each document search in index 1.

---

<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:** [February 28, 2019, 4:37pm UTC](https://discuss.elastic.co/t/how-to-match-documents-from-different-indexes/166604/3 "2019-02-28T16:37:21Z")

</div>

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