es查询json
{
"from": 0,
"size": 0,
"query": {
"bool": {
"must": [
{
"match_all": {
}
}
],
"must_not": [],
"should": []
}
},
"aggs": {
"group_by_captureTime": {
"date_histogram": {
"field": "captureTime", //根据这个时间字段统计
"interval": "1d",//统计时间 间隔 可用 天=1d 时=1h 分等
"time_zone": "+08:00",//设置时区
"format": "yyyy-MM-dd HH",//统计反馈key
"min_doc_count": 0
}
}
}
}
查询返回结果
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1389,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"group_by_captureTime": {
"buckets": [
{
"key_as_string": "2021-10-09",
"key": 1633708800000,
"doc_count": 872
},
{
"key_as_string": "2021-10-10",
"key": 1633795200000,
"doc_count": 0
},
{
"key_as_string": "2021-10-11"