Lee*_*e H 13

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

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

curl -XPOST 'localhost:9200/aoeu'
{"acknowledged":true}
Run Code Online (Sandbox Code Playgroud)

我现在可以'获取'索引来检索其元数据:

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": {}
  }
}
Run Code Online (Sandbox Code Playgroud)

你可以看到creation_date上面的字段.

  • 您可以将此号码粘贴到https://www.epochconverter.com/以快速获取日期. (2认同)

Yog*_*war 6

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

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

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


dad*_*net 0

您需要更改映射并添加时间戳

  • AFAIU 这与文档创建时间无关,而是与索引创建时间有关。 (3认同)