elasticsearch date_histogram 聚合结果首尾桶的时间发生偏移
Elasticsearch | 作者 hellowWorld | 发布于2017年12月06日 | 阅读数:4051
{
"size" : 0,
"query" : {
"bool" : {
"filter" : [
{
"range" : {
"time" : {
"from" : 1509956880000,
"to" : 1512548880000,
"include_lower" : true,
"include_upper" : true,
"boost" : 1.0
}
}
},
{
"terms" : {
"url" : [
"127.0.0.1:8020/HelloHBuilder/0928/a.json",
"192.168.10.107:8049/mission/#!//mission/dashboard/dashboardView?btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999",
"192.168.10.107:8049/mission/#!//mission/viewTemplateQuery/view?viewOid=1190&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999",
"192.168.10.107:8049/mission/viewTemplateQuery/view?viewOid=1190&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999",
"localhost:8080/bsm-server/server/overview/generalView/queryDatasbyQuota?start=2017-10-20+20%3A17%3A34&end=2017-11-20+20%3A17%3A34&_=1511180055042"
],
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"aggregations" : {
"CNT" : {
"date_histogram" : {
"field" : "time",
"format" : "epoch_millis",
"time_zone" : "Asia/Shanghai",
"interval" : 64800000,
"offset" : 0,
"order" : {
"_key" : "asc"
},
"keyed" : false,
"min_doc_count" : 0,
"extended_bounds" : {
"min" : 1509956880000,
"max" : 1512548880000
}
},
"aggregations" : {
"category" : {
"terms" : {
"field" : "url",
"size" : 20,
"min_doc_count" : 1,
"shard_min_doc_count" : 0,
"show_term_doc_count_error" : false,
"order" : {
"static.avg" : "desc"
}
},
"aggregations" : {
"static" : {
"extended_stats" : {
"field" : "totalTime",
"sigma" : 2.0
}
}
}
}
}
}
}
}
第一个桶时间 {
"key_as_string": "1509940800000",
"key": 1509940800000,
"doc_count": 0,
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
},
最后一个桶时间 {
"key_as_string": "1512532800000",
"key": 1512532800000,
"doc_count": 0,
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}
第一个桶的时间根本不在查询范围内,所有桶均出现了相同的偏移量,为何
"size" : 0,
"query" : {
"bool" : {
"filter" : [
{
"range" : {
"time" : {
"from" : 1509956880000,
"to" : 1512548880000,
"include_lower" : true,
"include_upper" : true,
"boost" : 1.0
}
}
},
{
"terms" : {
"url" : [
"127.0.0.1:8020/HelloHBuilder/0928/a.json",
"192.168.10.107:8049/mission/#!//mission/dashboard/dashboardView?btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999",
"192.168.10.107:8049/mission/#!//mission/viewTemplateQuery/view?viewOid=1190&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999",
"192.168.10.107:8049/mission/viewTemplateQuery/view?viewOid=1190&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999&btype=9999",
"localhost:8080/bsm-server/server/overview/generalView/queryDatasbyQuota?start=2017-10-20+20%3A17%3A34&end=2017-11-20+20%3A17%3A34&_=1511180055042"
],
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"aggregations" : {
"CNT" : {
"date_histogram" : {
"field" : "time",
"format" : "epoch_millis",
"time_zone" : "Asia/Shanghai",
"interval" : 64800000,
"offset" : 0,
"order" : {
"_key" : "asc"
},
"keyed" : false,
"min_doc_count" : 0,
"extended_bounds" : {
"min" : 1509956880000,
"max" : 1512548880000
}
},
"aggregations" : {
"category" : {
"terms" : {
"field" : "url",
"size" : 20,
"min_doc_count" : 1,
"shard_min_doc_count" : 0,
"show_term_doc_count_error" : false,
"order" : {
"static.avg" : "desc"
}
},
"aggregations" : {
"static" : {
"extended_stats" : {
"field" : "totalTime",
"sigma" : 2.0
}
}
}
}
}
}
}
}
第一个桶时间 {
"key_as_string": "1509940800000",
"key": 1509940800000,
"doc_count": 0,
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
},
最后一个桶时间 {
"key_as_string": "1512532800000",
"key": 1512532800000,
"doc_count": 0,
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}
第一个桶的时间根本不在查询范围内,所有桶均出现了相同的偏移量,为何
2 个回复
mafa1993
赞同来自:
hellowWorld - 爱生活爱java
赞同来自: