Restoring a Snapshot
Function
This API is used to restore a specified snapshot for an Elasticsearch or OpenSearch cluster. Use a snapshot to restore a point-in-time copy of a cluster to the original cluster or to another eligible cluster.
Constraints
Calling Method
For details, see Calling APIs.
URI
POST /v1.0/{project_id}/clusters/{cluster_id}/index_snapshot/{snapshot_id}/restore
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name. Constraints N/A Range Project ID of an account. The value contains 32 characters, consisting of lowercase letters and digits. Default Value N/A |
| cluster_id | Yes | String | Definition Cluster ID. For details about how to obtain the cluster ID, see Obtaining the Cluster ID. Constraints N/A Range The value is a UUID containing 36 characters. Default Value N/A |
| snapshot_id | Yes | String | Definition: The snapshot ID. For details, see Querying Snapshots. Constraints: The snapshot status is Available. Value range: N/A Default value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| target_cluster | Yes | String | Definition ID of the target cluster to which the snapshot is restored. For details about how to obtain the cluster ID, see Obtaining the Cluster ID. Constraints
Range N/A Default Value N/A |
| indices | No | String | Definition Name of the index to be restored. Constraints Range
Default Value Empty by default, indicating that no index name is specified and all indexes are restored. |
| rename_pattern | No | String | Definition: Rule for defining the indexes to be restored. Constraints:
Value range: The value can contain 0 to 1,024 characters. Uppercase letters, spaces, and the following special characters are not allowed: "\<|>/? Default value: N/A |
| rename_replacement | No | String | Definition: Rule for renaming an index. Constraints: The renamePattern and renameReplacement parameters must be set at the same time in order for them to take effect. Value range: The value can contain 0 to 1,024 characters. Uppercase letters, spaces, and the following special characters are not allowed: "\<|>/? For example, restored_index_$1 indicates adding the restored_ prefix to the names of all the restored indexes. Default value: N/A |
| replace_exist_indices | No | Boolean | Definition: Whether to overwrite same-name indexes in the destination cluster. 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. Constraints: N/A Value range: Default value: false |
Response Parameters
Status code: 201
Resource created.
None
Example Requests
Restore a snapshot.
POST https://{Endpoint}/v1.0/{project_id}/clusters/4f3deec3-efa8-4598-bf91-560aad1377a3/index_snapshot/653c086f-ebe7-4383-b902-c031b354f1dd/restore
{
"target_cluster" : "ea244205-d641-45d9-9dcb-ab2236bcd07e",
"indices" : "myindex1,myindex2",
"rename_pattern" : "index",
"rename_replacement" : "restored_index_$1"
} Example Responses
None
Status Codes
| Status Code | Description |
|---|---|
| 201 | Resource created. |
| 400 | Invalid request. Modify the request before retry. |
| 403 | Request rejected. The server has received the request and understood it, but refused to respond to it. The client should not repeat the request without modifications. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot