All Products
Search
Document Center

Elasticsearch:AddSnapshotRepo

Last Updated:Jul 08, 2024

Creates a shared OSS repository for a cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation does not have operation-specific request headers and uses only common request headers. For more information, refer to the documentation of common request parameters.

Request syntax

POST /openapi/instances/{InstanceId}/snapshot-repos HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

InstanceId String Path Yes es-cn-n6w1o1x0w001c****

The ID of the destination instance. You need to set the instance ID of the cross-cluster OSS repository.

String Body No { "repoPath" :"es-cn-4591jumei000u****" }

Specifies the cross-cluster backup information, that is, the specified reference instance.

RequestBody

You must also specify the following parameters in the RequestBody parameter to specify the cross-cluster backup information, that is, the reference instance.

Header

Type

Required

Example

Description

repoPath

String

Yes

es-cn-4591jumei000u****

The source instance whose data is to be restored. Obtain parameter information. For more information, see ListAlternativeSnapshotRepos. After the snapshot is specified, the Elasticsearch creates a snapshot reference repository for the source instance. You can restore data from the snapshot repository.

The instance and the destination instance must meet the following requirements:

The instance is in the same region and belongs to the same account. The version of the source instance is lower than or equal to the version of the destination instance. For more information, see Configure a cross-cluster OSS repository.

The following sample code provides an example.

{
    "repoPath" :"es-cn-4591jumei000u****"
}

Response parameters

Parameter

Type

Example

Description

Result Boolean true

Returned result:

  • true: The reference repository is created.
  • false: The reference repository fails to be created.
RequestId String 5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1****

The ID of the request.

Examples

Sample requests

POST /openapi/instances/es-cn-n6w1o1x0w001c****/snapshot-repos HTTP/1.1
{
    "repoPath" :"es-cn-4591jumei000u****"
}

Sample success responses

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Result" : true,
  "RequestId" : "D21379E3-A54E-4C86-A64C-3717365F****"
}

Error codes

HttpCode

Error code

Error message

Error message

400 InstanceActivating Instance is activating. The instance is currently in effect.
400 InstanceNotFound The instanceId provided does not exist. The error message returned because the instance cannot be found. Check the instance status.

For a list of error codes, see Service error codes.