Search code examples
elasticsearchelasticsearch-curator

Delete ElasticSearch indexes which matches a specific pattern


How can one use ElasticSearch curator to delete old index which matches a specific pattern. Using curator like this will delete all indexes rather than the ones matching a pattern:

curator --host <ip address> delete indices --time-unit days --older-than 45 --timestring '%Y%m%d'

Assuming one wants to delete indexes from 45 days ago which matches sample_index_*, how to go about it?


Solution

  • Try this:

    curator --host delete indices --time-unit days --older-than 45 --timestring '%Y%m%d' --prefix sample_

    In addition to the prefix option, you can also use suffix and regex