delete-snapshot-api.asciidoc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [[delete-snapshot-api]]
  2. === Delete snapshot API
  3. ++++
  4. <titleabbrev>Delete snapshot</titleabbrev>
  5. ++++
  6. Deletes a <<snapshot-restore,snapshot>>.
  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. PUT /_snapshot/my_repository/snapshot_3?wait_for_completion=true
  20. ----
  21. // TESTSETUP
  22. ////
  23. [source,console]
  24. -----------------------------------
  25. DELETE /_snapshot/my_repository/my_snapshot
  26. -----------------------------------
  27. [[delete-snapshot-api-request]]
  28. ==== {api-request-title}
  29. `DELETE /_snapshot/<repository>/<snapshot>`
  30. [[delete-snapshot-api-desc]]
  31. ==== {api-description-title}
  32. Use the delete snapshot API to delete a <<snapshot-restore,snapshot>>, which is a backup taken from a running {es} cluster.
  33. When deleting a snapshot from a repository, {es} deletes all files that are associated with the snapshot and not used by any other snapshots. All files that are shared with at least one other existing snapshot are left intact.
  34. If you attempt to delete a snapshot while it is being created, the snapshot process aborts and all associated will be deleted.
  35. To delete multiple snapshots in a single request, separate the snapshot names with a comma or use a wildcard (`*`).
  36. TIP: Use the delete snapshot API to cancel long-running snapshot operations that were started by mistake.
  37. [[delete-snapshot-api-path-params]]
  38. ==== {api-path-parms-title}
  39. `<repository>`::
  40. (Required, string)
  41. Name of the repository to delete a snapshot from.
  42. `<snapshot>`::
  43. (Required, string)
  44. Comma-separated list of snapshot names to delete. Also accepts wildcards (`*`).
  45. [[delete-snapshot-api-example]]
  46. ==== {api-example-title}
  47. The following request deletes `snapshot_2` and `snapshot_3` from the repository named `my_repository`.
  48. [source,console]
  49. ----
  50. DELETE /_snapshot/my_repository/snapshot_2,snapshot_3
  51. ----
  52. The API returns the following response:
  53. [source,console-result]
  54. ----
  55. {
  56. "acknowledged" : true
  57. }
  58. ----