繁体   English   中英

带有时区和扩展范围的Elasticsearch日期直方图

[英]Elasticsearch Date Histogram with time zone and extended bounds

在Elasticsearch 2.x中,我执行日期直方图聚合,并且需要同时设置time_zoneextended_bounds选项:

...
"date_histogram": {
  "interval": "1d",
  "field": "time",
  "min_doc_count": 0,
  "format": "epoch_millis",
  "time_zone": "Europe/Rome",
  "extended_bounds": {
    "min": "1496268000000",
    "max": "1498859999999"
  }
}
...

它返回错误, failed to parse date field [1496268000000] with format [epoch_millis] ,但对我来说没有意义,因为该值实际上是毫秒

{
  "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "failed to parse date field [1496268000000] with format [epoch_millis]"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "[...]",
        "node": "[...]",
        "reason": {
          "type": "parse_exception",
          "reason": "failed to parse date field [1496268000000] with format [epoch_millis]",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Parse failure at index [0] of [1496268000000]"
          }
        }
      }
    ]
  },
  "status": 400
}

我实际上正在使用Grafana,并试图找到解决此问题的方法。

我已经解决了我的问题:扩展范围的minmax必须是数字,而不是字符串:

"extended_bounds": {
  "min": 1496268000000,
  "max": 1498859999999
}

如前所述,我正在使用Grafana,所以问题出在那儿。 该拉取请求解决了该问题(请参阅对datasource.js更改)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM