# Change aggregates based on filtered query

**URL:** https://discuss.elastic.co/t/change-aggregates-based-on-filtered-query/97423
**Category:** Elasticsearch
**Created:** [August 17, 2017, 1:21pm UTC](https://discuss.elastic.co/t/change-aggregates-based-on-filtered-query/97423 "2017-08-17T13:21:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Brian\_Santisi](https://avatars.discourse-cdn.com/v4/letter/b/9e8a1a/32.png) [@Brian\_Santisi](https://discuss.elastic.co/u/Brian_Santisi)
#### Post date: [August 17, 2017, 1:21pm UTC](https://discuss.elastic.co/t/change-aggregates-based-on-filtered-query/97423/1 "2017-08-17T13:21:23Z")

</div>

Hi all,

I'm using aggregates to create some filters on a search, but I want to be able to update the filters after a filter has been applied to only show aggregates that the filtered result list has. Is there any way to do this in the API? Thanks!

What would also work is if I can have say 3 different queries and search those three queries on 3 different fields all in one call. So search one term on item title, another on item brand, another on item color, etc. Is there a way to do that as one nested or compound query?

---

<div class="post-metadata">

### Author: ![Brian\_Santisi](https://avatars.discourse-cdn.com/v4/letter/b/9e8a1a/32.png) [@Brian\_Santisi](https://discuss.elastic.co/u/Brian_Santisi)
#### Post date: [August 17, 2017, 5:27pm UTC](https://discuss.elastic.co/t/change-aggregates-based-on-filtered-query/97423/2 "2017-08-17T17:27:06Z")

</div>

I guess I can do a bool compound query and say must term1 query1, term2 query2.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 14, 2017, 5:27pm UTC](https://discuss.elastic.co/t/change-aggregates-based-on-filtered-query/97423/3 "2017-09-14T17:27:13Z")

</div>

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