Can ElasticSearch perform multiple aggregations with different query conditions in a single request?

Viewed 1452

I am looking for a solution to get aggregations, one of each field, but apply different query conditions at different aggregations.

I have a collection of products, which has attributes: type, color, brand. User selected: brand=Gap, color=White, and type=Sandal. To display the counts of the various similar products of at each aggregation:

  • Query condition for brand aggregation : color=White, and type=Sandal
  • Query condition for color aggregation: brand=Gap, and type=Sandal
  • Query condition for type aggregation: brand=Gap, and color=White

Can this be done in a single ElasticSearch query?

1 Answers
Related