elasticsearch - Elasticsearch Curator-删除除最新索引以外的索引

标签 elasticsearch elasticsearch-curator

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

我尝试使用filtertype: age,但似乎无法满足我的需要。

最佳答案

您需要两个过滤器: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
    

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

    关于elasticsearch - Elasticsearch Curator-删除除最新索引以外的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58012529/

    相关文章:

    performance - 使用过滤器,查询或两者结合来优化Elasticsearch查询

    ElasticSearch 6 高级 Rest 客户端 preparePutMapping

    elasticsearch - 在Elasticsearch上自动创建快照存储库-Kubernetes

    Elasticsearch 集群未分配分片

    elasticsearch - Elasticsearch策展人删除整个索引而不是旧文档

    elasticsearch - 用elasticsearch搜索整个世界

    angularjs - 跨多个索引的 Elasticsearch 搜索 - 忽略不存在的索引

    java - Elasticsearch 的硬编码 JAVA_HOME 环境变量

    Elasticsearch Marvel 将 .marvel-2015-* 索引设置为最大值