Ideal Uses cases for elasticsearch Join

If you are building a system say twitter where you anticipate replies to user tweets will be quite a lot. In addition the system will have huge user base. Is using the Join in elasticsearch ideal since you have to ensure the tweet index and reply have to reside on the same idex.

Welcome to our community! :smiley:

Are you referring to parent/child here?

Thanks @warkolm :smiley: I guess but my problem is at such a scale is the parent/child approach the best or there are better options.

Is it a strict parent child relationship or might you have further nesting?

@Christian_Dahlqvist Likely to have further nesting.

That might cause problems with parent-child. Quite often the best way model data in Elasticsearch is to use a flat structure and get away from thinking about the data in relational terms. This does require more detailed knowledge about the data and how you want to query it though.

@Christian_Dahlqvist So if you had say an article, a user on the platform can comment or ask a question. Assuming comment and question are different documents but they are both related/liked to a particular article; does the flattening of the data mean to put them into separate document but have some sort id that links them up.

In terms of query, assuming I wanted to display a user feed I want to pull all relevant articles with their corresponding comments/questions from other platform users.