# Aggregate on a field

**URL:** <https://discuss.elastic.co/t/aggregate-on-a-field/43889>\
**Category:** Elasticsearch\
**Created:** [March 9, 2016, 11:42am UTC](https://discuss.elastic.co/t/aggregate-on-a-field/43889 "2016-03-09T11:42:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohad\_edelstain](https://avatars.discourse-cdn.com/v4/letter/o/7bcc69/32.png) [@ohad\_edelstain](https://discuss.elastic.co/u/ohad_edelstain)\
**Post date:** [March 9, 2016, 11:42am UTC](https://discuss.elastic.co/t/aggregate-on-a-field/43889/1 "2016-03-09T11:42:43Z")

</div>

Can elasticsearch aggregate a field not just word by word but phrases?

Desired behaviour:

Got a field with a few words  
Aggregate result:  
key: "single word"  
doc\_count:number  
...  
key: "multi word" (phrase)  
doc\_count:number

Just to clarify:  
I don't think that not\_analyze is the way i want to go,  
because i don't want a perfect match...  
I want aggregation of one word, two word, three words...  
Thanks!

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [March 9, 2016, 11:57am UTC](https://discuss.elastic.co/t/aggregate-on-a-field/43889/2 "2016-03-09T11:57:07Z")

</div>

Maybe this would work using [Shingle Token Filter](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-shingle-tokenfilter.html) in combination with [Multi-fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/_multi_fields.html), that way you can have various n-gram sizes indexed into different subfields and then do regular terms aggregations over them.

---

<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, 11:09pm UTC](https://discuss.elastic.co/t/aggregate-on-a-field/43889/3 "2017-07-05T23:09:53Z")

</div>


