0
功能我想出来的日期范围聚集elasticsearch 2.3。我想将它们汇总为过去30天,过去7天和今天。因此,我聚合查询的一部分,如下所示:问题与现在elasticsearch
"range": {
"ranges": [
{
"from": "now-30d/d",
"to": "now/d"
},
{
"from": "now-7d/d",
"to": "now/d"
},
{
"from": "now/d",
"to": "now+1d/d"
}
],
"format": "yyyy-MM-dd"
}
这是造成在下面的桶:
"buckets": [
{
"key": "2017-01-23-2017-02-22",
"from": 1485129600000,
"from_as_string": "2017-01-23",
"to": 1487721600000,
"to_as_string": "2017-02-22",
"doc_count": 6
},
{
"key": "2017-02-15-2017-02-22",
"from": 1487116800000,
"from_as_string": "2017-02-15",
"to": 1487721600000,
"to_as_string": "2017-02-22",
"doc_count": 6
},
{
"key": "2017-02-22-2017-02-23",
"from": 1487721600000,
"from_as_string": "2017-02-22",
"to": 1487808000000,
"to_as_string": "2017-02-23",
"doc_count": 0
}
]
date
命令的在安装elasticsearch机器的输出如下所示:
Tue Feb 21 23:01:59 PST 2017
由于从桶看出,elasticsearch功能now
评估为2017-02-22
,但我希望它是2017-02-21
。我在这里错过了什么?
在此先感谢。
现在不受time_zone参数的影响(日期必须存储为UTC)。试着改变你的时区为UTC – user3775217
https://discuss.elastic.co/t/several-date-math-questions/27453/4 – user3775217