Updated on 2024-12-02 GMT+08:00

Restoring a Snapshot

Function

This API is used to manually restore a snapshot.

URI

POST /v1.0/{project_id}/clusters/{cluster_id}/index_snapshot/{snapshot_id}/restore

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name.

cluster_id

Yes

String

ID of the cluster whose snapshot you want to restore.

snapshot_id

Yes

String

Snapshot ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

targetCluster

Yes

String

ID of the cluster that a snapshot is to be restored to.

indices

No

String

Name of an index to be restored. Multiple indexes are separated by commas (,). By default, all indexes are restored. You can use the combination of a backslash and an asterisk (*) to back up data of certain indexes. For example, if you specify 2018-06*, then the data of the indexes with the prefix 2018-06 will be restored.The value can contain 0 to 1,024 characters. Uppercase letters, spaces, and the following special characters are not allowed: "\<|>/?

renamePattern

No

String

Rule for defining the indexes to be restored. The value contains a maximum of 1,024 characters. Indexes that match this rule will be restored. The filtering condition must be a regular expression.

The value can contain 0 to 1,024 characters. Uppercase letters, spaces, and the following special characters are not allowed: "\<|>/?

This parameter takes effect only when both renameReplacement and renamePattern are set.

renameReplacement

No

String

Rule for renaming an index. 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.The renamePattern and renameReplacement parameters must be set at the same time in order for them to take effect.

replace_exist_indices

No

Boolean

Replacing an existing index.

Response Parameters

None

Example Requests

Restore a snapshot.

POST /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters/4f3deec3-efa8-4598-bf91-560aad1377a3/index_snapshot/653c086f-ebe7-4383-b902-c031b354f1dd/restore

{
  "targetCluster" : "ea244205-d641-45d9-9dcb-ab2236bcd07e",
  "indices" : "myindex1,myindex2",
  "renamePattern" : "index",
  "renameReplacement" : "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.