Updated on 2025-11-28 GMT+08:00

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

Table 1 Path Parameters

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

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

target_cluster

Yes

String

Definition:

ID of the destination cluster to which the snapshot is restored.

Constraints:

  • If the current cluster is available, snapshots are restored to the current cluster by default. Alternatively, you can choose to restore them to another specified cluster.

  • The destination cluster must be in the same region as the current cluster, and must have a later version than the current cluster.

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: "<|>/?.

  • When restoring an index whose name is prefixed with .kibana, the index name must be specified.

  • The .opendistro_security index cannot be restored.

Value range:

  • You can use an asterisk () to match multiple indexes. For example, index indicates that all indexes with the prefix index will be restored. When an asterisk (*) is used for index matching, the .opendistro_security index and any system indexes whose name is prefixed with .kibana are filtered out by default.

  • You can restore indexes by specifying their names, for example, index1,index2,index3.

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:

  • Indexes that match this rule will be restored. The filtering condition must be a regular expression.

  • 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: "\<|>/?

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:

  • false: Do not replace existing indexes.

  • true: Replace existing indexes.

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.