Skip to content

Commit 556f19d

Browse files
author
Adam Locke
authored
[DOCS] Adding get snapshot status API docs (#59355)
* Adding get snapshot status API docs. * Adding more fields and a link to the new page. * Adding missing spaces in TESTRESPONSES * Adding more parameters and making some edits. * Marking snapshot as optional * Marking repository as optional * Add data type for stats * Add data type for shard_stats * Incorporating review feedback. * Lots of review feedback incorporated. * Fixing tests to unbreak CI builds. * Changing indices to index.
1 parent d6fa427 commit 556f19d

File tree

2 files changed

+398
-0
lines changed

2 files changed

+398
-0
lines changed
Lines changed: 396 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,396 @@
1+
[[get-snapshot-status-api]]
2+
=== Get snapshot status API
3+
++++
4+
<titleabbrev>Get snapshot status</titleabbrev>
5+
++++
6+
7+
Retrieves a detailed description of the current state for each shard participating in the snapshot.
8+
9+
////
10+
[source,console]
11+
----
12+
PUT /index_1
13+
14+
PUT /index_1/_doc/1
15+
{
16+
"title": "Elastic, Vol.1", "category": "Non-Fiction",
17+
"author": {
18+
"first_name": "Elk",
19+
"last_name": "Stack"
20+
}
21+
}
22+
23+
PUT /index_1/_doc/2
24+
{
25+
"title": "Elastic, Vol.2", "category": "Non-Fiction",
26+
"author": {
27+
"first_name": "Elk",
28+
"last_name": "Stack"
29+
}
30+
}
31+
32+
PUT /index_1/_doc/3
33+
{
34+
"title": "Elastic, Vol.3", "category": "Non-Fiction",
35+
"author": {
36+
"first_name": "Elk",
37+
"last_name": "Stack"
38+
}
39+
}
40+
41+
PUT /index_1/_doc/4
42+
{
43+
"title": "Elastic, Vol.4", "category": "Non-Fiction",
44+
"author": {
45+
"first_name": "Elk",
46+
"last_name": "Stack"
47+
}
48+
}
49+
50+
PUT /_snapshot/my_repository
51+
{
52+
"type": "fs",
53+
"settings": {
54+
"location": "my_backup_location"
55+
}
56+
}
57+
58+
PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true
59+
60+
PUT _snapshot/my_repository/snapshot_2?wait_for_completion=true
61+
{
62+
"indices": [],
63+
"ignore_unavailable": true,
64+
"include_global_state": false,
65+
"metadata": {
66+
"taken_by": "Elastic Machine",
67+
"taken_because": "backup testing"
68+
}
69+
}
70+
----
71+
// TESTSETUP
72+
////
73+
74+
[source,console]
75+
----
76+
GET /_snapshot/my_repository/my_snapshot/_status
77+
----
78+
79+
[[get-snapshot-status-api-request]]
80+
==== {api-request-title}
81+
82+
`GET /_snapshot/<repository>/<snapshot>/_status`
83+
84+
[[get-snapshot-status-api-desc]]
85+
==== {api-description-title}
86+
87+
Use the get snapshot status API to retrieve detailed information about snapshots currently running in the cluster.
88+
89+
If you specify both the repository name and snapshot, the request retrieves detailed status information for the given snapshot, even if not currently running.
90+
91+
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.
92+
+
93+
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.
94+
95+
[[get-snapshot-status-api-path-params]]
96+
==== {api-path-parms-title}
97+
98+
`<repository>`::
99+
(Required, string)
100+
Snapshot repository name used to limit the request. Wildcard (`*`) expressions are supported.
101+
+
102+
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.
103+
104+
`<snapshot>`::
105+
(Required, string)
106+
Comma-separated list of snapshot names to retrieve status for.
107+
+
108+
To retrieve a list of all snapshots in a specified repository, omit this parameter.
109+
+
110+
NOTE: Wildcard (`*`) expressions are not supported for `<snapshot>`.
111+
112+
[role="child_attributes"]
113+
[[get-snapshot-status-api-request-body]]
114+
==== {api-request-body-title}
115+
116+
`ignore_unavailable`::
117+
(Optional, boolean)
118+
If `false`, the request returns an error for any snapshots that are unavailable. Defaults to `false`.
119+
+
120+
If `true`, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned.
121+
122+
[role="child_attributes"]
123+
[[get-snapshot-status-api-response-body]]
124+
==== {api-response-body-title}
125+
`repository`::
126+
(string)
127+
Name of the repository that includes the snapshot.
128+
129+
`snapshot`::
130+
(string)
131+
Name of the snapshot.
132+
133+
`uuid`::
134+
(string)
135+
Universally unique identifier (UUID) of the snapshot.
136+
137+
`state`::
138+
+
139+
--
140+
(string)
141+
Indicates the current snapshot state.
142+
143+
.Values for `state`
144+
[%collapsible%open]
145+
====
146+
`FAILED`::
147+
The snapshot finished with an error and failed to store any data.
148+
149+
`IN_PROGRESS`::
150+
The snapshot is currently running.
151+
152+
`PARTIAL`::
153+
The global cluster state was stored, but data of at least one shard was not stored successfully.
154+
The <<get-snapshot-api-response-failures,`failures`>> section of the response contains more detailed information about shards
155+
that were not processed correctly.
156+
157+
`SUCCESS`::
158+
The snapshot finished and all shards were stored successfully.
159+
====
160+
--
161+
162+
`include_global_state`::
163+
(boolean)
164+
Indicates whether the current cluster state is included in the snapshot.
165+
166+
[[get-snapshot-status-shards-stats]]
167+
`shards_stats`::
168+
(object)
169+
Contains a count of shards in the snapshot.
170+
+
171+
.Properties of `shards_stats`
172+
[%collapsible%open]
173+
====
174+
`initializing`::
175+
(integer)
176+
Number of shards that are still initializing.
177+
178+
`started`::
179+
(integer)
180+
Number of shards that have started but not are not finalized.
181+
182+
`finalizing`::
183+
(integer)
184+
Number of shards that are finalizing but are not done.
185+
186+
`done`::
187+
(integer)
188+
Number of shards that initialized, started, and finalized successfully.
189+
190+
`failed`::
191+
(integer)
192+
Number of shards that failed to be included in the snapshot.
193+
194+
`total`::
195+
(integer)
196+
Total number of shards included in the snapshot.
197+
====
198+
199+
[[get-snapshot-status-stats]]
200+
`stats`::
201+
(object)
202+
Provides details on the number (`file_count`) and size (`size_in_bytes`) of files included in the snapshot.
203+
+
204+
.Properties of `stats`
205+
[%collapsible%open]
206+
====
207+
`incremental`::
208+
(object)
209+
Number and size of files that still need to be copied as part of the incremental snapshot.
210+
+
211+
For completed snapshots, this property indicates the number and size
212+
of files that were not already in the repository and were copied as
213+
part of the incremental snapshot.
214+
215+
`processed`::
216+
(object)
217+
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`.
218+
219+
`total`::
220+
(object)
221+
Total number and size of files that are referenced by the snapshot.
222+
223+
[[get-snapshot-status-start-time]]
224+
`start_time_in_millis`::
225+
(long)
226+
The time, in milliseconds, when the snapshot creation process started.
227+
228+
[[get-snapshot-status-total-time]]
229+
`time_in_millis`::
230+
(long)
231+
The total time, in milliseconds, that it took for the snapshot process
232+
to complete.
233+
====
234+
235+
`<index>`::
236+
(list of objects)
237+
List of objects containing information about the
238+
indices included in the snapshot.
239+
+
240+
.Properties of `<index>`
241+
[%collapsible%open]
242+
====
243+
`shards_stats`::
244+
(object)
245+
See <<get-snapshot-status-shards-stats,`shards_stats`>>.
246+
247+
`stats`::
248+
(object)
249+
See <<get-snapshot-status-stats,`stats`>>.
250+
251+
`shards`::
252+
(list of objects)
253+
List of objects containing information about the
254+
shards that include the snapshot.
255+
+
256+
.Properties of `shards`
257+
[%collapsible%open]
258+
=====
259+
`stage`::
260+
(string)
261+
Indicates the current state of the shards that include the snapshot.
262+
+
263+
.Properties of `stage`
264+
[%collapsible%open]
265+
======
266+
`DONE`::
267+
Number of shards in the snapshot that were successfully stored in the repository.
268+
269+
`FAILURE`::
270+
Number of shards in the snapshot that were not successfully stored in
271+
the repository.
272+
273+
`FINALIZE`::
274+
Number of shards in the snapshot that are in the finalizing stage
275+
of being stored in the repository.
276+
277+
`INIT`::
278+
Number of shards in the snapshot that are in the initializing stage
279+
of being stored in the repository.
280+
281+
`STARTED`::
282+
Number of shards in the snapshot that are in the started stage
283+
of being stored in the repository.
284+
======
285+
`stats`::
286+
(object)
287+
See <<get-snapshot-status-stats,`stats`>>.
288+
289+
`total`::
290+
(object)
291+
Total number and size of files that are referenced by the snapshot.
292+
293+
`start_time_in_millis`::
294+
(long)
295+
See <<get-snapshot-status-start-time,`start_time_in_millis`>>.
296+
297+
`time_in_millis`::
298+
(long)
299+
See <<get-snapshot-status-total-time,`time_in_millis`>>.
300+
=====
301+
====
302+
303+
[[get-snapshot-status-api-example]]
304+
==== {api-example-title}
305+
306+
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.
307+
308+
[source,console]
309+
----
310+
GET /_snapshot/my_repository/snapshot_2/_status
311+
----
312+
313+
[source,console-result]
314+
----
315+
{
316+
"snapshots" : [
317+
{
318+
"snapshot" : "snapshot_2",
319+
"repository" : "my_repository",
320+
"uuid" : "lNeQD1SvTQCqqJUMQSwmGg",
321+
"state" : "SUCCESS",
322+
"include_global_state" : false,
323+
"shards_stats" : {
324+
"initializing" : 0,
325+
"started" : 0,
326+
"finalizing" : 0,
327+
"done" : 1,
328+
"failed" : 0,
329+
"total" : 1
330+
},
331+
"stats" : {
332+
"incremental" : {
333+
"file_count" : 3,
334+
"size_in_bytes" : 5969
335+
},
336+
"total" : {
337+
"file_count" : 4,
338+
"size_in_bytes" : 6024
339+
},
340+
"start_time_in_millis" : 1594829326691,
341+
"time_in_millis" : 205
342+
},
343+
"indices" : {
344+
"index_1" : {
345+
"shards_stats" : {
346+
"initializing" : 0,
347+
"started" : 0,
348+
"finalizing" : 0,
349+
"done" : 1,
350+
"failed" : 0,
351+
"total" : 1
352+
},
353+
"stats" : {
354+
"incremental" : {
355+
"file_count" : 3,
356+
"size_in_bytes" : 5969
357+
},
358+
"total" : {
359+
"file_count" : 4,
360+
"size_in_bytes" : 6024
361+
},
362+
"start_time_in_millis" : 1594829326896,
363+
"time_in_millis" : 0
364+
},
365+
"shards" : {
366+
"0" : {
367+
"stage" : "DONE",
368+
"stats" : {
369+
"incremental" : {
370+
"file_count" : 3,
371+
"size_in_bytes" : 5969
372+
},
373+
"total" : {
374+
"file_count" : 4,
375+
"size_in_bytes" : 6024
376+
},
377+
"start_time_in_millis" : 1594829326896,
378+
"time_in_millis" : 0
379+
}
380+
}
381+
}
382+
}
383+
}
384+
}
385+
]
386+
}
387+
----
388+
// TESTRESPONSE[s/"uuid" : "lNeQD1SvTQCqqJUMQSwmGg"/"uuid" : $body.snapshots.0.uuid/]
389+
// TESTRESPONSE[s/"size_in_bytes" : 6024/"size_in_bytes" : $body.snapshots.0.stats.total.size_in_bytes/]
390+
// TESTRESPONSE[s/"done" : 10/"done" : $body.snapshots.0.shards_stats.done/]
391+
// TESTRESPONSE[s/"total" : 10/"total" : $body.snapshots.0.shards_stats.total/]
392+
// TESTRESPONSE[s/"start_time_in_millis" : 1594829326691/"start_time_in_millis" : $body.snapshots.0.stats.start_time_in_millis/]
393+
// TESTRESPONSE[s/"time_in_millis" : 205/"time_in_millis" : $body.snapshots.0.stats.time_in_millis/]
394+
// TESTRESPONSE[s/"file_count" : 3/"file_count" : $body.snapshots.0.stats.incremental.file_count/]
395+
// TESTRESPONSE[s/"size_in_bytes" : 5969/"size_in_bytes" : $body.snapshots.0.stats.incremental.size_in_bytes/]
396+
// TESTRESPONSE[s/"start_time_in_millis" : 1594829326896/"start_time_in_millis" : $body.snapshots.0.indices.index_1.stats.start_time_in_millis/]

0 commit comments

Comments
 (0)