• Cloud Search Service

css
  1. Help Center
  2. Cloud Search Service
  3. API Reference
  4. APIs Related to Snapshot Management
  5. Manually Creating a Snapshot

Manually Creating a Snapshot

Function

This API is used to manually create a snapshot.

URI

POST /v1.0/{project_id}/clusters/{cluster_id}/index_snapshot
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

cluster_id

Yes

String

ID of the cluster where index data is to be backed up.

Request

Table 2 describes the request parameters.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

name

Yes

String

Snapshot name. The snapshot name must start with a letter and contains 4 to 64 characters consisting of only lowercase letters, digits, hyphens (-), and underscores (_).

description

No

String

Description of a snapshot. The value contains 0 to 256 characters, and angle brackets (<) and (>) are not allowed.

indices

No

String

Name of the index to be backed up. Multiple index names are separated by commas (,). By default, data of all indices is backed up. You can use the asterisk (*) to back up data of certain indices. For example, if you enter 2018-06*, then data of indices with the name prefix of 2018-06 will be backed up.

The value contains 0 to 1024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?) are not allowed.

Response

Table 3 describes the response parameters.

Table 3 Parameter description

Parameter

Type

Description

backup

Object

Snapshot object.

Table 4 backup field data structure description

Parameter

Type

Description

created

String

Time when a snapshot is created.

datastore

Object

Type of the data search engine.

description

String

Description of the snapshot.

id

String

ID of the snapshot.

clusterId

String

Cluster ID.

clusterName

String

Cluster name.

name

String

Snapshot name.

status

String

Snapshot status.

updated

String

Whether the snapshot status is updated.

backupType

String

Value 0 indicates that automatic snapshot creation is enabled. Value 1 indicates that you need to manually create the snapshot.

backupMethod

String

Snapshot creation mode.

backupExpectedStartTime

String

Time when the snapshot starts to be executed.

backupKeepDay

Integer

Snapshot retention period.

backupPeriod

String

Time when a snapshot is executed every day.

indices

String

Indices that need to be backed up.

totalShards

Integer

Total number of shards of the indices to be backed up.

failedShards

Integer

Number of shards that fail to be backed up.

version

String

Version of the snapshot.

restoreStatus

String

Snapshot restoration status.

startTime

Long

Timestamp when the snapshot starts to be executed.

endTime

Long

Timestamp when the snapshot execution ends.

bucketName

String

Bucket for storing snapshot data.

Table 5 datastore field data structure description

Parameter

Type

Description

type

String

Service type corresponding to the snapshot.

version

String

Service version corresponding to the snapshot.

Examples

Example request

POST /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters/ea244205-d641-45d9-9dcb-ab2236bcd07e/index_snapshot
{
    "name":"snapshot_001",
    "indices":"myindex1,myindex2",
    "description":""
}

Example response

{
    "backup":{
       "created" : "2018-07-31T04:02:47",
       "datastore" : {
           "type" : "elasticsearch",
           "version" : "6.2.3"
       },
       "description" : "Index backup",
       "id" : "9dc4f5c9-33c0-45c7-9378-ae35ae350682",
       "clusterId": "e0164652-421b-40ad-8b0b-650c18c83df5",
       "clusterName": "Es-xfx",
       "name": "snapshot_101",
       "status": "BUILDING",
       "updated": null,
       "backupType": "1",
       "backupMethod": "manual",
       "backupExpectedStartTime": null,
       "backupKeepDay": 33,
       "backupPeriod": "13:00",
       "indices": "myindex1,myindex2",
       "totalShards": null,
       "failedShards": null,
       "version": null,
       "restoreStatus": "none",
       "startTime": 1533009767542,
       "endTime": 0,
       "bucketName": "obs-es-backup1532662640948"
    }
}

Status Code

Table 6 describes the status code.

Table 6 Status code

Status Code

Code

Status Code Description

201

Created

The request for creating a resource has been fulfilled.

500

InternalServerError

The server is able to receive the request but it could not understand the request.

406

Not Acceptable

The server cannot fulfill the request according to the content characteristics of the request.

501

Not Implemented

The server does not support the requested function.

403

Forbidden

The server understood the request, but is refusing to fulfill it.

The client should not repeat the request without modifications.

400

BadRequest

Invalid request.

The client should not repeat the request without modifications.