0

我有一个名为“位置”的索引,几天前我在其中推送了一些数据。我想删除超过 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 调试 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 调试 curator.indexlist __not_actionable:38 索引位置不可操作,从列表中删除。

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

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

2021-04-30 03:33:35,655 调试 curator.actions.delete_indices 初始化: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”:<class 'curator.exceptions.NoIndices'>

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 工作已完成。


我缺少什么配置?

4

1 回答 1

0

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

但是,实现您所寻求的一种潜在方法是使用 Elasticsearch 的delete_by_queryAPI。但是,如果您正在索引连续的基于时间的数据流(例如日志、指标等),我强烈反对这样做。使用翻转索引并整体删除旧索引效率更高。将您的 Elasticsearch 集群的影响差异视为 SQLDROP TABLEDELETE FROM TABLE WHERE...语句之间的相同差异。在前者中,单个语句将整个表作为单个操作删除,但在后者中,它可能是数万个单独的操作。Adelete_by_query在 Elasticsearch 术语中是相似的,如果可以避免的话,还有其他负面影响的原因。

于 2021-05-01T22:09:03.830 回答