Restoring snapshots
Before you restore a snapshot, make sure that the destination domain does not use Multi-AZ with Standby. Having standby enabled causes the restore operation to fail.
Warning
If you use index aliases, you should either cease write requests to an alias or switch the alias to another index prior to deleting its index. Halting write requests helps avoid the following scenario:
-
You delete an index, which also deletes its alias.
-
An errant write request to the now-deleted alias creates a new index with the same name as the alias.
-
You can no longer use the alias due to a naming conflict with the new index. If you switched the alias to another index, specify
"include_aliases": false
when you restore from a snapshot.
To restore a snapshot
-
Identify the snapshot you want to restore. Ensure that all settings for this index, such as custom analyzer packages or allocation requirement settings, are compatible with the domain. To see all snapshot repositories, run the following command:
curl -XGET '
domain-endpoint
/_snapshot?pretty'After you identify the repository, run the following command to see all snapshots:
curl -XGET '
domain-endpoint
/_snapshot/repository-name
/_all?pretty'Note
Most automated snapshots are stored in the
cs-automated
repository. If your domain encrypts data at rest, they're stored in thecs-automated-enc
repository. If you don't see the manual snapshot repository you're looking for, make sure you registered it to the domain. -
(Optional) Delete or rename one or more indexes in the OpenSearch Service domain if you have naming conflicts between indexes on the cluster and indexes in the snapshot. You can't restore a snapshot of your indexes to an OpenSearch cluster that already contains indexes with the same names.
You have the following options if you have index naming conflicts:
-
Delete the indexes on the existing OpenSearch Service domain and then restore the snapshot.
-
Rename the indexes as you restore them from the snapshot and reindex them later. To learn how to rename indexes, see this example request
in the OpenSearch documentation. -
Restore the snapshot to a different OpenSearch Service domain (only possible with manual snapshots).
The following command deletes all existing indexes in a domain:
curl -XDELETE '
domain-endpoint
/_all'However, if you don't plan to restore all indexes, you can just delete one:
curl -XDELETE '
domain-endpoint
/index-name
' -
-
To restore a snapshot, run the following command:
curl -XPOST '
domain-endpoint
/_snapshot/repository-name
/snapshot-name
/_restore'Due to special permissions on the OpenSearch Dashboards and fine-grained access control indexes, attempts to restore all indexes might fail, especially if you try to restore from an automated snapshot. The following example restores just one index,
my-index
, from2020-snapshot
in thecs-automated
snapshot repository:curl -XPOST '
domain-endpoint
/_snapshot/cs-automated/2020-snapshot/_restore' \ -d '{"indices": "my-index"}' \ -H 'Content-Type: application/json'Alternately, you might want to restore all indexes except the Dashboards and fine-grained access control indexes:
curl -XPOST '
domain-endpoint
/_snapshot/cs-automated/2020-snapshot/_restore' \ -d '{"indices": "-.kibana*,-.opendistro*"}' \ -H 'Content-Type: application/json'You can restore a snapshot without deleting its data by using the
rename_pattern
andrename_replacement
parameters. For more information on these parameters, see the Restore Snapshot API request fieldsand example request in the OpenSearch documentation.
Note
If not all primary shards were available for the indexes involved, a snapshot
might have a state
of PARTIAL
. This value indicates that
data from at least one shard wasn't stored successfully. You can still restore from
a partial snapshot, but you might need to use older snapshots to restore any missing
indexes.