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

Last updated: 2020-01-09

When I try to restore indices from manual snapshots in Amazon Elasticsearch Service (Amazon ES), the restoration fails with an error message like this:

{"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}

Resolution

In Elasticsearch versions 5.1 and later, Amazon ES monitors the .kibana index and recreates it if it's deleted. This behavior can cause the restoration to fail. To resolve this problem:

1.    Run a command similar to the following to restore the indices and rename the .kibana index. In this example, the .kibana index is renamed to "restored_.kibana".

# 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"
}'

2.    Use the _reindex API operation to rename "restored_.kibana" back to ".kibana". Example:

# 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 indices from manual snapshots.


Did this article help you?

Anything we could improve?


Need more help?