策展人不删除旧索引

问题描述

我有一个名为“locations”的索引,几天前我在其中推送了一些数据。我想删除早于 1 天的所有数据。 我的配置看起来像 -

动作: 1:

action: delete_indices

description: >-

  Delete indices older than 10 days (based on index name),for locations
  prefixed indices.

options:
  ignore_empty_list: True
  disable_action: True
filters:
- filtertype: pattern
  kind: prefix
  value: locations
- filtertype: age
  source: creation_date
  direction: older
  unit: days
  unit_count: 1
- filtertype: count
  count: 1
options: 
  disable_action: false
  ignore_empty_list: true
  allow_ilm_indices: true

然而,当我运行这个配置时,我得到了以下 -

2021-04-30 03:33:35,639 DEBUG curator.indexlist iterate_filters:1244 预实例:['locations']

2021-04-30 03:33:35,639 DEBUG curator.indexlist filter_by_count:928 按计数过滤索引

2021-04-30 03:33:35,639 DEBUG curator.indexlist working_list:237 生成索引工作列表

2021-04-30 03:33:35,639 DEBUG curator.indexlist __not_actionable:38 索引位置不可操作,已从列表中删除

2021-04-30 03:33:35,655 DEBUG curator.indexlist __excludify:58 从可操作列表删除:位置为 1,指定计数为 1。

2021-04-30 03:33:35,655 DEBUG curator.indexlist iterate_filters:1246 后实例:[]

2021-04-30 03:33:35,655 DEBUG curator.actions.delete_indices init:612 master_timeout 值:30s

2021-04-30 03:33:35,655 DEBUG curator.cli process_action:103 在此处执行操作。

2021-04-30 03:33:35,655 DEBUG curator.indexlist empty_list_check:226 检查空列表

2021-04-30 03:33:35,655 INFO curator.cli run:202 跳过动作 “delete_indices”由于空列表:

2021-04-30 03:33:35,655 INFO curator.cli run:225 操作 ID:1,“delete_indices”已完成。

2021-04-30 03:33:35,655 INFO curator.cli run:226 作业完成。


我缺少什么配置?

解决方法

Curator 只管理整个索引。 Curator 要么删除索引,要么不删除。它不能从索引中删除数据

然而,实现您所寻求的一种潜在方法是使用 Elasticsearch 的 delete_by_query API。但是,如果您要索引基于时间的连续数据流(例如日志、指标等),我强烈建议您不要这样做。使用 rollover indices 并将旧索引作为一个整体删除会更有效。把对您的 Elasticsearch 集群影响的差异视为 SQL DELETE FROM TABLE WHERE...delete_by_query 语句之间的相同差异。在前者中,单个语句将整个表删除为单个操作,但在后者中可能是数以万计的单个操作。 {{1}} 在 Elasticsearch 术语中是类似的,如果可以避免,还有其他负面影响的原因在追求它。