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: Can I change the rollover alias after creating the index?
A: While it's technically possible, it's not recommended as it can disrupt the ILM process. It's best to set the correct alias from the beginning.

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: Can I use the same rollover alias for multiple indices?
A: While possible, it's generally not recommended as it can lead to confusion and potential conflicts in index management.

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.

Pulse - Elasticsearch Operations Done Right

Stop googling errors and staring at dashboards.

Free Trial

Subscribe to the Pulse Newsletter

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