我的ES 2.4.0中有这样的数据:
{"text": "are","created_at": "2017-01-29T05:30:36.000Z"}
{"text": "hi","created_at": "2017-01-28T18:30:36.000Z"}
{"text": "you","created_at": "2017-01-31T09:30:36.000Z"}
{"text": "how","created_at": "2017-01-28T11:30:36.000Z"}
{"text": "hello","created_at": "2017-01-30T23:30:36.000Z"}
为了查看每个工作日分类的文档,我使用了以下groovy脚本:
Date date = new Date(doc[date_field].value); date.format(format);
在我的输出中,它显示如下:
"aggregations": {
"byDays": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Sunday",
"doc_count": 2
},
{
"key": "Tuesday",
"doc_count": 2
},
{
"key": "Saturday",
"doc_count": 1
}
]
}
}
}
但我的输入日期将在接下来的日子里出现
{"text": "are","created_at": "2017-01-29T05:30:36.000Z"} --sunday
{"text": "hi","created_at": "2017-01-28T18:30:36.000Z"}--saturday
{"text": "you","created_at": "2017-01-31T09:30:36.000Z"} --tuesday
{"text": "how","created_at": "2017-01-28T11:30:36.000Z"}--sunday
{"text": "hello","created_at": "2017-01-30T23:30:36.000Z"}--monday
我是否需要更改时区以获得准确的日期?