# How to get to the next level of datehistorgram aggregation in java api?

**URL:** https://discuss.elastic.co/t/how-to-get-to-the-next-level-of-datehistorgram-aggregation-in-java-api/33599
**Category:** Elasticsearch
**Created:** [November 3, 2015, 7:17am UTC](https://discuss.elastic.co/t/how-to-get-to-the-next-level-of-datehistorgram-aggregation-in-java-api/33599 "2015-11-03T07:17:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nithyanand\_Vasudevan](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nithyanand\_Vasudevan](https://discuss.elastic.co/u/Nithyanand_Vasudevan)
#### Post date: [November 3, 2015, 7:17am UTC](https://discuss.elastic.co/t/how-to-get-to-the-next-level-of-datehistorgram-aggregation-in-java-api/33599/1 "2015-11-03T07:17:58Z")

</div>

I have the following data histogram aggregation, followed by a sub aggregation for terms. I am using java api.

```
{ 
 "aggregations": {
 "es_timestampAggs": {
  "date_histogram": {
    "field": "my_timestamp",
    "interval": "1h"
  },
  "aggregations": {
    "someAggs": {
      "terms": {
        "field": "somefield",
        "size": 0
      }
    }
  }
}}}

```

After getting the SearchResponse,

I reach here

```
Histogram esHistogram = response.getAggregations().get("es_timestampAggs");
for(Histogram.Bucket dateEntry : esHistogram.getBuckets()){
dateEntry.getAggregations();// But this 
}
```

---

<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:41pm UTC](https://discuss.elastic.co/t/how-to-get-to-the-next-level-of-datehistorgram-aggregation-in-java-api/33599/2 "2017-07-05T23:41:04Z")

</div>


