如何在Elasticsearch中使用_cat/indices API显示索引创建时间

pu82cl6c  于 5个月前  发布在  ElasticSearch
关注(0)|答案(2)|浏览(63)

我正在使用Elasticsearch 5.2,无法看到http://localhost:9200/_cat/indices?vindex creation time
只是想知道什么选项将显示index creation time的每个索引。

uurv41yg

uurv41yg1#

看看cat API:您可以通过http://localhost:9200/_cat/indices?help获取可用参数列表
要获取索引的创建日期,可以使用creation.date(或creation.date.string)。

http://localhost:9200/_cat/indices?h=h,s,i,id,p,r,dc,dd,ss,creation.date.string

字符串
对于完整标题名称:

http://localhost:9200/_cat/indices?h=health,status,index,id,pri,rep,docs.count,docs.deleted,store.size,creation.date.string&v=

lqfhib0f

lqfhib0f2#

更新2024-01,ES v 8.11。
关于cat indices API的页面没有解释这一点,但说“应用程序应该使用get index API”。
Rewshr的答案中的配方(使用_cat端点)仍然有效..
我从ES论坛得到了an answer(那里的回答者说它没有正确的文档):

url = f'{ES_URL}/_settings?human&filter_path=*.settings.index.creation_date_string'

字符串
.这确实会返回一个包含服务器上所有索引的JSON响应。注意glob:如果你愿意,你可以过滤部分索引名称。

相关问题