我正在聚合每个都有时间戳的文档。时间戳是 UTC,但每个文档还有一个本地时区 ("timezone": "America/Los_Angeles"
),该时区在文档之间可能不同。
我正在尝试根据本地时间而不是 UTC 或固定时区进行 date_histogram 聚合
(例如,使用选项 "time_zone": "America/Los_Angeles"
)。
如何在聚合前将每个文档的时区转换为本地时间?
这是简单的聚合:
{
"aggs": {
"date": {
"date_histogram": {
"field": "created_timestamp",
"interval": "day"
}
}
}
}
最佳答案
我不确定我是否完全理解它,但它看起来像 time_zone
property会是这样的:
The zone value accepts either a numeric value for the hours offset, for example: "time_zone" : -2. It also accepts a format of hours and minutes, like "time_zone" : "-02:30". Another option is to provide a time zone accepted as one of the values listed here.
关于elasticsearch - Elasticsearch 聚合中的动态时区偏移量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25578359/