21.11.6 Deleting Individual Snapshot Policy

You can retrieve the snapshots using command curl -X GET " http://{elastic_ip}:9200/_snapshot/as_repo/_all?pretty". The output similar to the following is displayed:

{
  "snapshots": [
    {
      "snapshot": "snapshot_2",
      "uuid": "vdRctLCxSketdKb54xw67g",
      "version_id": <version_id>,
      "version": <version>,
      "indices": [],
      "data_streams": [],
      "include_global_state": true,
      "state": "SUCCESS",
      "start_time": "2020-07-06T21:55:18.129Z",
      "start_time_in_millis": 1593093628850,
      "end_time": "2020-07-06T21:55:18.876Z",
      "end_time_in_millis": 1593094752018,
      "duration_in_millis": 0,
      "failures": [],
      "shards": {
        "total": 0,
        "failed": 0,
        "successful": 0
      }
    }
  ]
}

You can get the snapshot name using the command curl -X GET " http://{elastic_ip}:9200/_snapshot/as_repo/_all?pretty" and use it to DELETE API curl -X DELETE " http://{elastic_ip}:9200/_snapshot/as_repo/ <SNAPSHOT_NAME>?pretty". When a snapshot is deleted from a repository, Elasticsearch deletes all files associated with the snapshot that are not in use by other snapshots. If the delete snapshot operation starts while the snapshot is being created, the snapshot process stops and all files created as part of this process are removed. Use the delete snapshot API to cancel long running snapshot operations that might have been started by mistake.

To delete multiple snapshots from a repository, separate snapshot names by commas use, curl -X DELETE " http://{elastic_ip}:9200/_snapshot/as_repo/snapshot_2,snapshot_3?pretty".