clean-up-repo-api.asciidoc 2.3 KB

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