DEV Community

Discussion on: E-Commerce Campaigns in Elasticsearch

Collapse
 
szajbus profile image
Michał Szajbe

Hey Daniel,

I believe your query is incorrect.

You're using three separate nested queries, but you should really use one nested query that wraps all three range queries together. That way all these range queries would apply to a single nested object (price).

Also to correctly count top-level objects (products) instead of just nested ones (prices), you should add "reverse_nested" aggregation at the end.

Collapse
 
truemped profile image
Daniel Truemper

Duh, you are right! Thanks for the feedback, I'll correct it later. And sorry for the very late reply. Somehow missed that.