I have filtered query with 3 filters: \"query\": \"iphone\", color:5, category:10, brand:25
.
How can I get amount of products in each brand which have <
In addition to @Lionel Sengkouvanh answer, here's the equivalent with the java API:
SearchRequestBuilder request = client
.prepareSearch(INDEX_NAME)
.setQuery(theQuery)
...
.addAggregation(
AggregationBuilders.global("all").subAggregation(
AggregationBuilders.filter("keyword").filter(filter).subAggregation(
AggregationBuilders.terms("brand").field("brand")
)
)
);