温馨提示:本文翻译自stackoverflow.com,查看原文请点击:Elasticsearch Curator - delete indices except newest
elasticsearch elasticsearch-curator

Elasticsearch Curator - 删除除最新的索引

发布于 2020-03-31 23:51:43

使用Elasticsearch策展人,如何删除与模式匹配的所有索引,但最新的除外?

我尝试使用,filtertype: age但是它似乎没有满足我的需求。

查看更多

提问者
RFI
被浏览
104
Val 2019-09-19 22:17

您需要两个过滤器:(pattern以匹配要删除的索引)和age(以指定要删除的索引的期限)。

例如,下面的Curator配置配置为删除

  • 索引命名 example_dev_*
  • 超过10天

组态:

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

您需要使两种过滤条件都适应您的需求,但这将达到您的期望。