I am creating two different indexes but both are related to each other like a foreign key. I want to search results in both indexes using some fields indexed in both indexes. First index is storing data of users and other index is storing its documents. First we decide if we can use nested documents in single index. But I don't know can we add documents dynamically in nested or not? If not, can anyone suggest what is best way to search in both indexes?
Elasticsearch does not support any kind of joins across indices so you may need to run two separate queries and perform the join at the application layer. Using nested documents or parent-child relationships as a substitute for a join is often not a good idea as it is not a join. It is often recommended that you try to denormalize data in E Elasticsearch rather than try to keep some relational model.
1 Like
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.