# Best way to relate - by logic - documents from different indexes

**URL:** https://discuss.elastic.co/t/best-way-to-relate-by-logic-documents-from-different-indexes/157855
**Category:** Elasticsearch
**Created:** [November 22, 2018, 10:25am UTC](https://discuss.elastic.co/t/best-way-to-relate-by-logic-documents-from-different-indexes/157855 "2018-11-22T10:25:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Giovanni\_Bismondo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giovanni_bismondo/32/86921_2.png) [@Giovanni\_Bismondo](https://discuss.elastic.co/u/Giovanni_Bismondo)
#### Post date: [November 22, 2018, 10:25am UTC](https://discuss.elastic.co/t/best-way-to-relate-by-logic-documents-from-different-indexes/157855/1 "2018-11-22T10:25:38Z")

</div>

Hi,  
I would like to know the best way to get data from 2 indexes where the documents have a 'special' relation:  
index1 and index2 have different documents but they have 1 field in common, the problem is that field contains a value that is NOT always unique: it's value is 'recycled' in a randomic way (5mins or days), in both indexes.  
My idea is to build a software to fetch the data from the 2 indexes, relate them with the right logic and persist a new document in a new index. This process should be executed continuosly.  
This is the right answer to the problem or there is/are ES features that I can use to archieve the same goal in a better way?

Thank you

---

<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 20, 2018, 10:30am UTC](https://discuss.elastic.co/t/best-way-to-relate-by-logic-documents-from-different-indexes/157855/2 "2018-12-20T10:30:40Z")

</div>

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