Updated on 2026-09-02 GMT+08:00

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

  • 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

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

Table 2 Request body 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

  • 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.

  • Compared with the current cluster, the target cluster must be in the same region and its version cannot be earlier than that of the current cluster.

Range

N/A

Default Value

N/A

indices

No

String

Definition

Name of the index to be restored.

Constraints

  • Index names prefixed with .kibana must be specified explicitly.

  • The .opendistro_security index cannot be restored.

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 using an asterisk (*) for matching, system indexes prefixed with .opendistro_security or .kibana are filtered out by default.

  • You can specify indexes to restore, for example, index1,index2,index3.

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

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:

  • 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.