Manually Creating a Snapshot
Function
CSS allows you to use snapshots to back up and restore Elasticsearch cluster data. By storing a snapshot in an OBS bucket, you save a point-in-time copy of the cluster's data. By restoring this snapshot, you can restore the cluster to a previous state. There are two ways to create snapshots to back up a CSS cluster: automatic and manual.
-
Automatic snapshot creation: Snapshots are created periodically based on a preset time policy, for example, daily or weekly, to ensure continuous data protection. This reduces manual effort and improves backup reliability and efficiency.
-
Manual snapshot creation: You can manually create snapshots when necessary, for example, before performing a mission-critical operation (such as a cluster upgrade), so you can use these snapshots to quickly restore the cluster to a previous state in case anything goes wrong. Manual snapshots provide more flexibility.
This API is used to manually create a snapshot.
Calling Method
For details, see Calling APIs.
URI
POST /v1.0/{project_id}/clusters/{cluster_id}/index_snapshot
|
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: ID of the cluster for which you want to create a snapshot. 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 |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Definition: Snapshot name. Constraints: N/A Value range: Snapshot name. Enter 4 to 64 characters. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
|
description |
No |
String |
Definition: Snapshot description. Constraints: N/A Value range: The value contains 0 to 256 characters and cannot contain !<>=&"' Default value: N/A |
|
indices |
No |
String |
Definition: Name of the index to be backed up.
Constraints: This parameter is valid only when enable is set to true. Value range: The value can contain 0 to 1,024 characters. It cannot contain uppercase letters, spaces, or the following special characters: "<|>/? Default value: The default value is empty, indicating that all indexes will be backed up. |
Response Parameters
Status code: 201
|
Parameter |
Type |
Description |
|---|---|---|
|
backup |
backupRsp object |
Definition: The snapshot information. Value range: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition: Snapshot ID. Value range: N/A |
|
name |
String |
Definition: Snapshot name. Value range: Snapshot name. Enter 4 to 64 characters. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. The value must start with a letter. |
Example Requests
Create a snapshot.
POST https://{Endpoint}/v1.0/{project_id}/clusters/4f3deec3-efa8-4598-bf91-560aad1377a3/index_snapshot
{
"name" : "snapshot_001",
"indices" : "myindex1myindex2"
}
Example Responses
Status code: 201
Resource created.
{
"backup" : {
"id" : "9dc4f5c9-33c0-45c7-9378-ae35ae350682",
"name" : "snapshot_101"
}
}
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. |
|
406 |
The server could not fulfill the request according to the content characteristics of the request. |
|
500 |
The server has received the request but could not understand it. |
|
501 |
The server does not support the function required to fulfill the request. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.