-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[DOCS] Adding get snapshot status API docs #59355
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
Merged
lockewritesdocs
merged 12 commits into
elastic:master
from
lockewritesdocs:docs__get-snapshot-status-api-docs
Jul 15, 2020
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
09f8a85
Adding get snapshot status API docs.
3884c0d
Adding more fields and a link to the new page.
f633204
Adding missing spaces in TESTRESPONSES
a72f137
Adding more parameters and making some edits.
7f245a5
Marking snapshot as optional
62bdd12
Marking repository as optional
1988ebf
Add data type for stats
7de5b12
Add data type for shard_stats
c26d39b
Incorporating review feedback.
6a50d96
Lots of review feedback incorporated.
39b86a6
Fixing tests to unbreak CI builds.
db21692
Changing indices to index.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
396 changes: 396 additions & 0 deletions
396
docs/reference/snapshot-restore/apis/get-snapshot-status-api.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,396 @@ | ||||
| [[get-snapshot-status-api]] | ||||
| === Get snapshot status API | ||||
| ++++ | ||||
| <titleabbrev>Get snapshot status</titleabbrev> | ||||
| ++++ | ||||
|
|
||||
| Retrieves a detailed description of the current state for each shard participating in the snapshot. | ||||
|
|
||||
| //// | ||||
| [source,console] | ||||
| ---- | ||||
| PUT /index_1 | ||||
|
|
||||
| PUT /index_1/_doc/1 | ||||
| { | ||||
| "title": "Elastic, Vol.1", "category": "Non-Fiction", | ||||
| "author": { | ||||
| "first_name": "Elk", | ||||
| "last_name": "Stack" | ||||
| } | ||||
| } | ||||
|
|
||||
| PUT /index_1/_doc/2 | ||||
| { | ||||
| "title": "Elastic, Vol.2", "category": "Non-Fiction", | ||||
| "author": { | ||||
| "first_name": "Elk", | ||||
| "last_name": "Stack" | ||||
| } | ||||
| } | ||||
|
|
||||
| PUT /index_1/_doc/3 | ||||
| { | ||||
| "title": "Elastic, Vol.3", "category": "Non-Fiction", | ||||
| "author": { | ||||
| "first_name": "Elk", | ||||
| "last_name": "Stack" | ||||
| } | ||||
| } | ||||
|
|
||||
| PUT /index_1/_doc/4 | ||||
| { | ||||
| "title": "Elastic, Vol.4", "category": "Non-Fiction", | ||||
| "author": { | ||||
| "first_name": "Elk", | ||||
| "last_name": "Stack" | ||||
| } | ||||
| } | ||||
|
|
||||
| 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 | ||||
| { | ||||
| "indices": [], | ||||
| "ignore_unavailable": true, | ||||
| "include_global_state": false, | ||||
| "metadata": { | ||||
| "taken_by": "Elastic Machine", | ||||
| "taken_because": "backup testing" | ||||
| } | ||||
| } | ||||
| ---- | ||||
| // TESTSETUP | ||||
| //// | ||||
|
|
||||
| [source,console] | ||||
| ---- | ||||
| GET /_snapshot/my_repository/my_snapshot/_status | ||||
| ---- | ||||
|
|
||||
| [[get-snapshot-status-api-request]] | ||||
| ==== {api-request-title} | ||||
|
|
||||
| `GET /_snapshot/<repository>/<snapshot>/_status` | ||||
|
|
||||
| [[get-snapshot-status-api-desc]] | ||||
| ==== {api-description-title} | ||||
|
|
||||
| Use the get snapshot status API to retrieve detailed information about snapshots currently running in the cluster. | ||||
|
|
||||
| If you specify both the repository name and snapshot, the request retrieves detailed status information for the given snapshot, even if not currently running. | ||||
|
|
||||
| WARNING: Using this API to return any status results other than the currently running snapshots (`_current`) can be very expensive. Each request to retrieve snapshot status results in file reads from every shard in a snapshot, for each snapshot. | ||||
| + | ||||
| For example, if you have 100 snapshots with 1,000 shards each, the API request will result in 100,000 file reads (100 snapshots * 1,000 shards). Depending on the latency of your file storage, the request can take extremely long to retrieve results. | ||||
|
|
||||
| [[get-snapshot-status-api-path-params]] | ||||
| ==== {api-path-parms-title} | ||||
|
|
||||
| `<repository>`:: | ||||
| (Required, string) | ||||
| Snapshot repository name used to limit the request. Wildcard (`*`) expressions are supported. | ||||
| + | ||||
| Use `_current` after the repository name to limit the request only to the currently running snapshots. This usage is preferred to return only snapshots that are currently running and not degrade response time. | ||||
|
|
||||
| `<snapshot>`:: | ||||
| (Required, string) | ||||
lockewritesdocs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| Comma-separated list of snapshot names to retrieve status for. | ||||
| + | ||||
| To retrieve a list of all snapshots in a specified repository, omit this parameter. | ||||
| + | ||||
| NOTE: Wildcard (`*`) expressions are not supported for `<snapshot>`. | ||||
|
|
||||
| [role="child_attributes"] | ||||
| [[get-snapshot-status-api-request-body]] | ||||
| ==== {api-request-body-title} | ||||
|
|
||||
| `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. | ||||
|
|
||||
| [role="child_attributes"] | ||||
| [[get-snapshot-status-api-response-body]] | ||||
| ==== {api-response-body-title} | ||||
| `repository`:: | ||||
| (string) | ||||
| Name of the repository that includes the snapshot. | ||||
|
|
||||
| `snapshot`:: | ||||
| (string) | ||||
| Name of the snapshot. | ||||
|
|
||||
lockewritesdocs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| `uuid`:: | ||||
| (string) | ||||
| Universally unique identifier (UUID) of the snapshot. | ||||
|
|
||||
| `state`:: | ||||
| + | ||||
| -- | ||||
| (string) | ||||
| Indicates the current snapshot state. | ||||
|
|
||||
| .Values for `state` | ||||
| [%collapsible%open] | ||||
| ==== | ||||
| `FAILED`:: | ||||
| The snapshot finished with an error and failed to store any data. | ||||
|
|
||||
| `IN_PROGRESS`:: | ||||
| The snapshot is currently running. | ||||
|
|
||||
| `PARTIAL`:: | ||||
| The global cluster state was stored, but data of at least one shard was not stored successfully. | ||||
| The <<get-snapshot-api-response-failures,`failures`>> section of the response contains more detailed information about shards | ||||
| that were not processed correctly. | ||||
|
|
||||
| `SUCCESS`:: | ||||
| The snapshot finished and all shards were stored successfully. | ||||
| ==== | ||||
| -- | ||||
|
|
||||
| `include_global_state`:: | ||||
| (boolean) | ||||
| Indicates whether the current cluster state is included in the snapshot. | ||||
|
|
||||
| [[get-snapshot-status-shards-stats]] | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like a copy/paste error.
Suggested change
|
||||
| `shards_stats`:: | ||||
| (object) | ||||
| Contains a count of shards in the snapshot. | ||||
| + | ||||
| .Properties of `shards_stats` | ||||
| [%collapsible%open] | ||||
| ==== | ||||
| `initializing`:: | ||||
| (integer) | ||||
| Number of shards that are still initializing. | ||||
|
|
||||
| `started`:: | ||||
| (integer) | ||||
| Number of shards that have started but not are not finalized. | ||||
|
|
||||
| `finalizing`:: | ||||
| (integer) | ||||
| Number of shards that are finalizing but are not done. | ||||
|
|
||||
| `done`:: | ||||
| (integer) | ||||
| Number of shards that initialized, started, and finalized successfully. | ||||
|
|
||||
| `failed`:: | ||||
| (integer) | ||||
| Number of shards that failed to be included in the snapshot. | ||||
|
|
||||
| `total`:: | ||||
| (integer) | ||||
| Total number of shards included in the snapshot. | ||||
| ==== | ||||
|
|
||||
| [[get-snapshot-status-stats]] | ||||
| `stats`:: | ||||
| (object) | ||||
| Provides details on the number (`file_count`) and size (`size_in_bytes`) of files included in the snapshot. | ||||
| + | ||||
| .Properties of `stats` | ||||
| [%collapsible%open] | ||||
| ==== | ||||
| `incremental`:: | ||||
| (object) | ||||
| Number and size of files that still need to be copied as part of the incremental snapshot. | ||||
| + | ||||
| For completed snapshots, this property indicates the number and size | ||||
| of files that were not already in the repository and were copied as | ||||
| part of the incremental snapshot. | ||||
|
|
||||
| `processed`:: | ||||
| (object) | ||||
| Number and size of files that have already been uploaded to the snapshot. After a file is uploaded, the processed `file_count` and `size_in_bytes` are incremented in `stats`. | ||||
|
|
||||
| `total`:: | ||||
| (object) | ||||
| Total number and size of files that are referenced by the snapshot. | ||||
|
Comment on lines
+219
to
+221
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same about documenting the nested properties. |
||||
|
|
||||
| [[get-snapshot-status-start-time]] | ||||
| `start_time_in_millis`:: | ||||
| (long) | ||||
| The time, in milliseconds, when the snapshot creation process started. | ||||
|
|
||||
| [[get-snapshot-status-total-time]] | ||||
| `time_in_millis`:: | ||||
| (long) | ||||
| The total time, in milliseconds, that it took for the snapshot process | ||||
| to complete. | ||||
| ==== | ||||
|
|
||||
| `<index>`:: | ||||
| (list of objects) | ||||
| List of objects containing information about the | ||||
| indices included in the snapshot. | ||||
| + | ||||
| .Properties of `<index>` | ||||
| [%collapsible%open] | ||||
| ==== | ||||
| `shards_stats`:: | ||||
| (object) | ||||
| See <<get-snapshot-status-shards-stats,`shards_stats`>>. | ||||
|
|
||||
| `stats`:: | ||||
lockewritesdocs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| (object) | ||||
| See <<get-snapshot-status-stats,`stats`>>. | ||||
|
|
||||
| `shards`:: | ||||
| (list of objects) | ||||
| List of objects containing information about the | ||||
| shards that include the snapshot. | ||||
| + | ||||
| .Properties of `shards` | ||||
| [%collapsible%open] | ||||
| ===== | ||||
| `stage`:: | ||||
| (string) | ||||
| Indicates the current state of the shards that include the snapshot. | ||||
| + | ||||
| .Properties of `stage` | ||||
| [%collapsible%open] | ||||
| ====== | ||||
| `DONE`:: | ||||
| Number of shards in the snapshot that were successfully stored in the repository. | ||||
|
|
||||
| `FAILURE`:: | ||||
| Number of shards in the snapshot that were not successfully stored in | ||||
| the repository. | ||||
|
|
||||
| `FINALIZE`:: | ||||
| Number of shards in the snapshot that are in the finalizing stage | ||||
| of being stored in the repository. | ||||
|
|
||||
| `INIT`:: | ||||
| Number of shards in the snapshot that are in the initializing stage | ||||
| of being stored in the repository. | ||||
|
|
||||
| `STARTED`:: | ||||
| Number of shards in the snapshot that are in the started stage | ||||
| of being stored in the repository. | ||||
| ====== | ||||
| `stats`:: | ||||
| (object) | ||||
| See <<get-snapshot-status-stats,`stats`>>. | ||||
|
|
||||
| `total`:: | ||||
| (object) | ||||
| Total number and size of files that are referenced by the snapshot. | ||||
|
|
||||
| `start_time_in_millis`:: | ||||
| (long) | ||||
| See <<get-snapshot-status-start-time,`start_time_in_millis`>>. | ||||
|
|
||||
| `time_in_millis`:: | ||||
| (long) | ||||
| See <<get-snapshot-status-total-time,`time_in_millis`>>. | ||||
| ===== | ||||
lockewritesdocs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| ==== | ||||
|
|
||||
| [[get-snapshot-status-api-example]] | ||||
| ==== {api-example-title} | ||||
|
|
||||
| The following request returns detailed status information for `snapshot_2` in the `my_repository` repository. This response includes additional information beyond the <<get-snapshot-api,Get snapshot API>>, such as shard status and file statistics. | ||||
|
|
||||
| [source,console] | ||||
| ---- | ||||
| GET /_snapshot/my_repository/snapshot_2/_status | ||||
| ---- | ||||
|
|
||||
| [source,console-result] | ||||
| ---- | ||||
| { | ||||
| "snapshots" : [ | ||||
| { | ||||
| "snapshot" : "snapshot_2", | ||||
| "repository" : "my_repository", | ||||
| "uuid" : "lNeQD1SvTQCqqJUMQSwmGg", | ||||
| "state" : "SUCCESS", | ||||
| "include_global_state" : false, | ||||
| "shards_stats" : { | ||||
| "initializing" : 0, | ||||
| "started" : 0, | ||||
| "finalizing" : 0, | ||||
| "done" : 1, | ||||
| "failed" : 0, | ||||
| "total" : 1 | ||||
| }, | ||||
| "stats" : { | ||||
| "incremental" : { | ||||
| "file_count" : 3, | ||||
| "size_in_bytes" : 5969 | ||||
| }, | ||||
| "total" : { | ||||
| "file_count" : 4, | ||||
| "size_in_bytes" : 6024 | ||||
| }, | ||||
| "start_time_in_millis" : 1594829326691, | ||||
| "time_in_millis" : 205 | ||||
| }, | ||||
| "indices" : { | ||||
| "index_1" : { | ||||
| "shards_stats" : { | ||||
| "initializing" : 0, | ||||
| "started" : 0, | ||||
| "finalizing" : 0, | ||||
| "done" : 1, | ||||
| "failed" : 0, | ||||
| "total" : 1 | ||||
| }, | ||||
| "stats" : { | ||||
| "incremental" : { | ||||
| "file_count" : 3, | ||||
| "size_in_bytes" : 5969 | ||||
| }, | ||||
| "total" : { | ||||
| "file_count" : 4, | ||||
| "size_in_bytes" : 6024 | ||||
| }, | ||||
| "start_time_in_millis" : 1594829326896, | ||||
| "time_in_millis" : 0 | ||||
| }, | ||||
| "shards" : { | ||||
| "0" : { | ||||
| "stage" : "DONE", | ||||
| "stats" : { | ||||
| "incremental" : { | ||||
| "file_count" : 3, | ||||
| "size_in_bytes" : 5969 | ||||
| }, | ||||
| "total" : { | ||||
| "file_count" : 4, | ||||
| "size_in_bytes" : 6024 | ||||
| }, | ||||
| "start_time_in_millis" : 1594829326896, | ||||
| "time_in_millis" : 0 | ||||
| } | ||||
| } | ||||
| } | ||||
| } | ||||
| } | ||||
| } | ||||
| ] | ||||
| } | ||||
| ---- | ||||
| // TESTRESPONSE[s/"uuid" : "lNeQD1SvTQCqqJUMQSwmGg"/"uuid" : $body.snapshots.0.uuid/] | ||||
| // TESTRESPONSE[s/"size_in_bytes" : 6024/"size_in_bytes" : $body.snapshots.0.stats.total.size_in_bytes/] | ||||
| // TESTRESPONSE[s/"done" : 10/"done" : $body.snapshots.0.shards_stats.done/] | ||||
| // TESTRESPONSE[s/"total" : 10/"total" : $body.snapshots.0.shards_stats.total/] | ||||
| // TESTRESPONSE[s/"start_time_in_millis" : 1594829326691/"start_time_in_millis" : $body.snapshots.0.stats.start_time_in_millis/] | ||||
| // TESTRESPONSE[s/"time_in_millis" : 205/"time_in_millis" : $body.snapshots.0.stats.time_in_millis/] | ||||
| // TESTRESPONSE[s/"file_count" : 3/"file_count" : $body.snapshots.0.stats.incremental.file_count/] | ||||
| // TESTRESPONSE[s/"size_in_bytes" : 5969/"size_in_bytes" : $body.snapshots.0.stats.incremental.size_in_bytes/] | ||||
| // TESTRESPONSE[s/"start_time_in_millis" : 1594829326896/"start_time_in_millis" : $body.snapshots.0.indices.index_1.stats.start_time_in_millis/] | ||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.