# Aggregating on multiple terms for multiple fields

**URL:** <https://discuss.elastic.co/t/aggregating-on-multiple-terms-for-multiple-fields/58187>\
**Category:** Elasticsearch\
**Created:** [August 16, 2016, 8:24pm UTC](https://discuss.elastic.co/t/aggregating-on-multiple-terms-for-multiple-fields/58187 "2016-08-16T20:24:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Doman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_doman/32/11409_2.png) [@Thomas\_Doman](https://discuss.elastic.co/u/Thomas_Doman)\
**Post date:** [August 16, 2016, 8:24pm UTC](https://discuss.elastic.co/t/aggregating-on-multiple-terms-for-multiple-fields/58187/1 "2016-08-16T20:24:50Z")

</div>

I'd like to know if there's a way to issue a query or create a filter with a list of strings, (ie. "roses", "petunias", "orchids") on a variety of fields (ie. "title", "summary", "genus", "tags") and create an aggregation which tells me how many docs had a hit for each of the strings in the query or filter. So, if I found "roses" in any one of the specified fields, the doc hits that bucket. If I find "petunias" in the same doc for the specified fields, it also hits that bucket and so on.  
It really doesn't have to be a query if there's a way to specify a filter on multiple fields for multiple values. That's what I was hoping to do with the Filters Aggregation but with that it looks like I would have to do an individual "terms" filter for every term I'm interested in for every field I'm interested in and then sum up all the times I saw "roses" in the "title" plus in the "summary" plus "tags" and so on for each term I was interested in. Besides that, I'm assuming that approach would become less and less performant as the number of terms and fields to check grew. Is there a better way? I'm currently using ES 1.7.x.

---

<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:** [July 5, 2017, 10:27pm UTC](https://discuss.elastic.co/t/aggregating-on-multiple-terms-for-multiple-fields/58187/2 "2017-07-05T22:27:29Z")

</div>


