# Multiple Field Aggregation in Elasticsearch

**URL:** <https://discuss.elastic.co/t/multiple-field-aggregation-in-elasticsearch/39057>\
**Category:** Elasticsearch\
**Created:** [January 13, 2016, 5:28am UTC](https://discuss.elastic.co/t/multiple-field-aggregation-in-elasticsearch/39057 "2016-01-13T05:28:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![moni15moni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moni15moni/32/42311_2.png) [@moni15moni](https://discuss.elastic.co/u/moni15moni)\
**Post date:** [January 13, 2016, 5:28am UTC](https://discuss.elastic.co/t/multiple-field-aggregation-in-elasticsearch/39057/1 "2016-01-13T05:28:53Z")

</div>

Hi,

I have a requirement for aggregating more than one field for a analysis,Is this possible in elasticsearch.

Selest dst,dstname,dst\_port ,count(\*) from table group by dst,dstname,dst\_port.

The following one is valid the above query in Elasticsearch

searchRequest.addAggregation(AggregationBuilders.dateHistogram("date").field("first\_occurance").interval(DateHistogram.Interval.DAY)).addAggregation(  
AggregationBuilders.terms("dst").field("dst").size(1000)).addAggregation(  
AggregationBuilders.terms("dst\_name").field("dst\_name").size(1000)).addAggregation(  
AggregationBuilders.terms("dst\_port").field("dst\_port").size(1000));

Is this is support in Elasticsearch.

Thanks  
Moni

---

<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:25pm UTC](https://discuss.elastic.co/t/multiple-field-aggregation-in-elasticsearch/39057/2 "2017-07-05T23:25:00Z")

</div>


