Elasticsearch Curator Python API
The Elasticsearch Curator Python API helps you manage your indices and snapshots.
This documentation is for the Elasticsearch Curator Python API. Documentation for the Elasticsearch Curator CLI -- which uses this API and is installed as an entry_point as part of the package -- is available in the Elastic guide.
The Elasticsearch Curator Python API is compatible with the 5.x Elasticsearch versions, and supports Python versions 2.7 and later.
import elasticsearch import curator client = elasticsearch.Elasticsearch() ilo = curator.IndexList(client) ilo.filter_by_regex(kind='prefix', value='logstash-') ilo.filter_by_age(source='name', direction='older', timestring='%Y.%m.%d', unit='days', unit_count=30) delete_indices = curator.DeleteIndices(ilo) delete_indices.do_action()
See more examples in the :doc:`Examples </examples>` page.
The API methods fall into the following categories:
- :doc:`Object Classes </objectclasses>` build and filter index list or snapshot list objects.
- :doc:`Action Classes </actionclasses>` act on object classes.
- :doc:`Utilities </utilities>` are helper methods.
The Elasticsearch Curator Python API uses the standard logging library from Python.
It inherits two loggers from
elasticsearch.trace. Clients use the
elasticsearch logger to log
standard activity, depending on the log level. The
logger logs requests to the server in JSON format as pretty-printed
commands that you can execute from the command line. The
logger is not inherited from the base logger and must be activated separately.
.. toctree:: :maxdepth: 2 objectclasses actionclasses filters utilities examples Changelog
Copyright (c) 2012–2017 Elasticsearch <http://www.elastic.co>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.