Elasticsearch Curator Documentation
repository·master·Indexed 25 days ago
https://github.com/elastic/curatorA tool for managing Elasticsearch indices and snapshots. It provides a CLI and Python API to automate index lifecycles through a process of obtaining actionable lists, filtering, and executing actions such as deletion, rollover, and snapshotting. Includes the es_repo_mgr CLI for managing snapshot repositories across Azure, GCS, S3, filesystem, and URL sources.
What's inside Elasticsearch Curator
- Elasticsearch Curator is a tool designed to help you manage your Elasticsearch indices and snapshots. It provides an API that can be used programmatically or via a command-line interface (CLI).
Overview of Curator Filter Types
masterCurator uses filters to select specific indices or snapshots for actions. Filters are defined in YAML arrays using the
filtertypekey. You can chain multiple filters together by providing them as consecutive array elements in your configuration.Index Filter Types:
age,alias,allocated,closed,count,empty,forcemerged,kibana,none,opened,pattern,period,space.Snapshot Filter Types:
age,count,none,pattern,period,state.- filtertype: age source: creation_date direction: older unit: days unit_count: 3 - filtertype: pattern kind: prefix value: log-Overview of Elasticsearch Curator functionality
masterElasticsearch Curator is a tool designed to manage Elasticsearch indices and snapshots through a three-step process:
- Obtain an actionable list: It retrieves the full list of indices or snapshots from your Elasticsearch cluster.
- Filter the list: It iterates through user-defined filters to progressively remove items from the actionable list based on your criteria.
- Execute actions: It performs specified actions (such as deletion, rollover, or snapshotting) on the items that remain in the actionable list after filtering.
Overview of Curator supported operations
masterCurator provides a suite of tools to automate management tasks for both Elasticsearch indices and snapshots. Key capabilities include:
Index Management:
- Add or remove indices from an alias
- Change shard routing (allocation)
- Close or open indices
- Create new indices
- Delete indices
- Force merge indices
- Reindex indices (including from remote clusters)
- Change the number of replicas per shard
- Perform index rollover
- Shrink indices
Snapshot Management:
- Take snapshots (backups) of indices
- Delete snapshots
- Restore snapshots
Understand ILM vs Curator for index management
masterElasticsearch provides Index Lifecycle Management (ILM) as a built-in policy-based feature (available with at least a Basic license).
When to use ILM:
- If ILM provides the necessary functionality for your index lifecycle.
- If you want management to be handled as a matter of policy rather than execution-time analysis.
- If you are using Stack components (like Beats or Logstash) that use ILM by default.
When to use Curator:
- When you require execution-time analysis for management tasks.
- When you need to perform specific management actions that fall outside your defined ILM policies.
Use the Curator API for custom scripting
masterCurator provides both a CLI tool and a Python API. You can use the API to write custom scripts to automate Elasticsearch index management tasks using the same underlying logic as the Curator CLI. The Curator API is built upon the Elasticsearch Python API.Understand ILM Actions in Curator
masterIndex Lifecycle Management (ILM) applies specific policy actions to indices as they transition through time-oriented phases. Curator supports these ILM actions, which are triggered when indices enter the following phases:
- Hot
- Warm
- Cold
- Delete
Common ILM actions include:
Set PriorityRolloverUnfollowAllocateRead-OnlyForce MergeShrinkDelete
Understand the Elasticsearch Curator workflow
masterElasticsearch Curator manages Elasticsearch indices and snapshots using a three-step workflow:
- Obtain an actionable list: Curator retrieves a full list of indices or snapshots from your Elasticsearch cluster.
- Filter the list: It iterates through user-defined filters to progressively remove items from the actionable list based on your criteria.
- Execute actions: It performs specified actions on the remaining items in the actionable list.
Understand the relationship between Curator and Index Lifecycle Management (ILM)
masterElasticsearch provides Index Lifecycle Management (ILM) as a built-in feature (available with at least a Basic license) for managing index lifecycles via policies. While ILM manages these features as a matter of policy, Curator operates via execution-time analysis. Use ILM for standard lifecycle management and Curator for more complex, custom, or analysis-driven index management tasks that fall outside standard ILM policies.Configure ILM for Filebeat
masterStarting with version 7.0, Filebeat uses Index Lifecycle Management (ILM) by default when connecting to a cluster that supports it. Filebeat automatically loads the default policy and applies it to any indices it creates. You can manage these policies via the Index Lifecycle Policies UI in Kibana.Install a specific version of Elasticsearch Curator
masterTo install a specific version of Curator, use the
-Uflag followed by==and the desired version number. The-Uflag will uninstall any current version before installing the specified one.pip install -U elasticsearch-curator==X.Y.ZAvoid false positives with name-based timestrings
masterWhen using
source: namewith atimestring, Curator converts the strftime pattern into a regular expression. A pattern like%Y.%m(year and month) becomes^.*\d{4}\.\d{2}.*$, which will match both monthly indices (index-2016.12) and daily indices (index-2017.04.01).To prevent daily indices from being matched by a monthly pattern, use a second filter with
exclude: Trueto filter out the more specific pattern.- filtertype: pattern kind: timestring value: '%Y.%m' - filtertype: pattern kind: timestring value: '%Y.%m.%d' exclude: True