I have set up Curator to delete old indexes via this filter:
(...)
filters:
- filtertype: pattern
kind: regex
value: '^xyz-us-(prod|preprod)-(.*)-'
exclude:
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 7
exclude:
(...)
However, I realized that Curator uses non-greedy regexes, because this filter catches the index xyz-us-prod-foo-2018.10.11 but not xyz-us-prod-foo-bar-2018.10.11.
How can I modify the filter to catch both indexes?
---
actions:
1:
action: delete_indices
filters:
- filtertype: pattern
kind: regex
value: '^xyz-us-(prod|preprod)-.*-\d{4}\.\d{2}\.\d{2}$'
exclude:
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 7
I created these indices:
PUT xyz-us-prod-foo-2018.10.11
PUT xyz-us-prod-foo-bar-2018.10.11
and it matched both of them:
2018-10-29 20:02:29,091 DEBUG curator.indexlist filter_by_regex:425 Filtering indices by regex
2018-10-29 20:02:29,091 DEBUG curator.indexlist empty_list_check:225 Checking for empty list
2018-10-29 20:02:29,091 DEBUG curator.indexlist working_list:236 Generating working list of indices
2018-10-29 20:02:29,091 DEBUG curator.indexlist filter_by_regex:446 Filter by regex: Index: xyz-us-prod-foo-2018.10.11
2018-10-29 20:02:29,091 DEBUG curator.indexlist __actionable:35 Index xyz-us-prod-foo-2018.10.11 is actionable and remains in the list.
2018-10-29 20:02:29,091 DEBUG curator.indexlist filter_by_regex:446 Filter by regex: Index: xyz-us-prod-foo-bar-2018.10.11
2018-10-29 20:02:29,092 DEBUG curator.indexlist __actionable:35 Index xyz-us-prod-foo-bar-2018.10.11 is actionable and remains in the list.
2018-10-29 20:02:29,092 DEBUG curator.indexlist iterate_filters:1185 Post-instance: ['xyz-us-prod-foo-2018.10.11', 'xyz-us-prod-foo-bar-2018.10.11']
...
2018-10-29 20:02:29,097 INFO curator.utils show_dry_run:918 DRY-RUN MODE. No changes will be made.
2018-10-29 20:02:29,097 INFO curator.utils show_dry_run:921 (CLOSED) indices may be shown that may not be acted on by action "delete_indices".
2018-10-29 20:02:29,097 INFO curator.utils show_dry_run:928 DRY-RUN: delete_indices: xyz-us-prod-foo-2018.10.11 with arguments: {}
2018-10-29 20:02:29,098 INFO curator.utils show_dry_run:928 DRY-RUN: delete_indices: xyz-us-prod-foo-bar-2018.10.11 with arguments: {}
2018-10-29 20:02:29,098 INFO curator.cli run:196 Action ID: 1, "delete_indices" completed.
2018-10-29 20:02:29,098 INFO curator.cli run:197 Job completed.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.