【问题标题】:elasticsearch / kibana wrong epoch date indexingelasticsearch / kibana错误的纪元日期索引
【发布时间】:2018-04-28 10:37:18
【问题描述】:

elastichsearch 或 kibana 从 epoch 索引开始出现错误的日期。

the date value is: 1495956650 (human date: GMT: Sunday, May 28, 2017 7:30:50 AM)

但是... 使用以下映射将此记录索引到 elasticsearch 时:

PUT test
{
    "mappings": {
    "doc": {
      "properties": {
        "date": {
                    "properties": {
                      "value": {
                        "type": "date"
                      }
                    }
                  }
          }
        }
      }
}

何时发布此数据:

POST test/doc
{"date": {
          "value": "1495956650"
        } 
}

我在 kibana 中看到这个日期在索引模式之后,这是错误的!

date.value:January 18th 1970, 11:02:36.650

我的 elasticsearch 和 kibana 版本都是 6.2.3 我的系统时间是更新的。

【问题讨论】:

    标签: elasticsearch kibana


    【解决方案1】:

    看起来 elasticsearch “猜测”了 epoch_millis 而不是 epoch_second

    您需要按如下方式调整映射:

    PUT test
    {
      "mappings": {
        "doc": {
          "properties": {
            "date": {
              "properties": {
                "value": {
                  "type": "date",
                  "format": "epoch_second"
                }
              }
            }
          }
        }
      }
    }
    

    有关可用的弹性搜索日期格式的更多信息here

    【讨论】:

      猜你喜欢
      • 2022-12-13
      • 1970-01-01
      • 2019-10-27
      • 2017-08-05
      • 1970-01-01
      • 2015-10-23
      • 2020-09-28
      • 2017-08-03
      • 1970-01-01
      相关资源
      最近更新 更多