elasticsearch 如何识别索引的时间域?,elasticsearch,kibana,elasticsearch,Kibana" /> elasticsearch 如何识别索引的时间域?,elasticsearch,kibana,elasticsearch,Kibana" />

elasticsearch 如何识别索引的时间域?

elasticsearch 如何识别索引的时间域?,elasticsearch,kibana,elasticsearch,Kibana,是否有es查询或某种方式询问Elasticsearch哪个字段用作特定索引的时间字段?您可以使用Kibana选择正确的时间字段(步骤5): curl 'http://localhost:9200/your_index/_search?pretty' { "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits"

是否有es查询或某种方式询问Elasticsearch哪个字段用作特定索引的时间字段?

您可以使用Kibana选择正确的时间字段(步骤5):

curl 'http://localhost:9200/your_index/_search?pretty'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "your_index",
        "_type" : "your_index",
        "_id" : "logstash-01.kvm.local",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2018-11-10T18:03:22.822Z",
          "host" : "logstash-01.kvm.local",
          "@version" : "1",
          "clock" : 558753,
          "type" : "your_index"
        }
      }
    ]
  }
}
  • 在Kibana中,打开管理,然后单击索引模式
  • 如果这是您的第一个索引模式,则“创建索引模式”页面将自动打开。否则,单击左上角的“创建索引模式”
  • 在索引模式字段中输入“您的索引名称*”
  • 单击下一步
  • 在配置设置中,在时间过滤器字段名称下拉菜单中选择“@your_timestamp_field”
  • 单击创建索引模式 Kibana用户指南:

    或在索引映射中搜索带有“type:date”的字段

    或查看索引文档:

    curl 'http://localhost:9200/your_index/_search?pretty'
    {
      "took" : 2,
      "timed_out" : false,
      "_shards" : {
        "total" : 5,
        "successful" : 5,
        "failed" : 0
      },
      "hits" : {
        "total" : 1,
        "max_score" : 1.0,
        "hits" : [
          {
            "_index" : "your_index",
            "_type" : "your_index",
            "_id" : "logstash-01.kvm.local",
            "_score" : 1.0,
            "_source" : {
              "@timestamp" : "2018-11-10T18:03:22.822Z",
              "host" : "logstash-01.kvm.local",
              "@version" : "1",
              "clock" : 558753,
              "type" : "your_index"
            }
          }
        ]
      }
    }
    

    嘿,谢谢你的详尽回答。关于通过Kibana手动检查的第一部分,我实际上需要一种通过代码检查的方法。通过curl的后一个建议,如果有多个日期字段,但我只使用其中一个作为索引时间字段,因为只允许使用一个,该怎么办?