@@ -19,7 +19,9 @@ PUT /_snapshot/my_repository
1919
2020PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true
2121
22+ PUT /_snapshot/my_repository/snapshot_1?wait_for_completion=true
2223PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true
24+ PUT /_snapshot/my_repository/snapshot_3?wait_for_completion=true
2325----
2426// TESTSETUP
2527////
@@ -57,7 +59,8 @@ Use the get snapshot API to return information about one or more snapshots, incl
5759
5860`<repository>`::
5961(Required, string)
60- Snapshot repository name used to limit the request.
62+ Comma-separated list of snapshot repository names used to limit the request.
63+ Wildcard (`*`) expressions are supported.
6164+
6265To get information about all snapshot repositories registered in the
6366cluster, omit this parameter or use `*` or `_all`.
@@ -99,6 +102,45 @@ comprising the number of shards in the index, the total size of the index in
99102bytes, and the maximum number of segments per shard in the index. Defaults to
100103`false`, meaning that this information is omitted.
101104
105+ `sort`::
106+ (Optional, string)
107+ Allows setting a sort order for the result. Defaults to `start_time`, i.e. sorting by snapshot start time stamp.
108+ +
109+ .Valid values for `sort`
110+ [%collapsible%open]
111+ ====
112+ `start_time`::
113+ Sort snapshots by their start time stamp and break ties by snapshot name.
114+
115+ `duration`::
116+ Sort snapshots by their duration and break ties by snapshot name.
117+
118+ `name`::
119+ Sort snapshots by their name.
120+
121+ `index_count`::
122+ Sort snapshots by the number of indices they contain and break ties by snapshot name.
123+ ====
124+
125+ `size`::
126+ (Optional, integer)
127+ Maximum number of snapshots to return. Defaults to `0` which means return all that match the request without limit.
128+
129+ `order`::
130+ (Optional, string)
131+ Sort order. Valid values are `asc` for ascending and `desc` for descending order. Defaults to `asc`, meaning ascending order.
132+
133+ `after`::
134+ (Optional, string)
135+ Offset identifier to start pagination from as returned by the `next` field in the response body.
136+
137+ NOTE: The `after` parameter and `next` field allow for iterating through snapshots with some consistency guarantees regarding concurrent
138+ creation or deletion of snapshots. It is guaranteed that any snapshot that exists at the beginning of the iteration and not concurrently
139+ deleted will be seen during the iteration. Snapshots concurrently created may be seen during an iteration.
140+
141+ NOTE: The pagination parameters `size`, `order`, `after` and `sort` are not supported when using `verbose=false` and the sort order for
142+ requests with `verbose=false` is undefined.
143+
102144[role="child_attributes"]
103145[[get-snapshot-api-response-body]]
104146==== {api-response-body-title}
@@ -236,6 +278,10 @@ The snapshot `state` can be one of the following values:
236278 that were not processed correctly.
237279====
238280--
281+ `next`::
282+ (string)
283+ If the request contained a size limit and there might be more results, a `next` field will be added to the response and can be used as the
284+ `after` query parameter to fetch additional results.
239285
240286[[get-snapshot-api-example]]
241287==== {api-examples-title}
@@ -256,6 +302,7 @@ The API returns the following response:
256302 {
257303 "snapshot": "snapshot_2",
258304 "uuid": "vdRctLCxSketdKb54xw67g",
305+ "repository": "my_repository",
259306 "version_id": <version_id>,
260307 "version": <version>,
261308 "indices": [],
@@ -265,7 +312,7 @@ The API returns the following response:
265312 "state": "SUCCESS",
266313 "start_time": "2020-07-06T21:55:18.129Z",
267314 "start_time_in_millis": 1593093628850,
268- "end_time": "2020-07-06T21:55:18.876Z ",
315+ "end_time": "2020-07-06T21:55:18.129Z ",
269316 "end_time_in_millis": 1593094752018,
270317 "duration_in_millis": 0,
271318 "failures": [],
@@ -283,6 +330,133 @@ The API returns the following response:
283330// TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
284331// TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
285332// TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
286- // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.876Z"/"end_time": $body.snapshots.0.end_time/]
333+ // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
334+ // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
335+ // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
336+
337+ The following request returns information for all snapshots with prefix `snapshot` in the `my_repository` repository,
338+ limiting the response size to 2 and sorting by snapshot name.
339+
340+ [source,console]
341+ ----
342+ GET /_snapshot/my_repository/snapshot*?size=2&sort=name
343+ ----
344+
345+ The API returns the following response:
346+
347+ [source,console-result]
348+ ----
349+ {
350+ "snapshots": [
351+ {
352+ "snapshot": "snapshot_1",
353+ "uuid": "dKb54xw67gvdRctLCxSket",
354+ "repository": "my_repository",
355+ "version_id": <version_id>,
356+ "version": <version>,
357+ "indices": [],
358+ "data_streams": [],
359+ "feature_states": [],
360+ "include_global_state": true,
361+ "state": "SUCCESS",
362+ "start_time": "2020-07-06T21:55:18.129Z",
363+ "start_time_in_millis": 1593093628850,
364+ "end_time": "2020-07-06T21:55:18.129Z",
365+ "end_time_in_millis": 1593094752018,
366+ "duration_in_millis": 0,
367+ "failures": [],
368+ "shards": {
369+ "total": 0,
370+ "failed": 0,
371+ "successful": 0
372+ }
373+ },
374+ {
375+ "snapshot": "snapshot_2",
376+ "uuid": "vdRctLCxSketdKb54xw67g",
377+ "repository": "my_repository",
378+ "version_id": <version_id>,
379+ "version": <version>,
380+ "indices": [],
381+ "data_streams": [],
382+ "feature_states": [],
383+ "include_global_state": true,
384+ "state": "SUCCESS",
385+ "start_time": "2020-07-06T21:55:18.130Z",
386+ "start_time_in_millis": 1593093628851,
387+ "end_time": "2020-07-06T21:55:18.130Z",
388+ "end_time_in_millis": 1593094752019,
389+ "duration_in_millis": 1,
390+ "failures": [],
391+ "shards": {
392+ "total": 0,
393+ "failed": 0,
394+ "successful": 0
395+ }
396+ }
397+ ],
398+ "next": "c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI="
399+ }
400+ ----
401+ // TESTRESPONSE[s/"uuid": "dKb54xw67gvdRctLCxSket"/"uuid": $body.snapshots.0.uuid/]
402+ // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.1.uuid/]
403+ // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
404+ // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
405+ // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
406+ // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.130Z"/"start_time": $body.snapshots.1.start_time/]
407+ // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
408+ // TESTRESPONSE[s/"start_time_in_millis": 1593093628851/"start_time_in_millis": $body.snapshots.1.start_time_in_millis/]
409+ // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
410+ // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.130Z"/"end_time": $body.snapshots.1.end_time/]
287411// TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
412+ // TESTRESPONSE[s/"end_time_in_millis": 1593094752019/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/]
288413// TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
414+ // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.1.duration_in_millis/]
415+
416+ A subsequent request for the remaining snapshots can then be made using the `next` value from the previous response as `after` parameter.
417+
418+ [source,console]
419+ ----
420+ GET /_snapshot/my_repository/snapshot*?size=2&sort=name&after=c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI=
421+ ----
422+
423+ The API returns the following response:
424+
425+ [source,console-result]
426+ ----
427+ {
428+ "snapshots": [
429+ {
430+ "snapshot": "snapshot_3",
431+ "uuid": "dRctdKb54xw67gvLCxSket",
432+ "repository": "my_repository",
433+ "version_id": <version_id>,
434+ "version": <version>,
435+ "indices": [],
436+ "data_streams": [],
437+ "feature_states": [],
438+ "include_global_state": true,
439+ "state": "SUCCESS",
440+ "start_time": "2020-07-06T21:55:18.129Z",
441+ "start_time_in_millis": 1593093628850,
442+ "end_time": "2020-07-06T21:55:18.129Z",
443+ "end_time_in_millis": 1593094752018,
444+ "duration_in_millis": 0,
445+ "failures": [],
446+ "shards": {
447+ "total": 0,
448+ "failed": 0,
449+ "successful": 0
450+ }
451+ }
452+ ]
453+ }
454+ ----
455+ // TESTRESPONSE[s/"uuid": "dRctdKb54xw67gvLCxSket"/"uuid": $body.snapshots.0.uuid/]
456+ // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
457+ // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
458+ // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
459+ // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
460+ // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
461+ // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
462+ // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
0 commit comments