Skip to main content

OpenSearch Backup and Restore

Configure OpenSearch to take snapshots to any S3 or S3-compatible object storage (AWS S3, OCI Object Storage, MinIO) and restore them later. Every step here runs from OpenSearch Dashboards → Dev Tools, no shell access to the cluster nodes required.

Reference: this guide complements the official OpenSearch documentation on Snapshots. Refer to it for advanced options not covered here.

Prerequisites

  • A bucket on your S3 or S3-compatible provider.
  • An Access Key ID and Secret Access Key with read/write/delete on that bucket.
  • A cluster admin in OpenSearch Dashboards with access to Dev Tools and snapshot privileges.
  • OpenSearch with the repository-s3 plugin installed (default in the standard distribution).

For provider-specific instructions on creating the bucket and credentials, follow your provider's documentation:

The IAM user (or equivalent) only needs object-level permissions on the bucket: list, get, put, delete, and multipart upload management.

Step 1: Register the snapshot repository

Use one of the two variants below.

Native AWS S3

PUT _snapshot/snapshot_repo
{
"type": "s3",
"settings": {
"bucket": "<BUCKET>",
"base_path": "snapshots",
"region": "<REGION>",
"access_key": "<ACCESS_KEY>",
"secret_key": "<SECRET_KEY>",
"compress": true,
"server_side_encryption": true,
"chunk_size": "1gb",
"max_retries": 3
}
}

S3-compatible (OCI, MinIO, etc.)

PUT _snapshot/snapshot_repo?verify=false
{
"type": "s3",
"settings": {
"bucket": "<BUCKET>",
"base_path": "snapshots",
"endpoint": "<S3_COMPATIBLE_ENDPOINT>",
"protocol": "https",
"path_style_access": true,
"disable_chunked_encoding": true,
"access_key": "<ACCESS_KEY>",
"secret_key": "<SECRET_KEY>",
"region": "<REGION>",
"compress": true,
"chunk_size": "100mb",
"max_retries": 3
}
}

Why the extra fields for S3-compatible providers:

  • endpoint: the provider's S3-compatible URL (for OCI: <namespace>.compat.objectstorage.<region>.oraclecloud.com).
  • path_style_access: true: most S3-compat endpoints don't support the virtual-hosted style.
  • disable_chunked_encoding: true: avoids the chunked-encoding format some endpoints reject.
  • chunk_size: 100mb: keeps each file under a single PUT, sidestepping multipart upload compatibility quirks.
  • ?verify=false on the URL skips the immediate connectivity check (recommended for first registration when you are not sure all fields are correct yet).

Verify the repository once you've registered it:

POST _snapshot/snapshot_repo/_verify

A successful response lists every node that could read and write the bucket.

Step 2: Take a manual snapshot

Follow the Take snapshots section of the official docs, using the repository name registered in Step 1 (snapshot_repo in the examples here).

A snapshot finishes in state SUCCESS. PARTIAL means at least one shard failed; inspect the failures array before relying on it.

Step 3: Schedule recurring snapshots

OpenSearch's Snapshot Management (SM) creates and (optionally) prunes snapshots on a cron schedule. Use the daily-policy example from the official docs as a starting point, adjusting the repository field to match the one you registered in Step 1 (snapshot_repo in the examples here).

S3-compatible note: the batch DeleteObjects call used by the deletion block can fail against some S3-compatible endpoints. If retention fails repeatedly, omit the deletion block and prune old snapshots from the provider's console.

Manage the policy:

GET  _plugins/_sm/policies/daily_backup
POST _plugins/_sm/policies/daily_backup/_start
POST _plugins/_sm/policies/daily_backup/_stop
GET _plugins/_sm/policies/daily_backup/_explain

Restore

For the full restore procedure, see the official OpenSearch documentation: Restore snapshots.

Quick reference:

GET _snapshot/snapshot_repo/_all

POST _snapshot/snapshot_repo/<snapshot_name>/_restore?wait_for_completion=true
{
"indices": "<index_or_pattern>",
"ignore_unavailable": true,
"include_global_state": false
}

If the index you are restoring still exists, restore into a different name using rename_pattern and rename_replacement (see the OpenSearch docs link above).

Monitor progress on long restores:

GET _cat/recovery?v&active_only=true
GET _cluster/health