Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Adding get snapshot API docs #59098

Merged
149 changes: 149 additions & 0 deletions docs/reference/snapshot-restore/apis/get-snapshot-api.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
[[get-snapshot-api]]
=== Get snapshot API
++++
<titleabbrev>Get snapshot</titleabbrev>
++++

Returns information about one or more snapshots from one or more registered repositories.
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved

////
[source,console]
----
PUT /_snapshot/my_repository
{
"type": "fs",
"settings": {
"location": "my_backup_location"
}
}

PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true

PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true
----
// TESTSETUP
////

[source,console]
----
GET /_snapshot/my_repository/my_snapshot
----

[[get-snapshot-api-request]]
==== {api-request-title}

`GET /_snapshot/<repository>/<snapshot>`

[[get-snapshot-api-desc]]
==== {api-description-title}

Use the get snapshot API to return information about one or more snapshots, including start and end time, version of {es} that created the snapshot, the list of included indices, the current state of the snapshot, and the list of failures that occurred during the snapshot.
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved

[[get-snapshot-api-path-params]]
==== {api-path-parms-title}

`<repository>`::
(Required, string)
Comma-separated list of snapshot repository names used to limit the request.
Wildcard (`*`) expressions are supported.
+
To get information about all snapshot repositories registered in the
cluster, omit this parameter or use `*` or `_all`.

`<snapshot>`::
(Required, string)
Comma-separated list of snapshot names to return. Also accepts wildcards (`*`).
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved
+
* To get information about all snapshots in a registered repository, use a wildcard (`*`) or `_all`.
* To get information about any snapshots that are currently running, omit this parameter and use `_current`.
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved
+
NOTE: Using `_all` in a request fails if any snapshots are unavailable. Set <<get-snapshot-api-ignore-unavailable,`ignore_unavailable`>> to `true` to return only available snapshots.
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved

[role="child-attributes"]
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved
[[get-snapshot-api-request-body]]
==== {api-request-body-title}

[[get-snapshot-api-ignore-unavailable]]
`ignore_unavailable`::
(Optional, boolean)
If `false`, the request returns an error for any snapshots that are unavailable. Defaults to `false`.
+
If `true`, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned.

`verbose`::
(Optional, boolean)
If `true`, returns all available information about a snapshot. Defaults to `true`.
+
If `false`, omits additional information about the snapshot, such as version information, start and end times, and the number of snapshotted shards.

[[get-snapshot-api-example]]
==== {api-examples-title}

The following request returns information for `snapshot_2` in the `my_repository` repository.

[source,console]
----
GET /_snapshot/my_repository/snapshot_2
----

The API returns the following response:

[source,console-result]
----
{
"snapshot": {
"snapshot": "snapshot_2",
"uuid": "vdRctLCxSketdKb54xw67g",
"version_id": <version_id>,
"version": <version>,
"indices": [],
"data_streams": [],
"include_global_state": false,
"metadata": {
"taken_by": "user123",
"taken_because": "backup before upgrading"
},
"state": "SUCCESS",
"start_time": "2020-06-25T14:00:28.850Z",
"start_time_in_millis": 1593093628850,
"end_time": "2020-06-25T14:00:28.850Z",
"end_time_in_millis": 1593094752018,
"duration_in_millis": 0,
"failures": [],
"shards": {
"total": 0,
"failed": 0,
"successful": 0
}
}
}
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved
----
// TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshot.uuid/]
// TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshot.version_id/]
// TESTRESPONSE[s/"version": <version>/"version": $body.snapshot.version/]
// TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshot.start_time/]
// TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshot.start_time_in_millis/]
// TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshot.end_time/]
// TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshot.end_time_in_millis/]
// TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshot.duration_in_millis/]
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved

The snapshot `state` can be one of the following values:

[horizontal]
`IN_PROGRESS`::
The snapshot is currently running.

`SUCCESS`::
The snapshot finished and all shards were stored successfully.

`FAILED`::
The snapshot finished with an error and failed to store any data.

`PARTIAL`::
The global cluster state was stored, but data of at least one shard was not stored successfully.
The `failures` section of the response contains more detailed information about shards
that were not processed correctly.

`INCOMPATIBLE`::
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved
The snapshot was created with an old version of {es} and is incompatible with
the current version of the cluster.
lockewritesdocs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ content may not be included yet.
[[snapshot-management-apis]]
=== Snapshot management APIs
* <<create-snapshot-api,Create snapshot>>
* <<get-snapshot-api,Get snapshot>>
* <<delete-snapshot-api,Delete snapshot>>

include::put-repo-api.asciidoc[]
Expand All @@ -33,4 +34,5 @@ include::get-repo-api.asciidoc[]
include::delete-repo-api.asciidoc[]
include::clean-up-repo-api.asciidoc[]
include::create-snapshot-api.asciidoc[]
include::get-snapshot-api.asciidoc[]
include::delete-snapshot-api.asciidoc[]
14 changes: 4 additions & 10 deletions docs/reference/snapshot-restore/take-snapshot.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,24 @@ snapshot and the list of failures that occurred during the snapshot. The snapsho

[horizontal]
`IN_PROGRESS`::

The snapshot is currently running.

`SUCCESS`::

The snapshot finished and all shards were stored successfully.

`FAILED`::

The snapshot finished with an error and failed to store any data.

`PARTIAL`::

The global cluster state was stored, but data of at least one shard wasn't stored successfully.
The `failure` section in this case should contain more detailed information about shards
The global cluster state was stored, but data of at least one shard was not stored successfully.
The `failures` section of the response contains more detailed information about shards
that were not processed correctly.

`INCOMPATIBLE`::

The snapshot was created with an old version of Elasticsearch and therefore is incompatible with
The snapshot was created with an old version of {es} and is incompatible with
the current version of the cluster.


Similar as for repositories, information about multiple snapshots can be queried in one go, supporting wildcards as well:
Similar as for repositories, information about multiple snapshots can be queried in a single request, supporting wildcards as well:

[source,console]
-----------------------------------
Expand Down