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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -