Elasticsearch index.lifecycle.rollover_alias Setting

The index.lifecycle.rollover_alias setting is a crucial component of 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; must be explicitly set
  • Possible values: Any valid alias name
  • Recommendations: Choose a descriptive alias name that reflects the purpose or content of your indices

This setting is essential for the rollover action in ILM policies. When set, it defines which alias should be used to track the active write index. As new indices are created during rollover, this alias is updated to point to the most recent index, ensuring seamless write operations.

Example and Effects

PUT _ilm/policy/my_policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_size": "50GB",
            "max_age": "30d"
          }
        }
      }
    }
  }
}

PUT my-index-000001
{
  "settings": {
    "index.lifecycle.name": "my_policy",
    "index.lifecycle.rollover_alias": "my-write-alias"
  },
  "aliases": {
    "my-write-alias": {
      "is_write_index": true
    }
  }
}

In this example, we set index.lifecycle.rollover_alias to "my-write-alias". When the rollover conditions are met (50GB size or 30 days age), a new index will be created, and "my-write-alias" will be updated to point to this new index.

Changing this setting allows you to control which alias is used for rollovers, enabling you to manage multiple sets of time-series or growing indices independently.

Common Issues or Misuses

  1. Forgetting to create the initial alias when setting up the first index
  2. Using the same rollover alias for multiple index patterns, leading to unexpected rollovers
  3. Modifying the alias manually, which can interfere with ILM's management

Do's and Don'ts

Do's:

  • Use a consistent naming convention for your rollover aliases
  • Ensure the alias exists and is properly configured before starting the ILM policy
  • Use different aliases for different index patterns or data streams

Don'ts:

  • Don't change the rollover alias after the ILM policy has started managing indices
  • Avoid using the same alias in multiple ILM policies
  • Don't manually modify the write index for the rollover alias

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: What happens if I don't set a rollover alias?
A: If no rollover alias is set, the rollover action in your ILM policy will fail, and your indices won't be managed as expected. 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: How does the rollover alias interact with data streams?
A: For data streams, the rollover alias is automatically managed by Elasticsearch, and you don't need to set it explicitly.

Q: Can I use a rollover alias with indices that are not managed by ILM?
A: Yes, you can use rollover aliases independently of ILM, but you would need to manage the rollover process manually or through custom scripts.

Subscribe to the Pulse Newsletter

Get early access to new Pulse features, insightful blogs & exclusive events , webinars, and workshops.

We use cookies to provide an optimized user experience and understand our traffic. To learn more, read our use of cookies; otherwise, please choose 'Accept Cookies' to continue using our website.