Skip to main content

Back up and restore data using S3 snapshots

Advanced Managed Search provides a custom API that lets you use KakaoCloud Object Storage as long-term storage for OpenSearch. You can create snapshots of indexes to store data securely and restore the data to a specific point when needed.

caution

Buckets used as snapshot repositories support only the STANDARD storage class. The COOL storage class is not supported. Do not apply the COOL storage class to the bucket or objects in the bucket.

1. Register a snapshot repository

First, configure the repository where snapshots will be stored. Register the repository by entering your KakaoCloud Object Storage information.

Request
PUT _snapshot/my_s3_repository
{
"type": "s3",
"settings": {
"endpoint": "https://objectstorage.kr-central-2.kakaocloud.com",
"path_style_access": true,
"bucket": "test-s3",
"region": "kr-central-2",
"access_key": "YOUR_ACCESS_KEY",
"secret_key": "YOUR_SECRET_KEY",
"base_path": "snapshots"
}
}
  • endpoint: Object Storage endpoint
  • base_path: Path to the subdirectory in the bucket where snapshots are stored
info

For instructions on issuing the S3 access key ID and secret access key required to call the Object Storage API, see Issue an S3 access key.

2. Create a snapshot (backup)

Create a snapshot of specific indexes or all data.

Request
POST _snapshot/my_s3_repository/my-first-snapshot
{
"indices": "test-index*",
"ignore_unavailable": true,
"include_global_state": false,
"partial": false
}
  • indices: Pattern for the indexes to back up (for example, test-index*)
  • partial: If set to false, snapshot creation stops when any shard fails, helping ensure data integrity

3. Check snapshot status

Check information about a snapshot and its current status, such as SUCCESS or IN_PROGRESS.

Request
GET /_snapshot/my_s3_repository/my-first-snapshot

Key response fields

FieldDescription
stateSnapshot result. A value of SUCCESS indicates completion.
indicesList of indexes included in the snapshot
duration_in_millisTime taken to create the snapshot

4. Restore a snapshot

Restore data from a stored snapshot. To prevent conflicts with existing indexes, we recommend restoring the indexes under different names.

Request
POST /_snapshot/my_s3_repository/my-first-snapshot/_restore
{
"indices": "test-index*",
"ignore_unavailable": true,
"include_global_state": false,
"rename_pattern": "(.+)",
"rename_replacement": "$1_restored",
"include_aliases": false
}
  • rename_pattern / rename_replacement: Appends _restored to each restored index name to distinguish it from existing data

5. Verify the restore result

Verify that the restored index was created successfully and that its status is open.

Request
GET /_cat/indices/test-index2_restored
  • Example response: yellow open test-index2_restored KlLBNIBcReazgKnutWZbXw 1 1 0 0 208b 208b