Amazon OpenSearch Service で手動のスナップショットからインデックスを復元しようとすると、復元が失敗してエラーメッセージが表示されます。
解決策
Amazon OpenSearch Service では、.kibana インデックスがモニタリングされ、インデックスが削除された場合は再度作成されます。この動作で復元が失敗し、次のエラーメッセージが表示されることがあります。
{
"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
}
この問題を解決するには、次の手順を実行します。
1. インデックスを復元し、次のように .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": false,
"rename_pattern": ".kibana",
"rename_replacement": "restored_.kibana"
}
この例では、.kibana インデックスの名前が「restored_.kibana」に変更されています。
2. _reindex API オペレーションを使用して、次のように「restored_.kibana」の名前を「.kibana」に戻します。
# 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"
}
}
これで、手動のスナップショットからインデックスを復元できるようになりました。