Upgrading¶
Rolling upgrades from 8.x to 9.x¶
The Elasticsearch role supports zero-downtime rolling upgrades from Elastic 8.x to 9.x. Each node is stopped, upgraded, and restarted one at a time while the cluster stays operational.
How it works¶
- The role detects the installed version vs the target version
- For each node (one at a time):
- Disables shard allocation to prevent rebalancing during restart
- Flushes indices to reduce recovery time after restart
- Stops Elasticsearch and upgrades the package
- Starts Elasticsearch with the new version
- Waits for the node to rejoin and the cluster to reach green
- Re-enables shard allocation
- Kibana, Logstash, Beats, and Elastic Agent are upgraded after Elasticsearch
Running an upgrade¶
Change the release version and re-run your playbook:
The role handles the upgrade order automatically. Elasticsearch nodes are upgraded first, then Kibana, Logstash, Beats, and Elastic Agent.
Upgrade path requirement¶
Elasticsearch 9.x requires version 8.19.x as a stepping stone. The role validates this automatically — if you try to jump from 8.15 to 9.x, it fails with a clear error telling you to upgrade to 8.19 first. This is an Elastic requirement, not a role limitation.
Safety checks¶
The role refuses to upgrade if:
- The cluster is not green before starting
- The upgrade path requirement is not met (must be on 8.19.x for 9.x)
Unsafe restart mode¶
For development environments where you want to skip the safety checks:
Warning
Never use this in production. It bypasses the rolling upgrade safety checks and may cause data loss.
Upgrading other components¶
Kibana, Logstash, Beats, and Elastic Agent are simpler — they don't need rolling restarts. The roles detect the version mismatch, upgrade the package, and restart the service. Run them after all Elasticsearch nodes are upgraded. Package-based Elastic Agent upgrades are controlled by elasticstack_version; Fleet-managed binary upgrades require the Fleet-supported installation method.
Rollback¶
There is no automated rollback. If an upgrade fails:
- Stop Elasticsearch on the failed node
- Downgrade the package:
apt install elasticsearch=8.x.yoryum downgrade elasticsearch-8.x.y - Start Elasticsearch
- The node will rejoin the cluster with the old version
Note
Elasticsearch does not support running mixed major versions long-term. Complete the upgrade or roll back all nodes to the same version.
Minor version upgrades¶
Minor version upgrades (e.g. 8.15 to 8.17) are handled automatically. Re-run the playbook and the package manager installs the latest version within the major release. No special steps needed — the role handles service restart and health checks.