Dud
Dud

Reputation: 95

Elasticsearch delete multiple snapshots

I am trying to delete multiple snapshots, tried to separate them with a comma, but it didn't work. The documentation doesn't seem to talk about this. I also can't seem to be able to see the deletion in progress if I query the status api, is there a way to see the status of a snapshot deletion?

Edit: Using ES 1.7

Upvotes: 4

Views: 3035

Answers (2)

Ankit Garg
Ankit Garg

Reputation: 556

@tudalex, AS of ES 6.3 you cannot delete multiple snapshots at a time. If you try to delete another snapshot while you previous snapshot is getting deleted, you will get the following error:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "concurrent_snapshot_execution_exception",
        "reason" : "[snapshotXX] another snapshot is currently running cannot delete"
      }
    ],
    "type" : "concurrent_snapshot_execution_exception",
    "reason" : "[snapshotXX] another snapshot is currently running cannot delete"
  },
  "Status. 503.
}

You can keep a retry mechanism which can poll ES for any snapshot deletion task, if no snapshot deletion task is running, you can initiate deletion of the next snapshot. You can do something like below:

curator.DeleteSnapshots(snapshot_list, retry_interval=30, retry_count=5).do_action() except (curator.exceptions.SnapshotInProgress, curator.exceptions.NoSnapshots, curator.exceptions.FailedExecution) as e: print(e)

The above code [3] retries deleting the snapshot every 30 seconds and will retry upto 5 times incase it is unable to delete snapshot in the previous attempt.

Upvotes: 2

João Costa
João Costa

Reputation: 66

As of ES 6.1.0, you can't check the deletion progress of a snapshot.

However, you can use the /_cat/tasks and look for tasks with snapshot/delete to check if the snapshot is being deleted.

Upvotes: 3

Related Questions