loading...

which one to use. Elassticsearch nested doc or separate index?

rahulpr27 profile image R🅰♓ÜL 🅿®🅰SAÐ ・1 min read

Can anyone please help. I'm bit confused about which one to use for storing rating and comments for a product. It's should be in a nested document of product or in separate index

Discussion

markdown guide
 

If you need something equivalent to JOIN in SQL, use a nested document. If data is totally independent, use separate index.
You can store those in separate indices treating each "action" (like: user assigned a rating) as separate document and then update main documents with aggregated result. However, in general, what you want to do, should be done in SQL database, not in ES.

 

Thanks. I have some documents in ES index for search purpose. Now we want to add user ownership to each documents with this rating and favourite features. So not sure how to implement this one.