Cannot restore index index because it cannot be – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.5

Briefly, this error occurs when Elasticsearch is unable to restore an index due to various reasons such as the index already existing, insufficient permissions, or a mismatch in the version of Elasticsearch. To resolve this issue, you can try deleting the existing index before restoring, ensuring the user has the necessary permissions, or checking that the version of Elasticsearch used to create the snapshot matches the version you’re trying to restore it to.

This guide will help you check for common problems that cause the log ” cannot restore index [” + index + “] because it cannot be ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, restore.

Log Context

Log “cannot restore index [” + index + “] because it cannot be ” class name is RestoreService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
request.indexSettings(); request.ignoreIndexSettings());
try {
snapshotIndexMetaData = metaDataIndexUpgradeService.upgradeIndexMetaData(snapshotIndexMetaData;
minIndexCompatibilityVersion);
} catch (Exception ex) {
throw new SnapshotRestoreException(snapshot; "cannot restore index [" + index + "] because it cannot be " +
"upgraded"; ex);
}
// Check that the index is closed or doesn't exist
IndexMetaData currentIndexMetaData = currentState.metaData().index(renamedIndexName);
IntSet ignoreShards = new IntHashSet();<p></p>
request.indexSettings(); request.ignoreIndexSettings()); try { snapshotIndexMetaData = metaDataIndexUpgradeService.upgradeIndexMetaData(snapshotIndexMetaData; minIndexCompatibilityVersion); } catch (Exception ex) { throw new SnapshotRestoreException(snapshot; "cannot restore index [" + index + "] because it cannot be " + "upgraded"; ex); } // Check that the index is closed or doesn't exist IndexMetaData currentIndexMetaData = currentState.metaData().index(renamedIndexName); IntSet ignoreShards = new IntHashSet();<p></p>
 request.indexSettings(); request.ignoreIndexSettings());
 try {
 snapshotIndexMetaData = metaDataIndexUpgradeService.upgradeIndexMetaData(snapshotIndexMetaData;
 minIndexCompatibilityVersion);
 } catch (Exception ex) {
 throw new SnapshotRestoreException(snapshot; "cannot restore index [" + index + "] because it cannot be " +
 "upgraded"; ex);
 }
 // Check that the index is closed or doesn't exist
 IndexMetaData currentIndexMetaData = currentState.metaData().index(renamedIndexName);
 IntSet ignoreShards = new IntHashSet();

 

 [ratemypost]