【问题标题】:elasticsearch curator delete "all" indices order than 7 dayselasticsearch curator 删除“所有”索引订单超过 7 天
【发布时间】:2019-10-09 06:29:35
【问题描述】:

背景:

elasticsearch version 6.2
curator version 5.4.1.

现在我可以使用 curator 删除一个订购 7 天的索引,但是我有多个索引并且我不想创建多个 action.yml,例如:

actions:
  1:
    action: delete_indices
    description: >-
        Delete indices older than 7 days (based on index name), for student-prefixed indices. Ignore the error if the filter does not result in an actionable list of indices (ignore_empty_list) and exit cleanly.
    options:
      ignore_empty_list: True
      disable_action: False
    filters:
        - filtertype: pattern
          kind: prefix
          value: student=
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y-%m-%d'
          unit: days
          unit_count: 7

根据这个action.yml,它删除了student=2017-XX-XX。 但是我有很多指标,比如老师、家长等等。 我将 studnet= 替换为 *= 但不起作用。

那我该怎么办? 非常感谢。

【问题讨论】:

    标签: elasticsearch elasticsearch-curator


    【解决方案1】:

    你尝试了一些事情。一些例子包括:

    1. 您可以省略pattern 过滤器类型,只留下age。但是,这可能会删除具有 %Y-%m-%d 模式的其他索引。在这种情况下,您可能会使用不同的 pattern 过滤器,但对于您不想删除的 exclude 模式: - filtertype: pattern kind: prefix value: omit_me exclude: true 用这个替换你的 pattern 过滤器将删除所有超过 7 天的 %Y-%m-%d 索引,除了omit_me 开头的索引。
    2. 您可以设置regex 而不是prefix。例如: - filtertype: pattern kind: regex value: '^(student|parent|teacher).*$' 这将匹配以 studentparentteacher 开头的索引。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-05
      • 2017-07-03
      • 1970-01-01
      相关资源
      最近更新 更多