How do I resolve the "cannot restore index [.kibana] because it's open" error in Amazon OpenSearch Service?

Last updated: 2021-07-23

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

Resolution

In Amazon OpenSearch Service versions 5.1 and later, 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 it's 
open"}],"type":"snapshot_restore_exception","reason":"[repository-name:snapshot-name/1A2B34aZQFWQpFOYYJfxmQ]
 cannot restore index [.kibana] because it's open"},"status":500}

Note: Amazon OpenSearch Service is the successor to Amazon Elasticsearch service.

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": true,
  "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.


Did this article help?


Do you need billing or technical support?