ES日期直方图/按小时

ES可实现按year,day,hour,...聚合。代码如下:

curl -XPOST 'http://172.16.91.34:9200/ibw_attendance_records/_search' -d '{

"size": 0,

"aggs": {

"sales": {

"date_histogram": {

"field": "start_work_time",

"interval": "hour",

"format": "yyyy-MM-dd",

"min_doc_count": 0,

"time_zone": "+08:00",

"extended_bounds": {

"min": "2018-11-10",

"max": "2018-11-20"

}

}

}

}

}'

你可能感兴趣的:(ES日期直方图/按小时)