The index.lifecycle.name
setting in Elasticsearch is used to associate an index with a specific Index Lifecycle Management (ILM) policy. This setting controls which lifecycle policy is applied to the index, determining how the index is managed throughout its lifecycle.
- Default value: No default value. If not set, no ILM policy is applied to the index.
- Possible values: Any valid ILM policy name that exists in the cluster.
- Recommendations: It's recommended to set this value when creating an index if you want to use ILM to manage the index's lifecycle automatically.
This setting is available from Elasticsearch version 6.6.0 and onwards.
Example
To set the index.lifecycle.name
when creating an index:
PUT my-index
{
"settings": {
"index.lifecycle.name": "my_policy"
}
}
To change the ILM policy for an existing index using the cluster settings API:
PUT /my-index/_settings
{
"index.lifecycle.name": "new_policy"
}
Changing this setting associates the index with a different ILM policy, which may alter how the index is managed, including when it's rolled over, shrunk, or deleted.
Common Issues and Misuses
- Setting a non-existent policy name will result in an error.
- Changing the policy for an index that has already progressed through some lifecycle phases may lead to unexpected behavior.
- Forgetting to create the referenced ILM policy before associating it with an index.
Do's and Don'ts
- Do create the ILM policy before referencing it in the
index.lifecycle.name
setting. - Do consider using index templates to automatically apply ILM policies to new indices.
- Don't frequently change the ILM policy for an index, as it may disrupt the intended lifecycle management.
- Don't use this setting for indices that you want to manage manually.
Frequently Asked Questions
Q: Can I remove an ILM policy from an index?
A: Yes, you can remove the ILM policy by setting index.lifecycle.name
to null using the index settings API.
Q: What happens if I delete the ILM policy referenced by an index?
A: The index will continue to exist, but ILM operations will fail for that index until a valid policy is set or the setting is removed.
Q: Can I use different ILM policies for indices in the same alias?
A: Yes, each index can have its own ILM policy, even if they share an alias.
Q: How does changing the ILM policy affect ongoing ILM operations?
A: Changing the policy may interrupt ongoing operations and start the lifecycle from the beginning with the new policy.
Q: Is it possible to temporarily disable ILM for an index without removing the policy?
A: Yes, you can use the index.lifecycle.indexing_complete
setting to pause ILM operations for an index temporarily.