使用Elasticsearch策展人,如何删除与模式匹配的所有索引,但最新的除外?
我尝试使用filtertype: age
,但似乎无法满足我的需要。
最佳答案
您需要两个过滤器:pattern
(以匹配要删除的索引)和age
(以指定要删除的索引的期限)。
例如,下面的Curator配置配置为删除
名为example_dev_*
的
组态:
actions:
1:
action: delete_indices
description: >-
Delete indices older than 10 days (based on index name), for example_dev_
prefixed indices.
options:
ignore_empty_list: True
disable_action: True
filters:
- filtertype: pattern
kind: prefix
value: example_dev_
- filtertype: age
source: creation_date
direction: older
unit: days
unit_count: 10
- filtertype: count
count: 1
您需要使两种过滤条件都适应您的需求,但这将达到您的期望。
关于elasticsearch - Elasticsearch Curator-删除除最新索引以外的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58012529/