get-snapshot-api.asciidoc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. [[get-snapshot-api]]
  2. === Get snapshot API
  3. ++++
  4. <titleabbrev>Get snapshot</titleabbrev>
  5. ++++
  6. Retrieves information about one or more snapshots.
  7. ////
  8. [source,console]
  9. ----
  10. PUT /_snapshot/my_repository
  11. {
  12. "type": "fs",
  13. "settings": {
  14. "location": "my_backup_location"
  15. }
  16. }
  17. PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true
  18. PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true
  19. ----
  20. // TESTSETUP
  21. ////
  22. [source,console]
  23. ----
  24. GET /_snapshot/my_repository/my_snapshot
  25. ----
  26. [[get-snapshot-api-request]]
  27. ==== {api-request-title}
  28. `GET /_snapshot/<repository>/<snapshot>`
  29. [[get-snapshot-api-desc]]
  30. ==== {api-description-title}
  31. Use the get snapshot API to return information about one or more snapshots, including:
  32. * Start and end time values
  33. * Version of {es} that created the snapshot
  34. * List of included indices
  35. * Current state of the snapshot
  36. * List of failures that occurred during the snapshot
  37. [[get-snapshot-api-path-params]]
  38. ==== {api-path-parms-title}
  39. `<repository>`::
  40. (Required, string)
  41. Comma-separated list of snapshot repository names used to limit the request.
  42. Wildcard (`*`) expressions are supported.
  43. +
  44. To get information about all snapshot repositories registered in the
  45. cluster, omit this parameter or use `*` or `_all`.
  46. `<snapshot>`::
  47. (Required, string)
  48. Comma-separated list of snapshot names to retrieve. Also accepts wildcards (`*`).
  49. +
  50. * To get information about all snapshots in a registered repository, use a wildcard (`*`) or `_all`.
  51. * To get information about any snapshots that are currently running, use `_current`.
  52. +
  53. NOTE: Using `_all` in a request fails if any snapshots are unavailable.
  54. Set <<get-snapshot-api-ignore-unavailable,`ignore_unavailable`>> to `true` to return only available snapshots.
  55. [role="child_attributes"]
  56. [[get-snapshot-api-request-body]]
  57. ==== {api-request-body-title}
  58. [[get-snapshot-api-ignore-unavailable]]
  59. `ignore_unavailable`::
  60. (Optional, boolean)
  61. If `false`, the request returns an error for any snapshots that are unavailable. Defaults to `false`.
  62. +
  63. If `true`, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned.
  64. `verbose`::
  65. (Optional, boolean)
  66. If `true`, returns all available information about a snapshot. Defaults to `true`.
  67. +
  68. If `false`, omits additional information about the snapshot, such as version information, start and end times, and the number of snapshotted shards.
  69. [role="child_attributes"]
  70. [[get-snapshot-api-response-body]]
  71. ==== {api-response-body-title}
  72. `snapshot`::
  73. (string)
  74. Name of the snapshot.
  75. `uuid`::
  76. (string)
  77. Universally unique identifier (UUID) of the snapshot.
  78. `version_id`::
  79. (int)
  80. Build ID of the {es} version used to create the snapshot.
  81. `version`::
  82. (float)
  83. {es} version used to create the snapshot.
  84. `indices`::
  85. (array)
  86. List of indices included in the snapshot.
  87. `data_streams`::
  88. (array)
  89. List of <<data-streams,data streams>> included in the snapshot.
  90. `include_global_state`::
  91. (boolean)
  92. Indicates whether the current cluster state is included in the snapshot.
  93. `start_time`::
  94. (string)
  95. Date timestamp of when the snapshot creation process started.
  96. `start_time_in_millis`::
  97. (long)
  98. The time, in milliseconds, when the snapshot creation process started.
  99. `end_time`::
  100. (string)
  101. Date timestamp of when the snapshot creation process ended.
  102. `end_time_in_millis`::
  103. (long)
  104. The time, in milliseconds, when the snapshot creation process ended.
  105. `duration_in_millis`::
  106. (long)
  107. How long, in milliseconds, it took to create the snapshot.
  108. [[get-snapshot-api-response-failures]]
  109. `failures`::
  110. (array)
  111. Lists any failures that occurred when creating the snapshot.
  112. `shards`::
  113. (object)
  114. Contains a count of shards in the snapshot.
  115. +
  116. .Properties of `shards`
  117. [%collapsible%open]
  118. ====
  119. `total`::
  120. (integer)
  121. Total number of shards included in the snapshot.
  122. `successful`::
  123. (integer)
  124. Number of shards that were successfully included in the snapshot.
  125. `failed`::
  126. (integer)
  127. Number of shards that failed to be included in the snapshot.
  128. ====
  129. `state`::
  130. +
  131. --
  132. (string)
  133. The snapshot `state` can be one of the following values:
  134. .Values for `state`
  135. [%collapsible%open]
  136. ====
  137. `IN_PROGRESS`::
  138. The snapshot is currently running.
  139. `SUCCESS`::
  140. The snapshot finished and all shards were stored successfully.
  141. `FAILED`::
  142. The snapshot finished with an error and failed to store any data.
  143. `PARTIAL`::
  144. The global cluster state was stored, but data of at least one shard was not stored successfully.
  145. The <<get-snapshot-api-response-failures,`failures`>> section of the response contains more detailed information about shards
  146. that were not processed correctly.
  147. ====
  148. --
  149. [[get-snapshot-api-example]]
  150. ==== {api-examples-title}
  151. The following request returns information for `snapshot_2` in the `my_repository` repository.
  152. [source,console]
  153. ----
  154. GET /_snapshot/my_repository/snapshot_2
  155. ----
  156. The API returns the following response:
  157. [source,console-result]
  158. ----
  159. {
  160. "responses": [
  161. {
  162. "repository": "my_repository",
  163. "snapshots": [
  164. {
  165. "snapshot": "snapshot_2",
  166. "uuid": "vdRctLCxSketdKb54xw67g",
  167. "version_id": <version_id>,
  168. "version": <version>,
  169. "indices": [],
  170. "data_streams": [],
  171. "include_global_state": true,
  172. "state": "SUCCESS",
  173. "start_time": "2020-07-06T21:55:18.129Z",
  174. "start_time_in_millis": 1593093628850,
  175. "end_time": "2020-07-06T21:55:18.129Z",
  176. "end_time_in_millis": 1593094752018,
  177. "duration_in_millis": 0,
  178. "failures": [],
  179. "shards": {
  180. "total": 0,
  181. "failed": 0,
  182. "successful": 0
  183. }
  184. }
  185. ]
  186. }
  187. ]
  188. }
  189. ----
  190. // TESTRESPONSE[s/"uuid": "vdRctLCxSketdKb54xw67g"/"uuid": $body.responses.0.snapshots.0.uuid/]
  191. // TESTRESPONSE[s/"version_id": <version_id>/"version_id": $body.responses.0.snapshots.0.version_id/]
  192. // TESTRESPONSE[s/"version": <version>/"version": $body.responses.0.snapshots.0.version/]
  193. // TESTRESPONSE[s/"start_time": "2020-07-06T21:55:18.129Z"/"start_time": $body.responses.0.snapshots.0.start_time/]
  194. // TESTRESPONSE[s/"start_time_in_millis": 1593093628850/"start_time_in_millis": $body.responses.0.snapshots.0.start_time_in_millis/]
  195. // TESTRESPONSE[s/"end_time": "2020-07-06T21:55:18.129Z"/"end_time": $body.responses.0.snapshots.0.end_time/]
  196. // TESTRESPONSE[s/"end_time_in_millis": 1593094752018/"end_time_in_millis": $body.responses.0.snapshots.0.end_time_in_millis/]
  197. // TESTRESPONSE[s/"duration_in_millis": 0/"duration_in_millis": $body.responses.0.snapshots.0.duration_in_millis/]