Search code examples
elasticsearchelasticsearch-curator

Elasticsearch curator deleting older indice versions


Imagine I have following set of indices in elasticsearch (1.7):

  • indice_name_something1_2016.10.09
  • indice_name_something1_2016.10.16
  • indice_name_something2_2016.10.09
  • indice_name_something2_2016.10.16
  • indice_name_something3_2016.10.09
  • indice_name_something3_2016.10.16
  • indice_name_something3_2016.10.18
  • indice_name_something4_2016.10.16

I'd like to setup elasticsearch curator, so that it would use indice_name_ as an indice name pattern to remove it if there's a newer version of it, so in my case just following indices would remain in cluster:

  • indice_name_something1_2016.10.16
  • indice_name_something2_2016.10.16
  • indice_name_something3_2016.10.18
  • indice_name_something4_2016.10.16

I went through curator documentation but couldn't find if such use case was supported. Is there a way to configure curator to work that way or I have to build my own application to do that?


Solution

  • Curator 4 should be able to do this, but it does not work with Elasticsearch versions < 2.0. The way Curator 4 would do this is via the newer age filters of creation_date and/or the field_stats API.

    Curator 3 (which does support Elasticsearch 1.7) will not be able to do what you're asking as it does not have access to those API calls.