Snapshot Restore Fails When Restoring to Index with Different Shard Count

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch 2.19.0

Describe the issue:
We’ve encountered a snapshot restore issue and would appreciate your insights or confirmation on expected behavior.

Steps to Reproduce:

  1. Took a snapshot of an index test-index with number_of_shards = 1.
  2. Deleted the test-index index.
  3. Recreated the test-index index with same name but with different shard count number_of_shards = 5.
  4. Attempted to restore the snapshot taken in Step 1.

Result:

The restore failed with the following error:
[snapshot_restore_exception]: cannot restore index [test-index] with [5] shards from a snapshot of index [test-index] with [1] shards
It seems the mismatch in shard count between the snapshot and the existing index is causing the issue.

Configuration:
PUT test-index
{
“mappings”: {},
“settings”: {
“number_of_shards”: 5,
“number_of_replicas”: 1
}
}

Question:

Is it expected that the snapshot restore fails if the target index has a different number of shards than the original snapshot?
Is there a recommended way to restore a snapshot to an index with a different shard configuration?

@dew Welcome to the forum, yes this behaviour is expected. The workaround would be to restore to a different name and then reindex or split

@Anthony , Thanks for the prompt response and guidance. :slightly_smiling_face: