How do I resolve the "cannot restore index [.kibana]" error in Amazon OpenSearch Service?

2 minute read
0

When I try to restore indices from manual snapshots in Amazon OpenSearch Service, the restoration fails with an error message.

Resolution

Amazon OpenSearch Service monitors the .kibana index and recreates the index when it's deleted. This behavior can cause the restoration to fail with the following error message:

{
    "error": {
        "root_cause": [{
            "type": "snapshot_restore_exception",
            "reason": "[repository-name:snapshot-name/1A2B34aZQFWQpFOYYJfxmQ] cannot restore index [.kibana] because an open index with same name already exists in the cluster. Either close or delete the existing index or restore the index under a different name by providing a rename pattern and replacement name"
        }],
        "type": "snapshot_restore_exception",
        "reason": "[repository-name:snapshot-name/1A2B34aZQFWQpFOYYJfxmQ] cannot restore index [.kibana] because an open index with same name already exists in the cluster. Either close or delete the existing index or restore the index under a different name by providing a rename pattern and replacement name"
    },
    "status": 500
}

To resolve this issue, perform the following steps:

1.    Restore the indices and rename the .kibana index, like this:

# restore indices.   $ curl -XPOST -H 'Content-Type: application/json' 'https://your-domain-end-point/_snapshot/your-repository-name/your-snapshot-name/_restore' -d'
{
    "indices": "*",
    "ignore_unavailable": true,
    "include_global_state": false,
    "rename_pattern": ".kibana",
    "rename_replacement": "restored_.kibana"
}

In this example, the .kibana index is renamed to "restored_.kibana".

2.    Use the _reindex API operation to rename "restored_.kibana" back to ".kibana", like this:

# reindex restored_.kibana to .kibana 
$ curl -XPOST -H 'Content-Type: application/json' 'https://your-domain-end-point/_reindex' -d'
{
    "source": {
        "index": "restored_.kibana"
    },
    "dest": {
        "index": ".kibana"
    }
}

You can now restore your indices from a manual snapshot.

AWS OFFICIAL
AWS OFFICIALUpdated 9 months ago