# 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`
- **Domain:** elasticsearch
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.10.2 | active | — | — |
| 7.17.0 | active | — | — |
| 8.0.0 | active | — | — |

## Workarounds

1. **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.** (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.
   ```
2. **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.** (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.
   ```

## Dead Ends

- **** — Node version does not change on restart; manual upgrade is required. (95% fail)
- **** — Data is lost and the root cause (version mismatch) remains if other nodes are still newer. (85% fail)
