{
  "id": "elasticsearch/snapshot-restore-index-already-exists",
  "signature": "SnapshotRestoreException: [repo:snapshot/xxxxx] cannot restore index [my_index] because an open index with same name already exists",
  "signature_zh": "快照恢复异常：[repo:snapshot/xxxxx]无法恢复索引[my_index]，因为同名索引已存在且处于打开状态",
  "regex": "SnapshotRestoreException: \\[repo:snapshot/xxxxx\\] cannot restore index \\[.*\\] because an open index with same name already exists",
  "domain": "elasticsearch",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The restore operation failed because the target cluster already has an open index with the same name as the one being restored from the snapshot.",
  "root_cause_type": "generic",
  "root_cause_zh": "恢复操作失败，因为目标集群已存在与快照中同名的打开索引。",
  "versions": [
    {
      "version": "7.17.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Deleting the index removes all current data; the snapshot may not have the latest updates.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Renaming may break application references or alias configurations.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Incorrect pattern matching may overwrite unrelated indices or create duplicate names.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Close the existing index before restoring: `POST /my_index/_close`, then restore the snapshot with the same name, and after restore, optionally open the original index or delete it.",
      "success_rate": 0.9,
      "how": "Close the existing index before restoring: `POST /my_index/_close`, then restore the snapshot with the same name, and after restore, optionally open the original index or delete it.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the `rename_pattern` and `rename_replacement` options in the restore request to restore to a different index name: `POST /_snapshot/repo/snapshot/_restore {\"indices\": \"my_index\", \"rename_pattern\": \"my_(.+)\", \"rename_replacement\": \"restored_$1\"}`.",
      "success_rate": 0.85,
      "how": "Use the `rename_pattern` and `rename_replacement` options in the restore request to restore to a different index name: `POST /_snapshot/repo/snapshot/_restore {\"indices\": \"my_index\", \"rename_pattern\": \"my_(.+)\", \"rename_replacement\": \"restored_$1\"}`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the existing index is not needed, delete it with `DELETE /my_index` and then restore directly.",
      "success_rate": 0.95,
      "how": "If the existing index is not needed, delete it with `DELETE /my_index` and then restore directly.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Close the existing index before restoring: `POST /my_index/_close`, then restore the snapshot with the same name, and after restore, optionally open the original index or delete it.",
    "Use the `rename_pattern` and `rename_replacement` options in the restore request to restore to a different index name: `POST /_snapshot/repo/snapshot/_restore {\"indices\": \"my_index\", \"rename_pattern\": \"my_(.+)\", \"rename_replacement\": \"restored_$1\"}`.",
    "If the existing index is not needed, delete it with `DELETE /my_index` and then restore directly."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshot-restore.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2025-02-28",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}