Curator to delete all indices except index xxx

Hi,

What is the syntax to delete all indices except a particular index
Curator version: 3.4.1

Thanks

For Curator 4, the action.yml file might look like this:

---
actions:
  1:
    action: delete_indices
    options:
      ignore_empty_list: True
    filters:
    - filtertype: pattern
      kind: regex
      value: '^MYINDEXNAME$'
      exclude: True

I highly recommend running this with the --dry-run flag before actually running it against a production environment as it will delete everything except MYINDEXNAME.

1 Like

@theuntergeek I am using cruator 3.4
Can you kindly suggest option for the version?

In curator 3.4.1 there is an option called --exclude TEXT to exclude a particular index

How can I exclude a group of indices with certain pattern

Thanks

https://www.elastic.co/guide/en/elasticsearch/client/curator/3.4/exclude.html

so --exclude '^somepattern.*' should do the trick.

You can test things out with curator --dry-run ..

thank you that helps a lot