get-snapshot-api.asciidoc 6.7 KB

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