0

我正在尝试使用 CLI 探索 elasticsearch curator

https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html

我运行了命令

curator --host hostName --port 9200 show indices --prefix ab-

它给了我

ab-2016-05-04
ab-2016-05-05
ab-2016-05-07
ab-2016-05-11

这是完美的。现在我只想查看超过 14 天的索引。所以我尝试了

curator --host hostName --port 9200 show indices --prefix ab- --older-than 14 --time-unit days --timestring 'cl-%%Y-%%m-%%d'

它给了我

No indices matched provided args:

我想我没有正确指定时间字符串,但我可以找出原因。

我试过了

--timestring %Y%m%d
--timestring %Y-%m-%d

但它们也不起作用。我怎样才能正确提供时间字符串?

请注意,如果我这样做

curator --host hostName --port 9200 show indices --prefix ab- --older-than 1 --time-unit days --timestring %Y-%m-%d

然后我得到

ab-2016-05-04
ab-2016-05-05
ab-2016-05-07
ab-2016-05-11

那没有意义。显然,所有这些指数也都超过 14 天!截至今天是 05/17

更新

看着

https://www.elastic.co/guide/en/elasticsearch/client/curator/current/older-than.html

The value provided indicates a given number of time-units ago to use as a reference point. All indices "older than" that point will be included.

再说一次,为什么我看不到超过 14 天前创建的索引?

4

1 回答 1

2

因为您的索引不超过 14 天。05/17 - 14 天是 05/03,即 14 天。您需要一个索引ab-2016-05-02来匹配您的 14 天搜索。您可以通过逐个增加天数来尝试。

于 2016-05-17T23:01:32.837 回答