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

(Giovanni Bismondo) #1

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