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


(Nithyanand Vasudevan) #1

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 
}

(system) #2