Each of these examples presupposes that the requisite modules have been imported and an instance of the Elasticsearch client object has been created:
import elasticsearch
import curator
client = elasticsearch.Elasticsearch()
ilo = curator.IndexList(client)
ilo.filter_by_regex(kind='prefix', value='logstash-')
The contents of ilo.indices would then only be indices matching the prefix.
ilo = curator.IndexList(client)
ilo.filter_by_regex(kind='suffix', value='-prod')
The contents of ilo.indices would then only be indices matching the suffix.
This example will match indices with the following criteria:
ilo = curator.IndexList(client)
ilo.filter_by_age(source='name', direction='older', timestring='%Y.%m.%d',
unit='days', unit_count=5
)
The contents of ilo.indices would then only be indices matching these criteria.
This example will match indices with the following criteria:
ilo = curator.IndexList(client)
ilo.filter_by_age(source='creation_date', direction='older',
unit='months', unit_count=2
)
The contents of ilo.indices would then only be indices matching these criteria.
This example will match indices with the following criteria:
ilo = curator.IndexList(client)
ilo.filter_by_age(source='field_stats', direction='older',
unit='weeks', unit_count=3, field='timestamp', stats_result='min_value'
)
The contents of ilo.indices would then only be indices matching these criteria.