时间戳未出现在 Kibana 中

Timestamp not appearing in Kibana

我是 Kibana 的新手,只是设置了一个实例来查看一些 ElasticSearch 数据。

我在 Elastic Search 中有一个索引,它有几个字段,包括 _timestamp。当我转到 'Discover' 选项卡并查看我的文档时,每个文档都有 _timestamp 字段,但该字段旁边有一个黄色警告,上面写着 "No cached mapping for this field"。结果,我似乎无法sort/filter按时间。

当我尝试创建新索引模式并单击 "Index contains time-based events" 时,'Time-field name' 下拉列表不包含任何内容。

我还需要做些什么才能让 Kibana 识别 _timestamp 字段吗?

我正在使用 Kibana 4.0。

转到“设置”->“索引”,select 您的索引,然后单击黄色 "refresh" 图标。这将消除警告,并可能使该字段在您的可视化中可用。

您需要先执行这些快速步骤:

  1. 转到设置 → 高级
  2. 编辑 metaFields 并添加“_timestamp”。点击保存。
  3. 现在返回设置 → 索引_timestamp 将在 "Time-field name" 的下拉列表中可用。

从 Kibana 2.0 开始,接受的答案已过时

您应该在数据中使用一个简单的 date 字段,并使用时间戳或 ISO 8601 格式的日期字符串明确设置它。 https://en.wikipedia.org/wiki/ISO_8601

您显然还需要在开始发送数据之前设置映射日期。

curl -XPUT 'http://localhost:9200/myindex' -d '{
  "mappings": {
    "my_type": {
      "properties": {
        "date": {
          "type": "date" 
        }
      }
    }
  }
}'

在较新的版本中,您需要在发送数据之前指定日期字段。

您的日期字段必须采用标准格式,例如纪元后的毫秒数(长数字)或 - 正如 MrE 建议的 - 在 ISO8601 中。 在此处查看更多信息:https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html

同样,在将数据发送到索引之前,您必须指定此字段的映射。在 python:

import requests
mapping = '{"mappings": {"your_index": {"properties": {"your_timestamp_field": { "type": "date" }}}}}'
requests.put('http://yourserver/your_index', data=mapping)
...
send_data()

我的es版本是2.2.0

您必须使用正确的架构。 我关注guide 例如:

 {
        "memory": INT,
        "geo.coordinates": "geo_point"
        "@timestamp": "date"
    }

如果您有@timestamp,您将看到

ps: if your schema doesn't have "date" field, do not check "Index contains time-based events