Use a snapshot to restore a point-in-time copy of an OpenSearch cluster. You can restore it to the original cluster or to another eligible cluster. This process fetches the backed-up index data, metadata, and shard structure from OBS and reconstruct them in the selected destination cluster, ensuring data consistency. This capability is essential for operations like data rollback, cluster migration, and disaster recovery.
In the source cluster's snapshot task list, there are snapshots whose status is Available. The status of the destination cluster is also Available.
Parameter | Description |
|---|---|
Index | Specify the name of the index you want to restore.
By default, this parameter is left blank. That is, no index name is specified, and all indexes will be restored. |
Rename Pattern | Index name matching rule. Enter a regular expression. Indexes that match the regular expression will be restored. The Rename Pattern and Rename Replacement take effect only when they are both configured at the same time. For an example, see Index, Rename Pattern, and Rename Replacement: Parameters and Examples. The value is a string of 0 to 1024 characters that cannot contain uppercase letters, spaces, or the following special characters: "\<|>/?,. For example, index_(.+) indicates that all indexes whose name starts with index_ will be renamed upon restoration. |
Rename Replacement | Rule for index renaming. Upon restoration, matching indexes are renamed according to the defined rule. The Rename Pattern and Rename Replacement take effect only when they are both configured at the same time. For an example, see Index, Rename Pattern, and Rename Replacement: Parameters and Examples. The value is a string of 0 to 1024 characters that cannot contain uppercase letters, spaces, or the following special characters: "\<|>/?,. For example, restored_index_$1 indicates that restored_ will prefix the name of all restored indexes. |
Cluster | Select the cluster where you want to restore the data to. You can select the current cluster or another.
|
Overwrite same-name indexes in destination cluster | Whether to overwrite same-name indexes in the destination cluster. By default, this option is unselected. Restoring a snapshot will overwrite existing data in the destination cluster. When there are same-name indexes in the destination cluster, you need to select this option in order to restore same-name, same-shard structure indexes. Indexes with a different shard structure cannot be restored. |
If restoration succeeds, Task Status of the snapshot in the snapshot task list will change to Restoration succeeded, and the index data captured in the snapshot is reconstructed.
After snapshot restoration, go to the destination cluster to check the restored index information.
The left part of the console is the command input box, and the triangle icon in its upper-right corner is the execution button. The right part shows the execution result.
GET _cat/indices
This section describes the Index, Rename Pattern, and Rename Replacement parameters. It also provides examples to show how to configure them.
Specify Index for the index to be replaced.
To rename an index upon restoring it, specify Index, Rename Pattern, and Rename Replacement. Their meanings are as follows:
Example:
The corresponding API request is as follows:
POST /_snapshot/xxx/snapshot_xxx/_restore{"indices": "index_*, old_index","ignore_unavailable": true,"include_global_state": true,"rename_pattern": "index_(.+)", // This corresponds to the Rename Pattern parameter."rename_replacement": "restored_index_$1", // This corresponds to the Rename Replacement parameter.}
Result: