Restoring a Snapshot
Function
This API is used to restore a specified snapshot. Use a snapshot to restore a point-in-time copy of a cluster to the original cluster or to another eligible cluster.
Constraints
-
Before snapshot restoration is completed, the indexes being restored to the destination cluster cannot be queried.
-
If the two clusters have indexes with the same names but different shard structures, such indexes cannot be restored.
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 Value range: Project ID of the account. 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 Value range: Cluster ID. 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 destination cluster to which the snapshot is restored. Constraints:
Value range: N/A Default value: N/A |
|
indices |
No |
String |
Definition: Specify the name of the index you want to restore. Constraints: The value is a string of 0 to 1024 characters that cannot contain uppercase letters, spaces, or the following special characters: "<|>/?.
Value range:
Default value: By default, this parameter is left blank. That is, no index name is specified, and all indexes will be 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.