Is it possible to merge results of a search for two indexes based on a unique identifier in common? Like a join

Elasticsearch 7.7 using Java API REST

from what I understand, the merge generates a new index. I just want to merge the final result of 2 indexes based on an identifier. As a join query of a relational database. i'ts possible?

You'd need to extract, merge, and then reindex the data in your own code outside Elasticsearch. But it's possible.

For example, would I use multiple search for these 2 different indexes and aggregate the results in one? I have a need to create cached searches of a relational database, for performance improvements and various search possibilities. I imagine it is a good use case despite the fact that elasticsearch is not so used for this purpose.

The ideal scenario would be to be able to make a request to the 3 indexes and obtain the results already merged into an object list.

Elasticsearch is used as a cache for a lot of things, it's not uncommon.
You could also consider

Regarding your image, if the document structures are the same in all 3 indices then you can do a single, multi-index query.

If there is a one to one relationship between documents sharing an id then an efficient approach is to use the scroll api across the indices, sorted by the common id. Your client can fuse the pairs of docs as it reads through the sorted stream.

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