clean-up-repo-api.asciidoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.
  8. ////
  9. [source,console]
  10. -----------------------------------
  11. PUT /_snapshot/my_repository
  12. {
  13. "type": "fs",
  14. "settings": {
  15. "location": "my_backup_location"
  16. }
  17. }
  18. -----------------------------------
  19. // TESTSETUP
  20. ////
  21. [source,console]
  22. ----
  23. POST /_snapshot/my_repository/_cleanup
  24. ----
  25. [[clean-up-snapshot-repo-api-request]]
  26. ==== {api-request-title}
  27. `POST /_snapshot/<repository>/_cleanup`
  28. [[clean-up-snapshot-repo-api-desc]]
  29. ==== {api-description-title}
  30. Over time, snapshot repositories can accumulate stale data that is no longer
  31. referenced by existing snapshots.
  32. While this unreferenced data does not negatively impact the performance or
  33. safety of a snapshot repository, it can lead to more storage use than necessary.
  34. You can use the clean up snapshot repository API to detect and delete this
  35. unreferenced data.
  36. [TIP]
  37. ====
  38. Most cleanup operations performed by this API are performed automatically when
  39. a snapshot is deleted from a repository.
  40. If you regularly delete snapshots, calling this API may only reduce your storage
  41. slightly or not at all.
  42. ====
  43. [[clean-up-snapshot-repo-api-path-params]]
  44. ==== {api-path-parms-title}
  45. `<repository>`::
  46. (Required, string)
  47. Name of the snapshot repository to review and clean up.
  48. [[clean-up-snapshot-repo-api-query-params]]
  49. ==== {api-query-parms-title}
  50. include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  51. [role="child_attributes"]
  52. [[clean-up-snapshot-repo-api-response-body]]
  53. ==== {api-response-body-title}
  54. `results`::
  55. (object)
  56. Contains statistics for cleanup operations.
  57. +
  58. .Properties of `results`
  59. [%collapsible%open]
  60. ====
  61. `deleted_bytes`::
  62. (integer)
  63. Number of bytes freed by cleanup operations.
  64. `deleted_blobs`::
  65. (integer)
  66. Number of binary large objects (blobs) removed from the snapshot repository
  67. during cleanup operations. Any non-zero value implies that unreferenced blobs
  68. were found and subsequently cleaned up.
  69. ====
  70. [[clean-up-snapshot-repo-api-example]]
  71. ==== {api-examples-title}
  72. [source,console]
  73. ----
  74. POST /_snapshot/my_repository/_cleanup
  75. ----
  76. The API returns the following response:
  77. [source,console-result]
  78. ----
  79. {
  80. "results": {
  81. "deleted_bytes": 20,
  82. "deleted_blobs": 5
  83. }
  84. }
  85. ----
  86. // TEST[s/"deleted_bytes": 20/"deleted_bytes": 0/]
  87. // TEST[s/"deleted_blobs": 5/"deleted_blobs": 0/]
  88. ////
  89. [source,console]
  90. ----
  91. DELETE /_snapshot/my_repository
  92. ----
  93. ////