time - Elasticsearch Date Histogram with Hour Interval -
i'm trying aggregation:
"aggs":{ "visits_by_hour":{ "date_histogram":{ "field": "acctstarttime", "interval":"hour", "format": "hh", "min_doc_count": 0 } } }
it works need group hour , not return multiple hours same hour, make sense? i'm getting now:
{ "key_as_string": "12", "key": 1440244800000, "doc_count": 18 }, { "key_as_string": "12", "key": 1440331200000, "doc_count": 17 }
this need (grouped hour):
{ "key_as_string": "12", "key": 1440331200000, "doc_count": 35 }
suggestions?
edit
i've found solution problem. not sure if best approach, works.
"aggs": { "hour": { "terms": { "script": "doc['acctstarttime'].date.hourofday" } } }
Comments
Post a Comment