如何在 elasticsearch 中找出索引创建日期

如何在弹性搜索中找出索引创建日期?


答案 1

Elasticsearch 现在会自动包含索引的创建日期,例如:

如果我创建了一个新索引(没有设置)

curl -XPOST 'localhost:9200/aoeu'
{"acknowledged":true}

我现在可以“获取”索引以检索其元数据:

curl -XGET 'localhost:9200/aoeu'
{
  "aoeu": {
    "aliases": {},
    "mappings": {},
    "settings": {
      "index": {
        "creation_date": "1429308615170",
        "number_of_replicas": "1",
        "number_of_shards": "5",
        "uuid": "C5sqwXClSFyd5uF3MSrVgg",
        "version": {
          "created": "1050199"
        }
      }
    },
    "warmers": {}
  }
}

您可以看到上面的字段。creation_date


答案 2

curl -XGET localhost:9200/_cat/indices?h=i,creation.date.string

上述命令将输出索引名称(i)创建日期。有关更多选项,您可以尝试帮助-

curl -XGET localhost:9200/_cat/indices?help


推荐