{
  "id": "elasticsearch/primary-shard-not-allocated",
  "signature": "PrimaryShardNotAllocatedException: primary shard is not allocated",
  "signature_zh": "PrimaryShardNotAllocatedException: 主分片未分配",
  "regex": "primary shard is not allocated",
  "domain": "elasticsearch",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "A primary shard cannot be assigned to any node due to allocation decider rules, disk space, or node failures.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于分配决策规则、磁盘空间不足或节点故障，主分片无法分配到任何节点。",
  "versions": [
    {
      "version": "elasticsearch 8.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "elasticsearch 8.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "elasticsearch 7.17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "opensearch 2.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the allocation decider blocks (e.g., disk threshold), reroute is rejected; the underlying issue persists.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Data loss occurs; the problem is not diagnosed and may reappear for new indices.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Replicas require a primary shard first; increasing replicas does not help if primary is unallocated.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check allocation explain: GET _cluster/allocation/explain?pretty and fix the root cause (e.g., free disk space, adjust routing allocation settings). Example: POST _cluster/settings { \"persistent\": { \"cluster.routing.allocation.disk.watermark.low\": \"90%\" } }",
      "success_rate": 0.9,
      "how": "Check allocation explain: GET _cluster/allocation/explain?pretty and fix the root cause (e.g., free disk space, adjust routing allocation settings). Example: POST _cluster/settings { \"persistent\": { \"cluster.routing.allocation.disk.watermark.low\": \"90%\" } }",
      "condition": "",
      "sources": []
    },
    {
      "action": "If due to node failure, re-enable allocation: PUT _cluster/settings { \"persistent\": { \"cluster.routing.allocation.enable\": \"all\" } }",
      "success_rate": 0.8,
      "how": "If due to node failure, re-enable allocation: PUT _cluster/settings { \"persistent\": { \"cluster.routing.allocation.enable\": \"all\" } }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Manually allocate the shard to a specific node after verifying node health: POST _cluster/reroute { \"commands\": [ { \"allocate_empty_primary\": { \"index\": \"my_index\", \"shard\": 0, \"node\": \"node-1\", \"accept_data_loss\": true } } ] }",
      "success_rate": 0.75,
      "how": "Manually allocate the shard to a specific node after verifying node health: POST _cluster/reroute { \"commands\": [ { \"allocate_empty_primary\": { \"index\": \"my_index\", \"shard\": 0, \"node\": \"node-1\", \"accept_data_loss\": true } } ] }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用_allocation/explain检查分配原因，并修复根本问题（如释放磁盘空间、调整路由设置）。",
    "如果因节点故障导致，重新启用分配。",
    "手动将分片分配到特定节点，需确认节点健康。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}