在 Centos 7 中使用 Elasticsearch 5.1 和 Curator 版本是 4.3
我在弹性搜索中有一些索引,其命名格式为 sample.data.YYYY_MM_DD , sample.file.YYYY_MM_DD 例如:-
sample.data.2019_07_22
sample.data.2019_07_23
sample.data.2019_07_25
sample.data.2019_07_26
sample.data.2019_07_28
sample.file.2019_07_21
sample.file.2019_07_25
sample.file.2019_07_26
sample.file.2019_07_29
我曾经在 Linux 中使用以下命令来运行操作文件。
策展人 --config /root/config.yml /root/action_file.yml
我想删除所有索引,但最近创建的索引较新 [sample.data.2019_07_28, sample.file.2019_07_29]
这是我尝试过的:-
---
actions:
1:
action: delete_indices
description: "Delete indices older than 3 days (based on index name), for workflow- prefixed indices. Ignore the error if the filter does not result in an actionable list of indices (ignore_empty_list) and exit cleanly."
filters:
-
exclude: ~
filtertype: pattern
kind: prefix
value: sample.*.
-
direction: older
exclude: ~
filtertype: age
source: name
timestring: "%Y%m%d"
unit: days
unit_count: 3
options:
continue_if_exception: false
disable_action: false
ignore_empty_list: true
timeout_override: ~
即使我也使用了以下功能,它也会删除整体索引,
- filtertype: count
count: 4
预期输出如下: -
sample.data.2019_07_28
sample.file.2019_07_29