get-snapshot-api.asciidoc 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  1. [[get-snapshot-api]]
  2. === Get snapshot API
  3. ++++
  4. <titleabbrev>Get snapshot</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-snapshot[Snapshot and restore APIs].
  10. --
  11. Retrieves information about one or more snapshots.
  12. ////
  13. [source,console]
  14. ----
  15. PUT /_snapshot/my_repository
  16. {
  17. "type": "fs",
  18. "settings": {
  19. "location": "my_backup_location"
  20. }
  21. }
  22. PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true
  23. {
  24. "indices":"-*"
  25. }
  26. PUT /_snapshot/my_repository/snapshot_1?wait_for_completion=true
  27. {
  28. "indices":"-*"
  29. }
  30. PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true
  31. {
  32. "indices":"-*"
  33. }
  34. PUT /_snapshot/my_repository/snapshot_3?wait_for_completion=true
  35. {
  36. "indices":"-*"
  37. }
  38. ----
  39. // TESTSETUP
  40. ////
  41. [source,console]
  42. ----
  43. GET /_snapshot/my_repository/my_snapshot
  44. ----
  45. [[get-snapshot-api-request]]
  46. ==== {api-request-title}
  47. `GET /_snapshot/<repository>/<snapshot>`
  48. [[get-snapshot-api-prereqs]]
  49. ==== {api-prereq-title}
  50. * If the {es} {security-features} are enabled, you must have the
  51. `monitor_snapshot`, `create_snapshot`, or `manage`
  52. <<privileges-list-cluster,cluster privilege>> to use this API.
  53. [[get-snapshot-api-path-params]]
  54. ==== {api-path-parms-title}
  55. `<repository>`::
  56. (Required, string)
  57. Comma-separated list of snapshot repository names used to limit the request.
  58. Wildcard (`*`) expressions are supported including combining wildcards with exclude patterns starting with `-`.
  59. +
  60. To get information about all snapshot repositories registered in the
  61. cluster, omit this parameter or use `*` or `_all`.
  62. `<snapshot>`::
  63. (Required, string)
  64. Comma-separated list of snapshot names to retrieve.
  65. Wildcard (`*`) expressions are supported including combining wildcards with exclude patterns starting with `-`.
  66. +
  67. * To get information about all snapshots in a registered repository, use a wildcard (`*`) or `_all`.
  68. * To get information about any snapshots that are currently running, use `_current`.
  69. +
  70. NOTE: Using `_all` in a request fails if any snapshots are unavailable.
  71. Set <<get-snapshot-api-ignore-unavailable,`ignore_unavailable`>> to `true` to return only available snapshots.
  72. [role="child_attributes"]
  73. [[get-snapshot-api-query-params]]
  74. ==== {api-query-parms-title}
  75. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  76. [[get-snapshot-api-ignore-unavailable]]
  77. `ignore_unavailable`::
  78. (Optional, Boolean)
  79. If `false`, the request returns an error for any snapshots that are unavailable. Defaults to `false`.
  80. +
  81. If `true`, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned.
  82. `verbose`::
  83. (Optional, Boolean)
  84. If `true`, returns additional information about each snapshot such as the
  85. version of Elasticsearch which took the snapshot, the start and end times of
  86. the snapshot, and the number of shards snapshotted. Defaults to `true`. If
  87. `false`, omits the additional information.
  88. `index_names`::
  89. (Optional, Boolean)
  90. If `true`, returns the list of index names included in each snapshot in the response.
  91. Defaults to `true`.
  92. `index_details`::
  93. (Optional, Boolean)
  94. If `true`, returns additional information about each index in the snapshot
  95. comprising the number of shards in the index, the total size of the index in
  96. bytes, and the maximum number of segments per shard in the index. Defaults to
  97. `false`, meaning that this information is omitted.
  98. `include_repository`::
  99. (Optional, Boolean)
  100. If `true`, returns the repository name for each snapshot in the response.
  101. Defaults to `true`.
  102. `sort`::
  103. (Optional, string)
  104. Allows setting a sort order for the result. Defaults to `start_time`, i.e. sorting by snapshot start time stamp.
  105. +
  106. .Valid values for `sort`
  107. [%collapsible%open]
  108. ====
  109. `start_time`::
  110. Sort snapshots by their start time stamp and break ties by snapshot name.
  111. `duration`::
  112. Sort snapshots by their duration and break ties by snapshot name.
  113. `name`::
  114. Sort snapshots by their name.
  115. `repository`::
  116. Sort snapshots by their repository name and break ties by snapshot name.
  117. `index_count`::
  118. Sort snapshots by the number of indices they contain and break ties by snapshot name.
  119. `shard_count`::
  120. Sort snapshots by the number of shards they contain and break ties by snapshot name.
  121. `failed_shard_count`::
  122. Sort snapshots by the number of shards that they failed to snapshot and break ties by snapshot name.
  123. ====
  124. `size`::
  125. (Optional, integer)
  126. Maximum number of snapshots to return. Defaults to `0` which means return all that match the request without limit.
  127. `order`::
  128. (Optional, string)
  129. Sort order. Valid values are `asc` for ascending and `desc` for descending order. Defaults to `asc`, meaning ascending order.
  130. `from_sort_value`::
  131. (Optional, string)
  132. Value of the current sort column at which to start retrieval. Can either be a string snapshot- or repository name when sorting by
  133. snapshot or repository name, a millisecond time value or a number when sorting by index- or shard count.
  134. `after`::
  135. (Optional, string)
  136. Offset identifier to start pagination from as returned by the `next` field in the response body. Using this parameter is mutually exclusive
  137. with using the `from_sort_value` parameter.
  138. `offset`::
  139. (Optional, integer)
  140. Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually
  141. exclusive with using the `after` parameter. Defaults to `0`.
  142. `slm_policy_filter`::
  143. (Optional, string)
  144. Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Also accepts wildcards (`\*`) and combinations
  145. of wildcards followed by exclude patterns starting with `-`. For example, the pattern `*,-policy-a-\*` will return all snapshots except
  146. for those that were created by an SLM policy with a name starting with `policy-a-`. Note that the wildcard pattern `*` matches all snapshots
  147. created by an SLM policy but not those snapshots that were not created by an SLM policy. To include snapshots not created by an SLM
  148. policy you can use the special pattern `_none` that will match all snapshots without an SLM policy.
  149. NOTE: The `after` parameter and `next` field allow for iterating through snapshots with some consistency guarantees regarding concurrent
  150. creation or deletion of snapshots. It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently
  151. deleted will be seen during the iteration. Snapshots concurrently created may be seen during an iteration.
  152. NOTE: The parameters `size`, `order`, `after`, `from_sort_value`, `offset`, `slm_policy_filter` and `sort` are not supported when using
  153. `verbose=false` and the sort order for requests with `verbose=false` is undefined.
  154. [role="child_attributes"]
  155. [[get-snapshot-api-response-body]]
  156. ==== {api-response-body-title}
  157. `snapshot`::
  158. (string)
  159. Name of the snapshot.
  160. `uuid`::
  161. (string)
  162. Universally unique identifier (UUID) of the snapshot.
  163. `version_id`::
  164. (int)
  165. Build ID of the {es} version used to create the snapshot.
  166. `version`::
  167. (float)
  168. {es} version used to create the snapshot.
  169. `indices`::
  170. (array)
  171. List of indices included in the snapshot.
  172. `index_details`::
  173. (object)
  174. Details of each index in the snapshot, keyed by index name. Only present if the
  175. `?index_details` query parameter is set, and only contains details for indices
  176. that were completely snapshotted in a sufficiently recent version of {es}.
  177. +
  178. .Properties of `index_details`
  179. [%collapsible%open]
  180. ====
  181. `shard_count`::
  182. (integer)
  183. Number of shards in this index.
  184. `size`::
  185. (string)
  186. Total size of all shards in this index. Only present if the `?human` query
  187. paramter is set.
  188. `size_in_bytes`::
  189. (long)
  190. Total size of all shards in this index, in bytes.
  191. `max_segments_per_shard`::
  192. (integer)
  193. Maximum number of segments per shard in this index snapshot.
  194. ====
  195. `data_streams`::
  196. (array of strings)
  197. List of <<data-streams,data streams>> included in the snapshot.
  198. `include_global_state`::
  199. (Boolean)
  200. Indicates whether the current cluster state is included in the snapshot.
  201. [[get-snapshot-api-feature-states]]
  202. `feature_states`::
  203. (array of objects) <<feature-state,Feature states>> in the snapshot.
  204. Only present if the snapshot contains one or more feature states.
  205. +
  206. .Properties of `features_states` objects
  207. [%collapsible%open]
  208. ====
  209. `feature_name`::
  210. (string) Name of the feature, as returned by the <<get-features-api,get features
  211. API>>.
  212. `indices`::
  213. (array of strings) Indices in the feature state.
  214. ====
  215. `start_time`::
  216. (string)
  217. Date timestamp of when the snapshot creation process started.
  218. `start_time_in_millis`::
  219. (long)
  220. The time, in milliseconds, when the snapshot creation process started.
  221. `end_time`::
  222. (string)
  223. Date timestamp of when the snapshot creation process ended.
  224. `end_time_in_millis`::
  225. (long)
  226. The time, in milliseconds, when the snapshot creation process ended.
  227. `duration_in_millis`::
  228. (long)
  229. How long, in milliseconds, it took to create the snapshot.
  230. [[get-snapshot-api-response-failures]]
  231. `failures`::
  232. (array)
  233. Lists any failures that occurred when creating the snapshot.
  234. `shards`::
  235. (object)
  236. Contains a count of shards in the snapshot.
  237. +
  238. .Properties of `shards`
  239. [%collapsible%open]
  240. ====
  241. `total`::
  242. (integer)
  243. Total number of shards included in the snapshot.
  244. `successful`::
  245. (integer)
  246. Number of shards that were successfully included in the snapshot.
  247. `failed`::
  248. (integer)
  249. Number of shards that failed to be included in the snapshot.
  250. ====
  251. [[get-snapshot-api-response-state]]
  252. `state`::
  253. +
  254. --
  255. (string)
  256. The snapshot `state` can be one of the following values:
  257. .Values for `state`
  258. [%collapsible%open]
  259. ====
  260. `IN_PROGRESS`::
  261. The snapshot is currently running.
  262. `SUCCESS`::
  263. The snapshot finished and all shards were stored successfully.
  264. `FAILED`::
  265. The snapshot finished with an error and failed to store any data.
  266. `PARTIAL`::
  267. The global cluster state was stored, but data of at least one shard was not stored successfully.
  268. The <<get-snapshot-api-response-failures,`failures`>> section of the response contains more detailed information about shards
  269. that were not processed correctly.
  270. ====
  271. --
  272. `next`::
  273. (string)
  274. 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
  275. `after` query parameter to fetch additional results.
  276. `total`::
  277. (integer)
  278. The total number of snapshots that match the request when ignoring size limit or `after` query parameter.
  279. `remaining`::
  280. (integer)
  281. The number of remaining snapshots that were not returned due to size limits and that can be fetched by additional requests using the `next`
  282. field value.
  283. [[get-snapshot-api-example]]
  284. ==== {api-examples-title}
  285. The following request returns information for `snapshot_2` in the `my_repository` repository.
  286. [source,console]
  287. ----
  288. GET /_snapshot/my_repository/snapshot_2
  289. ----
  290. The API returns the following response:
  291. [source,console-result]
  292. ----
  293. {
  294. "snapshots": [
  295. {
  296. "snapshot": "snapshot_2",
  297. "uuid": "vdRctLCxSketdKb54xw67g",
  298. "repository": "my_repository",
  299. "version_id": <version_id>,
  300. "version": <version>,
  301. "indices": [],
  302. "data_streams": [],
  303. "feature_states": [],
  304. "include_global_state": true,
  305. "state": "SUCCESS",
  306. "start_time": "2020-07-06T21:55:18.129Z",
  307. "start_time_in_millis": 1593093628850,
  308. "end_time": "2020-07-06T21:55:18.129Z",
  309. "end_time_in_millis": 1593094752018,
  310. "duration_in_millis": 0,
  311. "failures": [],
  312. "shards": {
  313. "total": 0,
  314. "failed": 0,
  315. "successful": 0
  316. }
  317. }
  318. ],
  319. "total": 1,
  320. "remaining": 0
  321. }
  322. ----
  323. // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.0.uuid/]
  324. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  325. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  326. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
  327. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  328. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
  329. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  330. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  331. The following request returns information for all snapshots with prefix `snapshot` in the `my_repository` repository,
  332. limiting the response size to 2 and sorting by snapshot name.
  333. [source,console]
  334. ----
  335. GET /_snapshot/my_repository/snapshot*?size=2&sort=name
  336. ----
  337. The API returns the following response:
  338. [source,console-result]
  339. ----
  340. {
  341. "snapshots": [
  342. {
  343. "snapshot": "snapshot_1",
  344. "uuid": "dKb54xw67gvdRctLCxSket",
  345. "repository": "my_repository",
  346. "version_id": <version_id>,
  347. "version": <version>,
  348. "indices": [],
  349. "data_streams": [],
  350. "feature_states": [],
  351. "include_global_state": true,
  352. "state": "SUCCESS",
  353. "start_time": "2020-07-06T21:55:18.129Z",
  354. "start_time_in_millis": 1593093628850,
  355. "end_time": "2020-07-06T21:55:18.129Z",
  356. "end_time_in_millis": 1593094752018,
  357. "duration_in_millis": 0,
  358. "failures": [],
  359. "shards": {
  360. "total": 0,
  361. "failed": 0,
  362. "successful": 0
  363. }
  364. },
  365. {
  366. "snapshot": "snapshot_2",
  367. "uuid": "vdRctLCxSketdKb54xw67g",
  368. "repository": "my_repository",
  369. "version_id": <version_id>,
  370. "version": <version>,
  371. "indices": [],
  372. "data_streams": [],
  373. "feature_states": [],
  374. "include_global_state": true,
  375. "state": "SUCCESS",
  376. "start_time": "2020-07-06T21:55:18.130Z",
  377. "start_time_in_millis": 1593093628851,
  378. "end_time": "2020-07-06T21:55:18.130Z",
  379. "end_time_in_millis": 1593094752019,
  380. "duration_in_millis": 1,
  381. "failures": [],
  382. "shards": {
  383. "total": 0,
  384. "failed": 0,
  385. "successful": 0
  386. }
  387. }
  388. ],
  389. "next": "c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI=",
  390. "total": 3,
  391. "remaining": 1
  392. }
  393. ----
  394. // TESTRESPONSE[s/"uuid": "dKb54xw67gvdRctLCxSket"/"uuid": $body.snapshots.0.uuid/]
  395. // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.1.uuid/]
  396. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  397. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  398. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
  399. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.130Z"/"start_time": $body.snapshots.1.start_time/]
  400. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  401. // TESTRESPONSE[s/"start_time_in_millis": 1593093628851/"start_time_in_millis": $body.snapshots.1.start_time_in_millis/]
  402. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
  403. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.130Z"/"end_time": $body.snapshots.1.end_time/]
  404. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  405. // TESTRESPONSE[s/"end_time_in_millis": 1593094752019/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/]
  406. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  407. // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.1.duration_in_millis/]
  408. A subsequent request for the remaining snapshots can then be made using the `next` value from the previous response as `after` parameter.
  409. [source,console]
  410. ----
  411. GET /_snapshot/my_repository/snapshot*?size=2&sort=name&after=c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI=
  412. ----
  413. The API returns the following response:
  414. [source,console-result]
  415. ----
  416. {
  417. "snapshots": [
  418. {
  419. "snapshot": "snapshot_3",
  420. "uuid": "dRctdKb54xw67gvLCxSket",
  421. "repository": "my_repository",
  422. "version_id": <version_id>,
  423. "version": <version>,
  424. "indices": [],
  425. "data_streams": [],
  426. "feature_states": [],
  427. "include_global_state": true,
  428. "state": "SUCCESS",
  429. "start_time": "2020-07-06T21:55:18.129Z",
  430. "start_time_in_millis": 1593093628850,
  431. "end_time": "2020-07-06T21:55:18.129Z",
  432. "end_time_in_millis": 1593094752018,
  433. "duration_in_millis": 0,
  434. "failures": [],
  435. "shards": {
  436. "total": 0,
  437. "failed": 0,
  438. "successful": 0
  439. }
  440. }
  441. ],
  442. "total": 3,
  443. "remaining": 0
  444. }
  445. ----
  446. // TESTRESPONSE[s/"uuid": "dRctdKb54xw67gvLCxSket"/"uuid": $body.snapshots.0.uuid/]
  447. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  448. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  449. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
  450. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  451. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
  452. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  453. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  454. Alternatively, the same result could be retrieved by using an offset value of `2` to skip the two snapshot already seen.
  455. [source,console]
  456. ----
  457. GET /_snapshot/my_repository/snapshot*?size=2&sort=name&offset=2
  458. ----
  459. The API returns the following response:
  460. [source,console-result]
  461. ----
  462. {
  463. "snapshots": [
  464. {
  465. "snapshot": "snapshot_3",
  466. "uuid": "dRctdKb54xw67gvLCxSket",
  467. "repository": "my_repository",
  468. "version_id": <version_id>,
  469. "version": <version>,
  470. "indices": [],
  471. "data_streams": [],
  472. "feature_states": [],
  473. "include_global_state": true,
  474. "state": "SUCCESS",
  475. "start_time": "2020-07-06T21:55:18.129Z",
  476. "start_time_in_millis": 1593093628850,
  477. "end_time": "2020-07-06T21:55:18.129Z",
  478. "end_time_in_millis": 1593094752018,
  479. "duration_in_millis": 0,
  480. "failures": [],
  481. "shards": {
  482. "total": 0,
  483. "failed": 0,
  484. "successful": 0
  485. }
  486. }
  487. ],
  488. "total": 3,
  489. "remaining": 0
  490. }
  491. ----
  492. // TESTRESPONSE[s/"uuid": "dRctdKb54xw67gvLCxSket"/"uuid": $body.snapshots.0.uuid/]
  493. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  494. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  495. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
  496. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  497. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
  498. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  499. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  500. The following request returns information for all snapshots with prefix `snapshot` in the `my_repository` repository,
  501. except for the one named `snapshot_3`
  502. [source,console]
  503. ----
  504. GET /_snapshot/my_repository/snapshot*,-snapshot_3?sort=name
  505. ----
  506. The API returns the following response:
  507. [source,console-result]
  508. ----
  509. {
  510. "snapshots": [
  511. {
  512. "snapshot": "snapshot_1",
  513. "uuid": "dKb54xw67gvdRctLCxSket",
  514. "repository": "my_repository",
  515. "version_id": <version_id>,
  516. "version": <version>,
  517. "indices": [],
  518. "data_streams": [],
  519. "feature_states": [],
  520. "include_global_state": true,
  521. "state": "SUCCESS",
  522. "start_time": "2020-07-06T21:55:18.129Z",
  523. "start_time_in_millis": 1593093628850,
  524. "end_time": "2020-07-06T21:55:18.129Z",
  525. "end_time_in_millis": 1593094752018,
  526. "duration_in_millis": 0,
  527. "failures": [],
  528. "shards": {
  529. "total": 0,
  530. "failed": 0,
  531. "successful": 0
  532. }
  533. },
  534. {
  535. "snapshot": "snapshot_2",
  536. "uuid": "vdRctLCxSketdKb54xw67g",
  537. "repository": "my_repository",
  538. "version_id": <version_id>,
  539. "version": <version>,
  540. "indices": [],
  541. "data_streams": [],
  542. "feature_states": [],
  543. "include_global_state": true,
  544. "state": "SUCCESS",
  545. "start_time": "2020-07-06T21:55:18.130Z",
  546. "start_time_in_millis": 1593093628851,
  547. "end_time": "2020-07-06T21:55:18.130Z",
  548. "end_time_in_millis": 1593094752019,
  549. "duration_in_millis": 1,
  550. "failures": [],
  551. "shards": {
  552. "total": 0,
  553. "failed": 0,
  554. "successful": 0
  555. }
  556. }
  557. ],
  558. "total": 2,
  559. "remaining": 0
  560. }
  561. ----
  562. // TESTRESPONSE[s/"uuid": "dKb54xw67gvdRctLCxSket"/"uuid": $body.snapshots.0.uuid/]
  563. // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.1.uuid/]
  564. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  565. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  566. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.0.start_time/]
  567. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.130Z"/"start_time": $body.snapshots.1.start_time/]
  568. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  569. // TESTRESPONSE[s/"start_time_in_millis": 1593093628851/"start_time_in_millis": $body.snapshots.1.start_time_in_millis/]
  570. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
  571. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.130Z"/"end_time": $body.snapshots.1.end_time/]
  572. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  573. // TESTRESPONSE[s/"end_time_in_millis": 1593094752019/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/]
  574. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  575. // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.1.duration_in_millis/]
  576. The following request returns information for all snapshots that come after `snapshot_2` when sorted by snapshot name in the default
  577. ascending order.
  578. [source,console]
  579. ----
  580. GET /_snapshot/my_repository/*?sort=name&from_sort_value=snapshot_2
  581. ----
  582. The API returns the following response:
  583. [source,console-result]
  584. ----
  585. {
  586. "snapshots": [
  587. {
  588. "snapshot": "snapshot_2",
  589. "uuid": "vdRctLCxSketdKb54xw67g",
  590. "repository": "my_repository",
  591. "version_id": <version_id>,
  592. "version": <version>,
  593. "indices": [],
  594. "data_streams": [],
  595. "feature_states": [],
  596. "include_global_state": true,
  597. "state": "SUCCESS",
  598. "start_time": "2020-07-06T21:55:18.130Z",
  599. "start_time_in_millis": 1593093628851,
  600. "end_time": "2020-07-06T21:55:18.130Z",
  601. "end_time_in_millis": 1593094752019,
  602. "duration_in_millis": 1,
  603. "failures": [],
  604. "shards": {
  605. "total": 0,
  606. "failed": 0,
  607. "successful": 0
  608. }
  609. },
  610. {
  611. "snapshot": "snapshot_3",
  612. "uuid": "dRctdKb54xw67gvLCxSket",
  613. "repository": "my_repository",
  614. "version_id": <version_id>,
  615. "version": <version>,
  616. "indices": [],
  617. "data_streams": [],
  618. "feature_states": [],
  619. "include_global_state": true,
  620. "state": "SUCCESS",
  621. "start_time": "2020-07-06T21:55:18.129Z",
  622. "start_time_in_millis": 1593093628850,
  623. "end_time": "2020-07-06T21:55:18.129Z",
  624. "end_time_in_millis": 1593094752018,
  625. "duration_in_millis": 0,
  626. "failures": [],
  627. "shards": {
  628. "total": 0,
  629. "failed": 0,
  630. "successful": 0
  631. }
  632. }
  633. ],
  634. "total": 2,
  635. "remaining": 0
  636. }
  637. ----
  638. // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.0.uuid/]
  639. // TESTRESPONSE[s/"uuid": "dRctdKb54xw67gvLCxSket"/"uuid": $body.snapshots.1.uuid/]
  640. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  641. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  642. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.130Z"/"start_time": $body.snapshots.0.start_time/]
  643. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.snapshots.1.start_time/]
  644. // TESTRESPONSE[s/"start_time_in_millis": 1593093628851/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  645. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.snapshots.1.start_time_in_millis/]
  646. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.130Z"/"end_time": $body.snapshots.0.end_time/]
  647. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.1.end_time/]
  648. // TESTRESPONSE[s/"end_time_in_millis": 1593094752019/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  649. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/]
  650. // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  651. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.1.duration_in_millis/]
  652. The following request returns information for all snapshots with names starting with `snapshot_` and that started on or after timestamp
  653. `1577833200000` (Jan 1st 2020) when sorted by snapshot start time in the default ascending order.
  654. [source,console]
  655. ----
  656. GET /_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000
  657. ----
  658. The API returns the following response:
  659. [source,console-result]
  660. ----
  661. {
  662. "snapshots": [
  663. {
  664. "snapshot": "snapshot_1",
  665. "uuid": "dKb54xw67gvdRctLCxSket",
  666. "repository": "my_repository",
  667. "version_id": <version_id>,
  668. "version": <version>,
  669. "indices": [],
  670. "data_streams": [],
  671. "feature_states": [],
  672. "include_global_state": true,
  673. "state": "SUCCESS",
  674. "start_time": "2020-07-06T21:55:18.128Z",
  675. "start_time_in_millis": 1593093628849,
  676. "end_time": "2020-07-06T21:55:18.129Z",
  677. "end_time_in_millis": 1593093628850,
  678. "duration_in_millis": 1,
  679. "failures": [],
  680. "shards": {
  681. "total": 0,
  682. "failed": 0,
  683. "successful": 0
  684. }
  685. },
  686. {
  687. "snapshot": "snapshot_2",
  688. "uuid": "vdRctLCxSketdKb54xw67g",
  689. "repository": "my_repository",
  690. "version_id": <version_id>,
  691. "version": <version>,
  692. "indices": [],
  693. "data_streams": [],
  694. "feature_states": [],
  695. "include_global_state": true,
  696. "state": "SUCCESS",
  697. "start_time": "2020-07-06T21:55:18.130Z",
  698. "start_time_in_millis": 1593093628851,
  699. "end_time": "2020-07-06T21:55:18.130Z",
  700. "end_time_in_millis": 1593093628851,
  701. "duration_in_millis": 0,
  702. "failures": [],
  703. "shards": {
  704. "total": 0,
  705. "failed": 0,
  706. "successful": 0
  707. }
  708. },
  709. {
  710. "snapshot": "snapshot_3",
  711. "uuid": "dRctdKb54xw67gvLCxSket",
  712. "repository": "my_repository",
  713. "version_id": <version_id>,
  714. "version": <version>,
  715. "indices": [],
  716. "data_streams": [],
  717. "feature_states": [],
  718. "include_global_state": true,
  719. "state": "SUCCESS",
  720. "start_time": "2020-07-06T21:55:18.131Z",
  721. "start_time_in_millis": 1593093628852,
  722. "end_time": "2020-07-06T21:55:18.135Z",
  723. "end_time_in_millis": 1593093628856,
  724. "duration_in_millis": 4,
  725. "failures": [],
  726. "shards": {
  727. "total": 0,
  728. "failed": 0,
  729. "successful": 0
  730. }
  731. }
  732. ],
  733. "total": 3,
  734. "remaining": 0
  735. }
  736. ----
  737. // TESTRESPONSE[s/"uuid": "dKb54xw67gvdRctLCxSket"/"uuid": $body.snapshots.0.uuid/]
  738. // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.snapshots.1.uuid/]
  739. // TESTRESPONSE[s/"uuid": "dRctdKb54xw67gvLCxSket"/"uuid": $body.snapshots.2.uuid/]
  740. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.snapshots.0.version_id/]
  741. // TESTRESPONSE[s/"version": <version>/"version": $body.snapshots.0.version/]
  742. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.128Z"/"start_time": $body.snapshots.0.start_time/]
  743. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.130Z"/"start_time": $body.snapshots.1.start_time/]
  744. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.131Z"/"start_time": $body.snapshots.2.start_time/]
  745. // TESTRESPONSE[s/"start_time_in_millis": 1593093628849/"start_time_in_millis": $body.snapshots.0.start_time_in_millis/]
  746. // TESTRESPONSE[s/"start_time_in_millis": 1593093628851/"start_time_in_millis": $body.snapshots.1.start_time_in_millis/]
  747. // TESTRESPONSE[s/"start_time_in_millis": 1593093628852/"start_time_in_millis": $body.snapshots.2.start_time_in_millis/]
  748. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.snapshots.0.end_time/]
  749. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.130Z"/"end_time": $body.snapshots.1.end_time/]
  750. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.135Z"/"end_time": $body.snapshots.2.end_time/]
  751. // TESTRESPONSE[s/"end_time_in_millis": 1593093628850/"end_time_in_millis": $body.snapshots.0.end_time_in_millis/]
  752. // TESTRESPONSE[s/"end_time_in_millis": 1593093628851/"end_time_in_millis": $body.snapshots.1.end_time_in_millis/]
  753. // TESTRESPONSE[s/"end_time_in_millis": 1593093628856/"end_time_in_millis": $body.snapshots.2.end_time_in_millis/]
  754. // TESTRESPONSE[s/"duration_in_millis": 1/"duration_in_millis": $body.snapshots.0.duration_in_millis/]
  755. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.snapshots.1.duration_in_millis/]
  756. // TESTRESPONSE[s/"duration_in_millis": 4/"duration_in_millis": $body.snapshots.2.duration_in_millis/]