elasticsearch
config_error
ai_generated
true
PrimaryShardNotAllocatedException: primary shard [my_index][0] not allocated because node version [7.10.2] is incompatible with index version [7.17.0]
ID: elasticsearch/primary-shard-not-allocated-due-to-node-version-mismatch
85%Fix Rate
85%Confidence
1Evidence
2024-03-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.10.2 | active | — | — | — |
| 7.17.0 | active | — | — | — |
| 8.0.0 | active | — | — | — |
Root Cause
A node with an older Elasticsearch version cannot host a primary shard created by a newer version due to Lucene segment format incompatibility.
generic中文
较旧版本的 Elasticsearch 节点无法托管由较新版本创建的主分片,因为 Lucene 段格式不兼容。
Official Documentation
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/rolling-upgrades.htmlWorkarounds
-
90% success Upgrade the older node's Elasticsearch version to match the index version (e.g., from 7.10.2 to 7.17.0) using rolling upgrade: `sudo systemctl stop elasticsearch`, replace package, restart, and wait for shard allocation.
Upgrade the older node's Elasticsearch version to match the index version (e.g., from 7.10.2 to 7.17.0) using rolling upgrade: `sudo systemctl stop elasticsearch`, replace package, restart, and wait for shard allocation.
-
80% success Reindex the data to a new index with compatible settings: `POST _reindex { "source": { "index": "my_index" }, "dest": { "index": "my_index_v2" } }` then delete old index and use alias.
Reindex the data to a new index with compatible settings: `POST _reindex { "source": { "index": "my_index" }, "dest": { "index": "my_index_v2" } }` then delete old index and use alias.
中文步骤
Upgrade the older node's Elasticsearch version to match the index version (e.g., from 7.10.2 to 7.17.0) using rolling upgrade: `sudo systemctl stop elasticsearch`, replace package, restart, and wait for shard allocation.
Reindex the data to a new index with compatible settings: `POST _reindex { "source": { "index": "my_index" }, "dest": { "index": "my_index_v2" } }` then delete old index and use alias.
Dead Ends
Common approaches that don't work:
-
95% fail
Node version does not change on restart; manual upgrade is required.
-
85% fail
Data is lost and the root cause (version mismatch) remains if other nodes are still newer.