Get rid of duplicates

Hi, I am working on building a e-commerce backend, I do a search on productName,
If 4 products have the same Name, I don't want all same 4 products.
Is there any option to get rid of duplicates and show only unique results in elasticsearch ?

Hey,

the definition of unique is super tricky in this context. You need to define for yourself, if a shirt in a different size and color is the same product or not. If you are a market place and two sellers are selling the same item. Is this unique or not? Once you have defined this for yourself, you can think about various data modeling strategies.

You could use the join datatype to model product variations and only return the parent products. You could use nested and put all the data in one document, preventing duplicates by definition. You could use field collapsing if you have a certain field of reliable duplicate values.

Hope this helps to explore the problem space a bit more, this requires a lot of testing to get right.

--Alex

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