-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Implement from_sort_value Parameter in Get Snapshots API #77618
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
Changes from 2 commits
e2529d5
130344a
baec0ea
6f0ae18
0fa188f
2ece405
7b30c21
def381c
e4fd7fc
089b4b4
960a2c1
e34c61c
59fb31d
f7ec41a
108367a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,14 +140,19 @@ Allows setting a sort order for the result. Defaults to `start_time`, i.e. sorti | |
| (Optional, string) | ||
| Sort order. Valid values are `asc` for ascending and `desc` for descending order. Defaults to `asc`, meaning ascending order. | ||
|
|
||
| `after_value`:: | ||
| (Optional, string) | ||
| Value of the current sort column after which to start pagination. Can either be a string snapshot- or repository name when sorting by | ||
| snapshot or repository name, a millisecond time value or a number when sorting by index- or shard count. | ||
|
|
||
| `after`:: | ||
| (Optional, string) | ||
| Offset identifier to start pagination from as returned by the `next` field in the response body. | ||
|
|
||
| `offset`:: | ||
| (Optional, integer) | ||
| Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually | ||
| exclusive with using the `after` parameter. Defaults to `0`. | ||
| exclusive with using the `after` or `after_value` parameters. Defaults to `0`. | ||
|
|
||
| `slm_policy_filter`:: | ||
| (Optional, string) | ||
|
|
@@ -158,11 +163,11 @@ created by an SLM policy but not those snapshots that were not created by an SLM | |
| policy you can use the special pattern `_none` that will match all snapshots without an SLM policy. | ||
|
|
||
| NOTE: The `after` parameter and `next` field allow for iterating through snapshots with some consistency guarantees regarding concurrent | ||
| creation or deletion of snapshots. It is guaranteed that any snapshot that exists at the beginning of the iteration and not concurrently | ||
| creation or deletion of snapshots. It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently | ||
| deleted will be seen during the iteration. Snapshots concurrently created may be seen during an iteration. | ||
|
|
||
| NOTE: The parameters `size`, `order`, `after`, `offset`, `slm_policy_filter` and `sort` are not supported when using `verbose=false` and | ||
| the sort order for requests with `verbose=false` is undefined. | ||
| NOTE: The parameters `size`, `order`, `after`, `after_value`, `offset`, `slm_policy_filter` and `sort` are not supported when using | ||
|
||
| `verbose=false` and the sort order for requests with `verbose=false` is undefined. | ||
|
|
||
| [role="child_attributes"] | ||
| [[get-snapshot-api-response-body]] | ||
|
|
@@ -628,3 +633,84 @@ The API returns the following response: | |
| // TESTRESPONSE[s/"end_time_in_millis": 1593094752019/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/] | ||
| // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/] | ||
| // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.1.duration_in_millis/] | ||
|
|
||
|
|
||
| The following request returns information for all snapshots that come after `snapshot_1` when sorted by snapshot name in the default | ||
| ascending order. | ||
|
|
||
| [source,console] | ||
| ---- | ||
| GET /_snapshot/my_repository/*?sort=name&after_value=snapshot_1 | ||
| ---- | ||
|
|
||
| The API returns the following response: | ||
|
|
||
| [source,console-result] | ||
| ---- | ||
| { | ||
| "snapshots": [ | ||
| { | ||
| "snapshot": "snapshot_2", | ||
| "uuid": "vdRctLCxSketdKb54xw67g", | ||
| "repository": "my_repository", | ||
| "version_id": <version_id>, | ||
| "version": <version>, | ||
| "indices": [], | ||
| "data_streams": [], | ||
| "feature_states": [], | ||
| "include_global_state": true, | ||
| "state": "SUCCESS", | ||
| "start_time": "2020-07-06T21:55:18.130Z", | ||
| "start_time_in_millis": 1593093628851, | ||
| "end_time": "2020-07-06T21:55:18.130Z", | ||
| "end_time_in_millis": 1593094752019, | ||
| "duration_in_millis": 1, | ||
| "failures": [], | ||
| "shards": { | ||
| "total": 0, | ||
| "failed": 0, | ||
| "successful": 0 | ||
| } | ||
| }, | ||
| { | ||
| "snapshot": "snapshot_3", | ||
| "uuid": "dRctdKb54xw67gvLCxSket", | ||
| "repository": "my_repository", | ||
| "version_id": <version_id>, | ||
| "version": <version>, | ||
| "indices": [], | ||
| "data_streams": [], | ||
| "feature_states": [], | ||
| "include_global_state": true, | ||
| "state": "SUCCESS", | ||
| "start_time": "2020-07-06T21:55:18.129Z", | ||
| "start_time_in_millis": 1593093628850, | ||
| "end_time": "2020-07-06T21:55:18.129Z", | ||
| "end_time_in_millis": 1593094752018, | ||
| "duration_in_millis": 0, | ||
| "failures": [], | ||
| "shards": { | ||
| "total": 0, | ||
| "failed": 0, | ||
| "successful": 0 | ||
| } | ||
| } | ||
| ], | ||
| "total": 2, | ||
| "remaining": 0 | ||
| } | ||
| ---- | ||
| // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.0.uuid/] | ||
| // TESTRESPONSE[s/"uuid": "dRctdKb54xw67gvLCxSket"/"uuid": $body.snapshots.1.uuid/] | ||
| // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/] | ||
| // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/] | ||
| // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.130Z"/"start_time": $body.snapshots.0.start_time/] | ||
| // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.1.start_time/] | ||
| // TESTRESPONSE[s/"start_time_in_millis": 1593093628851/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/] | ||
| // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.1.start_time_in_millis/] | ||
| // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.130Z"/"end_time": $body.snapshots.0.end_time/] | ||
| // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.1.end_time/] | ||
| // TESTRESPONSE[s/"end_time_in_millis": 1593094752019/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/] | ||
| // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/] | ||
| // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.0.duration_in_millis/] | ||
| // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.1.duration_in_millis/] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should call the parameter
after_sort_valueto make the coupling to sort explicit in the name?I am still pondering on
after_. Reading your text, perhapsstart_sort_valueis better, though I am not really contend with that either...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this or the alternatives. How about just
frommaybe? It's short and it indicates "start" + "inclusive"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like from, but perhaps still qualify it as
from_sort_value? I think that makes it easier to see from the request what it means.