Create snapshot

Introduced 1.0

Creates a snapshot within an existing repository.

Path and HTTP methods

  1. PUT /_snapshot/<repository>/<snapshot>
  2. POST /_snapshot/<repository>/<snapshot>

Path parameters

ParameterData typeDescription
repositoryStringRepostory name to contain the snapshot.
snapshotStringName of Snapshot to create.

Query parameters

ParameterData typeDescription
wait_for_completionBooleanWhether to wait for snapshot creation to complete before continuing. If you include this parameter, the snapshot definition is returned after completion.

Request fields

The request body is optional.

FieldData typeDescription
indicesStringThe indices you want to include in the snapshot. You can use , to create a list of indices, * to specify an index pattern, and - to exclude certain indices. Don’t put spaces between items. Default is all indices.
ignore_unavailableBooleanIf an index from the indices list doesn’t exist, whether to ignore it rather than fail the snapshot. Default is false.
include_global_stateBooleanWhether to include cluster state in the snapshot. Default is true.
partialBooleanWhether to allow partial snapshots. Default is false, which fails the entire snapshot if one or more shards fails to stor

Example requests

Request without a body

The following request creates a snapshot called my-first-snapshot in an S3 repository called my-s3-repository. A request body is not included because it is optional.

  1. POST _snapshot/my-s3-repository/my-first-snapshot

copy

Request with a body

You can also add a request body to include or exclude certain indices or specify other settings:

  1. PUT _snapshot/my-s3-repository/2
  2. {
  3. "indices": "opensearch-dashboards*,my-index*,-my-index-2016",
  4. "ignore_unavailable": true,
  5. "include_global_state": false,
  6. "partial": false
  7. }

copy

Example responses

Upon success, the response content depends on whether you include the wait_for_completion query parameter.

wait_for_completion not included
  1. {
  2. "accepted": true
  3. }

To verify that the snapshot was created, use the Get snapshot API, passing the snapshot name as the snapshot path parameter.

wait_for_completion included

The snapshot definition is returned.

  1. {
  2. "snapshot" : {
  3. "snapshot" : "5",
  4. "uuid" : "ZRH4Zv7cSnuYev2JpLMJGw",
  5. "version_id" : 136217927,
  6. "version" : "2.0.1",
  7. "indices" : [
  8. ".opendistro-reports-instances",
  9. ".opensearch-observability",
  10. ".kibana_1",
  11. "opensearch_dashboards_sample_data_flights",
  12. ".opensearch-notifications-config",
  13. ".opendistro-reports-definitions",
  14. "shakespeare"
  15. ],
  16. "data_streams" : [ ],
  17. "include_global_state" : true,
  18. "state" : "SUCCESS",
  19. "start_time" : "2022-08-10T16:52:15.277Z",
  20. "start_time_in_millis" : 1660150335277,
  21. "end_time" : "2022-08-10T16:52:18.699Z",
  22. "end_time_in_millis" : 1660150338699,
  23. "duration_in_millis" : 3422,
  24. "failures" : [ ],
  25. "shards" : {
  26. "total" : 7,
  27. "failed" : 0,
  28. "successful" : 7
  29. }
  30. }
  31. }

Response fields

FieldData typeDescription
snapshotstringSnapshot name.
uuidstringSnapshot’s universally unique identifier (UUID).
version_idintBuild ID of the Open Search version that created the snapshot.
versionfloatOpen Search version that created the snapshot.
indicesarrayIndices in the snapshot.
data_streamsarrayData streams in the snapshot.
include_global_statebooleanWhether the current cluster state is included in the snapshot.
start_timestringDate/time when the snapshot creation process began.
start_time_in_millislongTime (in milliseconds) when the snapshot creation process began.
end_timestringDate/time when the snapshot creation process ended.
end_time_in_millislongTime (in milliseconds) when the snapshot creation process ended.
duration_in_millislongTotal time (in milliseconds) that the snapshot creation process lasted.
failuresarrayFailures, if any, that occured during snapshot creation.
shardsobjectTotal number of shards created along with number of successful and failed shards.
statestringSnapshot status. Possible values: IN_PROGRESS, SUCCESS, FAILED, PARTIAL.
remote_store_index_shallow_copyBooleanWhether the snapshot of the remote store indexes is captured as a shallow copy. Default is false.