Snapshot and Restore of an index

Hi Team, we want to upgrade the older version of index(6.x) to newer version(7.x) in the ES cluster with version 7.17. However the new index which is getting created as part of snapshot restore is getting created with older version(6.x), please find the steps followed below:

  1. Create a Snapshot Repository:

curl -X PUT "localhost:9200/_snapshot/my_backup" -H 'Content-Type: application/json' -d'
{
"type": "fs",
"settings": {
"location": "/path/to/my/backup"
}
}'

  1. Take a Snapshot:

curl -X PUT "localhost:9200/_snapshot/my_backup/snapshot_1" -H 'Content-Type: application/json' -d'
{
"indices": "old_index",
"ignore_unavailable": true,
"include_global_state": false
}'

  1. Restore the Snapshot to a New Index:

curl -X POST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -H 'Content-Type: application/json' -d'
{
"indices": "old_index",
"ignore_unavailable": true,
"include_global_state": false,
"rename_pattern": "old_index",
"rename_replacement": "new_index"
}'

Please let us know if we are missing anything or upgraded index will not be achieved using above steps? if yes, please suggest the ways to do this.

In order to upgrade an index to a newer version you will need to reindex as this changes the structure on disk to the new version. Restoring a snapshot just restores exactly what was in place when the snapshot was taken so can not alter version.

thanks for replying @Christian_Dahlqvist, while re-indexing the index which is getting created is having different mapping than the older index for eg. rountingIds, other index settings, we have the requirement to create the new index with exact same mappings as the old index.

is there a way to copy exact mappings as of the old index and create new index with upgraded version following by copying data from old index to new index?

No, that can as far as I know not be done automatically (there could potentially exist deprecated mappings and settings that are no longer valid for an index created in the new version). You will need to control the mappings either by manually creating the new index with the correct mappings before you start reindexing or create an index template that applies to the new index that enforces the correct set of mappings.