Help Center> Cloud Search Service> API Reference> Snapshot Management> Enabling Automatic Snapshot Creation
Updated on 2023-04-27 GMT+08:00

Enabling Automatic Snapshot Creation

Function

This API is used to enable the automatic snapshot creation function.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v2.0/{project_id}/clusters/{cluster_id}/snapshots/policy/open

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 that the snapshot belongs to.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

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 \ * to match multiple 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: "\<|>/?The default value is *, indicating that all indexes are restored.

keepday

Yes

Integer

Number of days that a snapshot is retained. The value range is 1 to 90. Expired snapshots will be automatically deleted on the half hour.

period

Yes

String

Time when a snapshot is created every day. Snapshots can only be created on the hour. The time format is the time followed by the time zone, specifically, HH:mm z. In the format, HH:mm refers to the hour time and z refers to the time zone. For example, 00:00 GMT+08:00 and 01:00 GMT+08:00.

prefix

Yes

String

Prefix of a snapshot that is automatically created, which is manually entered. Enter up to 32 characters and start with a lowercase letter. Lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

Response Parameters

None

Example Requests

POST /v2.0/6204a5bd270343b5885144cf9c8c158d/clusters/ea244205-d641-45d9-9dcb-ab2236bcd07e/snapshots/policy/open

{
  "indices" : "*",
  "keepday" : 7,
  "period" : "16:00 GMT+08:00",
  "prefix" : "snapshot"
}

Example Responses

None

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request.

Modify the request before retry.

403

Request rejected.The server has received and understood the request, but refused to respond to it. The client should modify the request before retry.

Error Codes

See Error Codes.