# Recommend a way to do nested field aggregation

**URL:** https://discuss.elastic.co/t/recommend-a-way-to-do-nested-field-aggregation/143952
**Category:** Elasticsearch
**Created:** [August 11, 2018, 1:10am UTC](https://discuss.elastic.co/t/recommend-a-way-to-do-nested-field-aggregation/143952 "2018-08-11T01:10:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![wangweiching](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@wangweiching](https://discuss.elastic.co/u/wangweiching)
#### Post date: [August 11, 2018, 1:10am UTC](https://discuss.elastic.co/t/recommend-a-way-to-do-nested-field-aggregation/143952/1 "2018-08-11T01:10:37Z")

</div>

i have the multiple documents query response with multiple dates as followed, I would like to know if we can do aggregation on  
those documents for example, I like to aggregate all the predictions elements with same date, the hours values like hours.h1, hours,h2 and hours.h3 and get only a single date prediction element.  
...  
{  
"predictions": [{  
"date": "2018-08-10",  
"hours": [{  
"h1": {  
"t": 100  
},  
"h2": {  
"t": 100  
}  
}]  
}]  
}

---

<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 8, 2018, 1:10am UTC](https://discuss.elastic.co/t/recommend-a-way-to-do-nested-field-aggregation/143952/2 "2018-09-08T01:10:43Z")

</div>

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