HOw can I get aggregations based on query only and based on filters (post_filter) at the same time

(Andrey Kaprov) #1

Greetings everyoune!

My questions is:
Is there any way to process aggregations depend on filter (bool query or post_filter) and aggregations based on query only?

I have a document - product. I have several products in index.
The product structure is:

All I want is to find products by "name" property, then collect information about categories that has the document matches query, then filter them by categoryId (cat1, cat2) then I want to get an information about maximum and minimum product price within the categories (cat1 and cat2)

(Nik Everett) #2

I think you can use the filters aggregation to do this. Still your post
filter in there and the bits that don't match will be in the other

(Andrey Kaprov) #3

Can you, please, show me an example? I can use BoolQuery.Should instead of post_filter - this is not principal. The only thing I need is to have an aggs before filtering and after filtering.

(system) #4

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