# Group aggregates by field value

**URL:** <https://discuss.elastic.co/t/group-aggregates-by-field-value/1692>\
**Category:** Elasticsearch\
**Created:** [June 2, 2015, 8:52am UTC](https://discuss.elastic.co/t/group-aggregates-by-field-value/1692 "2015-06-02T08:52:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![redserpent7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redserpent7/32/467_2.png) [@redserpent7](https://discuss.elastic.co/u/redserpent7)\
**Post date:** [June 2, 2015, 8:52am UTC](https://discuss.elastic.co/t/group-aggregates-by-field-value/1692/1 "2015-06-02T08:52:22Z")

</div>

Hi,

I am trying to group multiple field values as a single aggregate. My Index consists of file records, each record contains a file extension field.

I need to aggregate the index in a way such that I can group all Word, Powerpoint and Excel documents each in a single aggregate.

This is what I'm trying to achieve:

Word Documents =\> group aggregate on extensions ".doc", ".docx"  
Excel Documents =\> group aggregate on extensions ".xls", ".xlsx"  
Powerpoint Documents =\> group aggregate on extensions ".ppt", ".pptx"

How can I do that?

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [June 2, 2015, 11:59am UTC](https://discuss.elastic.co/t/group-aggregates-by-field-value/1692/2 "2015-06-02T11:59:43Z")

</div>

i would bet on filter aggregation. [https://www.elastic.co/guide/en/elasticsearch/reference/1.5/search-aggregations-bucket-filter-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.5/search-aggregations-bucket-filter-aggregation.html) , you filter out the documents you want, e.g. word documents and then you aggregate on the extention field. try it and see?

jason

---

<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 6, 2017, 12:10am UTC](https://discuss.elastic.co/t/group-aggregates-by-field-value/1692/3 "2017-07-06T00:10:16Z")

</div>


