0

Since we can't do joins in Elastic search.. what will be the alternate way to have join concept in Elasticsearch. An example would be grate. Like if user table has user_role with id and user details is saved in user_role table against that Id so how can I make Alternate(Join) in ES.

Thanks.

Ali Abdullah
  • 166
  • 8
  • Possible duplicate of [Join query in ElasticSearch](https://stackoverflow.com/questions/22611049/join-query-in-elasticsearch) – Mišo May 01 '19 at 09:42

1 Answers1

1

There are few ways to overcome this. Either:

  1. use Parent-Child Relationship In order to correlate the docs

  2. use Nested docs. This is actually like flattening/ normalising the data such that each doc contains the user_role data.

  3. More complex, you can move the smaller data set (for example the users roles) to be in-memory on the searching service/app, and then enrich & filter responses coming from elasticsearch with the users roles in memory while scanning the responses. This can only work if one of the joined data sets is small enough to be in memory.