snapshots.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. [[cat-snapshots]]
  2. === cat snapshots API
  3. ++++
  4. <titleabbrev>cat snapshots</titleabbrev>
  5. ++++
  6. [IMPORTANT]
  7. ====
  8. cat APIs are only intended for human consumption using the command line or {kib}
  9. console. They are _not_ intended for use by applications. For application
  10. consumption, use the <<get-snapshot-api,get snapshot API>>.
  11. ====
  12. Returns information about the <<snapshot-restore,snapshots>> stored in one or
  13. more repositories. A snapshot is a backup of an index or running {es} cluster.
  14. [[cat-snapshots-api-request]]
  15. ==== {api-request-title}
  16. `GET /_cat/snapshots/<repository>`
  17. `GET /_cat/snapshots`
  18. [[cat-snapshots-api-prereqs]]
  19. ==== {api-prereq-title}
  20. * If the {es} {security-features} are enabled, you must have the
  21. `monitor_snapshot`, `create_snapshot`, or `manage`
  22. <<privileges-list-cluster,cluster privilege>> to use this API.
  23. [[cat-snapshots-path-params]]
  24. ==== {api-path-parms-title}
  25. `<repository>`::
  26. +
  27. --
  28. (Optional, string) Comma-separated list of snapshot repositories used to limit
  29. the request. Accepts wildcard expressions. `_all` returns all repositories.
  30. If any repository fails during the request, {es} returns an error.
  31. --
  32. [[cat-snapshots-query-params]]
  33. ==== {api-query-parms-title}
  34. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  35. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  36. +
  37. --
  38. If you do not specify which columns to include, the API returns the default
  39. columns in the order listed below. If you explicitly specify one or more
  40. columns, it only returns the specified columns.
  41. Valid columns are:
  42. `id`, `snapshot`::
  43. (Default) ID of the snapshot, such as `snap1`.
  44. `repository`, `re`, `repo`::
  45. (Default) Name of the repository, such as `repo1`.
  46. `status`, `s`::
  47. (Default) State of the snapshot process. Returned values are:
  48. +
  49. * `FAILED`: The snapshot process failed.
  50. * `INCOMPATIBLE`: The snapshot process is incompatible with the current cluster
  51. version.
  52. * `IN_PROGRESS`: The snapshot process started but has not completed.
  53. * `PARTIAL`: The snapshot process completed with a partial success.
  54. * `SUCCESS`: The snapshot process completed with a full success.
  55. `start_epoch`, `ste`, `startEpoch`::
  56. (Default) {wikipedia}/Unix_time[Unix `epoch` time] at which
  57. the snapshot process started.
  58. `start_time`, `sti`, `startTime`::
  59. (Default) `HH:MM:SS` time at which the snapshot process started.
  60. `end_epoch`, `ete`, `endEpoch`::
  61. (Default) {wikipedia}/Unix_time[Unix `epoch` time] at which
  62. the snapshot process ended.
  63. `end_time`, `eti`, `endTime`::
  64. (Default) `HH:MM:SS` time at which the snapshot process ended.
  65. `duration`, `dur`::
  66. (Default) Time it took the snapshot process to complete in <<time-units,time
  67. units>>.
  68. `indices`, `i`::
  69. (Default) Number of indices in the snapshot.
  70. `successful_shards`, `ss`::
  71. (Default) Number of successful shards in the snapshot.
  72. `failed_shards`, `fs`::
  73. (Default) Number of failed shards in the snapshot.
  74. `total_shards`, `ts`::
  75. (Default) Total number of shards in the snapshot.
  76. `reason`, `r`::
  77. Reason for any snapshot failures.
  78. --
  79. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
  80. `ignore_unavailable`::
  81. (Optional, Boolean) If `true`, the response does not include information from
  82. unavailable snapshots. Defaults to `false`.
  83. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  84. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  85. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=time]
  86. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  87. [[cat-snapshots-api-example]]
  88. ==== {api-examples-title}
  89. [source,console]
  90. --------------------------------------------------
  91. GET /_cat/snapshots/repo1?v=true&s=id
  92. --------------------------------------------------
  93. // TEST[s/^/PUT \/_snapshot\/repo1\/snap1?wait_for_completion=true\n/]
  94. // TEST[s/^/PUT \/_snapshot\/repo1\/snap2?wait_for_completion=true\n/]
  95. // TEST[s/^/PUT \/_snapshot\/repo1\n{"type": "fs", "settings": {"location": "repo\/1"}}\n/]
  96. The API returns the following response:
  97. [source,txt]
  98. --------------------------------------------------
  99. id repository status start_epoch start_time end_epoch end_time duration indices successful_shards failed_shards total_shards
  100. snap1 repo1 FAILED 1445616705 18:11:45 1445616978 18:16:18 4.6m 1 4 1 5
  101. snap2 repo1 SUCCESS 1445634298 23:04:58 1445634672 23:11:12 6.2m 2 10 0 10
  102. --------------------------------------------------
  103. // TESTRESPONSE[s/FAILED/SUCCESS/ s/14456\d+/\\d+/ s/\d+(\.\d+)?(m|s|ms)/\\d+(\\.\\d+)?(m|s|ms)/]
  104. // TESTRESPONSE[s/\d+:\d+:\d+/\\d+:\\d+:\\d+/]
  105. // TESTRESPONSE[s/1 4 1 5/\\d+ \\d+ \\d+ \\d+/]
  106. // TESTRESPONSE[s/2 10 0 10/\\d+ \\d+ \\d+ \\d+/]
  107. // TESTRESPONSE[non_json]