The index.lifecycle.prefer_ilm
setting in Elasticsearch controls whether Index Lifecycle Management (ILM) should take precedence over Snapshot Lifecycle Management (SLM) when determining if an index should be rolled over.
- Default value:
true
- Possible values:
true
orfalse
- Recommendation: Keep the default value unless you have specific requirements for SLM to handle rollovers.
This setting is used to resolve conflicts between ILM and SLM policies when both are configured for the same index. When set to true
, ILM will be responsible for rolling over the index. When set to false
, SLM will handle the rollover process.
This setting was introduced in Elasticsearch 7.4.0 and is available in all subsequent versions.
Example
To change the value of index.lifecycle.prefer_ilm
using the cluster settings API:
PUT _cluster/settings
{
"persistent": {
"index.lifecycle.prefer_ilm": false
}
}
You might want to change this setting to false
if you have a specific use case where you prefer SLM to handle index rollovers, such as when you have more complex snapshot-based retention policies.
Common Issues and Misuses
- Inconsistent rollover behavior when both ILM and SLM policies are configured without understanding this setting's impact.
- Unexpected rollover timing when switching between ILM and SLM without adjusting related policies.
Do's and Don'ts
Do's:
- Understand the implications of changing this setting on your existing ILM and SLM policies.
- Coordinate changes to this setting with updates to your index and snapshot management strategies.
- Document your decision if you choose to change the default value.
Don'ts:
- Don't change this setting without a clear understanding of your index and snapshot management requirements.
- Avoid frequently switching between ILM and SLM for rollover management, as it can lead to confusion and potential issues.
Frequently Asked Questions
Q: How does the index.lifecycle.prefer_ilm setting affect my existing ILM policies?
A: When set to true
(default), your existing ILM policies will continue to manage index rollovers as expected. If changed to false
, SLM policies will take precedence for rollover actions, potentially altering the timing and behavior of index rollovers.
Q: Can I use both ILM and SLM policies on the same index?
A: Yes, you can have both ILM and SLM policies on the same index. The index.lifecycle.prefer_ilm
setting determines which one takes precedence for rollover actions.
Q: What happens if I don't have an SLM policy configured and set index.lifecycle.prefer_ilm to false?
A: If you don't have an SLM policy configured and set index.lifecycle.prefer_ilm
to false
, ILM will still handle the rollover process as there is no SLM policy to take precedence.
Q: How can I verify which policy (ILM or SLM) is currently responsible for rollovers?
A: You can check the current value of the index.lifecycle.prefer_ilm
setting using the cluster settings API. Additionally, you can review the ILM and SLM policy configurations for the specific index to understand which actions are defined.
Q: Does changing index.lifecycle.prefer_ilm affect all indices or can it be set per index?
A: The index.lifecycle.prefer_ilm
setting is a cluster-level setting that affects all indices. It cannot be set on a per-index basis. If you need different behavior for specific indices, you may need to adjust your ILM and SLM policies accordingly.