clean-up-repo-api.asciidoc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. [[clean-up-snapshot-repo-api]]
  2. === Clean up snapshot repository API
  3. ++++
  4. <titleabbrev>Clean up snapshot repository</titleabbrev>
  5. ++++
  6. Triggers the review of a snapshot repository's contents and deletes any stale
  7. data that is not referenced by existing snapshots. See
  8. <<snapshots-repository-cleanup>>.
  9. ////
  10. [source,console]
  11. -----------------------------------
  12. PUT /_snapshot/my_repository
  13. {
  14. "type": "fs",
  15. "settings": {
  16. "location": "my_backup_location"
  17. }
  18. }
  19. -----------------------------------
  20. // TESTSETUP
  21. ////
  22. [source,console]
  23. ----
  24. POST /_snapshot/my_repository/_cleanup
  25. ----
  26. [[clean-up-snapshot-repo-api-request]]
  27. ==== {api-request-title}
  28. `POST /_snapshot/<repository>/_cleanup`
  29. [[clean-up-snapshot-repo-api-prereqs]]
  30. ==== {api-prereq-title}
  31. * If the {es} {security-features} are enabled, you must have the `manage`
  32. <<privileges-list-cluster,cluster privilege>> to use this API.
  33. [[clean-up-snapshot-repo-api-path-params]]
  34. ==== {api-path-parms-title}
  35. `<repository>`::
  36. (Required, string)
  37. Name of the snapshot repository to review and clean up.
  38. [[clean-up-snapshot-repo-api-query-params]]
  39. ==== {api-query-parms-title}
  40. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  41. [role="child_attributes"]
  42. [[clean-up-snapshot-repo-api-response-body]]
  43. ==== {api-response-body-title}
  44. `results`::
  45. (object)
  46. Contains statistics for cleanup operations.
  47. +
  48. .Properties of `results`
  49. [%collapsible%open]
  50. ====
  51. `deleted_bytes`::
  52. (integer)
  53. Number of bytes freed by cleanup operations.
  54. `deleted_blobs`::
  55. (integer)
  56. Number of binary large objects (blobs) removed from the snapshot repository
  57. during cleanup operations. Any non-zero value implies that unreferenced blobs
  58. were found and subsequently cleaned up.
  59. ====
  60. [[clean-up-snapshot-repo-api-example]]
  61. ==== {api-examples-title}
  62. [source,console]
  63. ----
  64. POST /_snapshot/my_repository/_cleanup
  65. ----
  66. The API returns the following response:
  67. [source,console-result]
  68. ----
  69. {
  70. "results": {
  71. "deleted_bytes": 20,
  72. "deleted_blobs": 5
  73. }
  74. }
  75. ----
  76. // TEST[s/"deleted_bytes": 20/"deleted_bytes": 0/]
  77. // TEST[s/"deleted_blobs": 5/"deleted_blobs": 0/]
  78. ////
  79. [source,console]
  80. ----
  81. DELETE /_snapshot/my_repository
  82. ----
  83. ////