# SnapshotRestoreException: [repo:snapshot/xxxxx] cannot restore index [my_index] because an open index with same name already exists

- **ID:** `elasticsearch/snapshot-restore-index-already-exists`
- **Domain:** elasticsearch
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

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

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.17.0 | active | — | — |
| 8.11.0 | active | — | — |
| 8.12.0 | active | — | — |

## Workarounds

1. **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.** (90% success)
   ```
   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.
   ```
2. **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"}`.** (85% success)
   ```
   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"}`.
   ```
3. **If the existing index is not needed, delete it with `DELETE /my_index` and then restore directly.** (95% success)
   ```
   If the existing index is not needed, delete it with `DELETE /my_index` and then restore directly.
   ```

## Dead Ends

- **** — Deleting the index removes all current data; the snapshot may not have the latest updates. (70% fail)
- **** — Renaming may break application references or alias configurations. (60% fail)
- **** — Incorrect pattern matching may overwrite unrelated indices or create duplicate names. (75% fail)
