The index.lifecycle.rollover_alias
setting is an important configuration option in Elasticsearch's Index Lifecycle Management (ILM) feature. It specifies the alias to use when performing a rollover action as part of an index lifecycle policy.
- Default value: No default value
- Possible values: Any valid alias name
- Recommendations: Set this to the alias name you want to use for the rollover action in your ILM policy
This setting is crucial for the proper functioning of the rollover action in ILM policies. When a rollover occurs, Elasticsearch will update the specified alias to point to the new index created during the rollover process.
This setting has been available since the introduction of Index Lifecycle Management in Elasticsearch 6.6.0.
Example Usage
To set the index.lifecycle.rollover_alias
for an index:
PUT /my-index-000001
{
"settings": {
"index.lifecycle.name": "my_policy",
"index.lifecycle.rollover_alias": "my-alias"
},
"aliases": {
"my-alias": {
"is_write_index": true
}
}
}
In this example, we're creating an index with an ILM policy and setting the rollover alias to "my-alias". When the rollover action is triggered, Elasticsearch will create a new index and update the "my-alias" to point to it.
Common Issues or Misuses
- Forgetting to set the
is_write_index
property for the alias. - Using different alias names in the
index.lifecycle.rollover_alias
setting and the actual alias definition. - Applying the setting to indices that are not meant to be rolled over.
Do's and Don'ts
- Do ensure that the alias specified in this setting exists and is properly configured.
- Do use this setting in conjunction with a well-defined ILM policy that includes a rollover action.
- Don't change this setting after the index has been created, as it may lead to unexpected behavior.
- Don't use the same rollover alias for multiple indices unless you have a specific reason to do so.
Frequently Asked Questions
Q: What happens if I don't set the index.lifecycle.rollover_alias?
A: If you don't set this alias and your ILM policy includes a rollover action, the rollover will fail, and your index won't be able to progress through its lifecycle as expected.
Q: Can I change the rollover alias after creating the index?
A: It's not recommended to change the rollover alias after index creation. Doing so may cause issues with the ILM policy execution. If you need to change it, it's better to create a new index with the correct settings.
Q: How does this setting interact with the rollover action in an ILM policy?
A: When the rollover action is triggered in an ILM policy, Elasticsearch uses the alias specified in this setting to create a new index and update the alias to point to the new index.
Q: Can I use the same rollover alias for multiple indices?
A: While it's possible, it's generally not recommended unless you have a specific use case. Using the same alias for multiple indices can lead to confusion and potential issues with write operations.
Q: Is this setting required for all indices using ILM?
A: No, this setting is only required for indices that use an ILM policy with a rollover action. If your policy doesn't include a rollover action, you don't need to set this.