# ClusterHealthResponse: status=RED, unassigned_shards=5, reason=ALLOCATION_FAILED due to [1] shards not allocated because of rack awareness constraints

- **ID:** `elasticsearch/primary-shard-not-allocated-due-to-rack-awareness`
- **Domain:** elasticsearch
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

Rack awareness allocation filtering prevents primary shard allocation because no node in the required rack has enough disk space or is available.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.17.10 | active | — | — |
| 8.11.0 | active | — | — |
| 8.12.2 | active | — | — |

## Workarounds

1. **Temporarily disable rack awareness allocation filtering: PUT _cluster/settings { "transient": { "cluster.routing.allocation.awareness.attributes": "" } } then re-enable after shards allocate** (90% success)
   ```
   Temporarily disable rack awareness allocation filtering: PUT _cluster/settings { "transient": { "cluster.routing.allocation.awareness.attributes": "" } } then re-enable after shards allocate
   ```
2. **Add a node in the required rack and ensure it has sufficient disk space, then use the cluster rebalance API: POST _cluster/reroute?retry_failed=true** (95% success)
   ```
   Add a node in the required rack and ensure it has sufficient disk space, then use the cluster rebalance API: POST _cluster/reroute?retry_failed=true
   ```

## Dead Ends

- **** — The issue is not overall disk space but the specific rack's node availability; increasing space on nodes in other racks does not satisfy the allocation filter (65% fail)
- **** — Re-creating the index with fewer shards does not address the rack awareness constraint; the new primary shards will still fail to allocate if the same rack is unavailable (80% fail)
