Java 如何在elasticsearch中找出索引创建日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21872448/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find out the index creation date in elasticsearch
提问by Johnsa Philip
How to find out the index created date in elastic search?
如何在弹性搜索中找出索引创建日期?
回答by jeromes
From the 1.4.0 version, documentation explains the following: Index creation date
从 1.4.0 版本开始,文档解释了以下内容: 索引创建日期
When an index is created, a timestamp is stored in the index metadata for the creation date. By default this it is automatically generated but it can also be specified using the creation_date parameter on the create index API
创建索引时,时间戳会存储在创建日期的索引元数据中。默认情况下,它是自动生成的,但也可以使用 create index API 上的 creation_date 参数指定
curl -XPUT localhost:9200/test -d '{
"creation_date" : 1407751337000
}'
回答by Lee H
Elasticsearch now automatically includes the creation date for an index, for example:
Elasticsearch 现在会自动包含索引的创建日期,例如:
If I create a new index (with no settings)
如果我创建一个新索引(没有设置)
curl -XPOST 'localhost:9200/aoeu'
{"acknowledged":true}
I can now 'get' the index to retrieve its metadata:
我现在可以“获取”索引以检索其元数据:
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": {}
}
}
You can see the creation_date
field above.
你可以看到creation_date
上面的字段。
回答by Yogesh Jilhawar
curl -XGET localhost:9200/_cat/indices?h=i,creation.date.string
curl -XGET localhost:9200/_cat/indices?h=i,creation.date.string
Above command will output index name (i)and creation date. For more options you can try help as-
上面的命令将输出索引名称 (i)和创建日期。有关更多选项,您可以尝试帮助作为-
curl -XGET localhost:9200/_cat/indices?help
curl -XGET localhost:9200/_cat/indices?help