How to get file names of my Snapshot using curl?

Hi Elasticsearch Team! Just wondering if we do have a command to get the list of our snapshot file names using curl?

Scenario:

  1. I used the step provided for snapshot and restore " Restore a snapshot | Elasticsearch Guide [8.3] | Elastic"
  2. Now, on step 7 where I can now restore my Snapshot, I don't have a copy of my snapshot because one of the requirement is to stop and delete everything from Elasticsearch, so I can't see my Snapshot file name on Kibana API because its down, so in order to proceed from step 7 I need the filename of my snapshot.
    Here is the command to run restore(provided on the documentation)
POST _snapshot/my_repository/my_snapshot_2099.05.06/_restore
{
  "indices": "*",
  "include_global_state": true
}

Question: Is it possible to get the list of all snapshot filename?

Thanks Everyone!

Hi @wonderland14 ,

Question: Is it possible to get the list of all snapshot filename?

A couple of options here:

  1. If you have been using SLM (Snapshot Lifecycle Management), you can use the Get snapshot lifecycle policy API. For example:
  • GET _slm/policy and retrieve the snapshot_name in the last_success section.
  1. You can also use the cat snapshots API. For example:
  • GET _cat/snapshots?v and look for the last SUCCESSFUL snapshot.

Let us know if that helps.

Thank You!! @ropc , I finally get the Snapshot file name using the GET _slm/policy :slight_smile:

{"TestPolicy":{"version":2,"modified_date_millis":1659715231600,"policy":{"name":"snapshot_test","schedule":"0 30 1 * * ?","repository":"Repository_Test","config":{}},"last_success":{"snapshot_name":"snapshot_test-ybe5v0aqq_slurpcnjhebq","start_time":1659835799954,"time":1659835818802},"next_execution_millis":1659922200000,"stats":{"policy":"TestPolicy","snapshots_taken":12,"snapshots_failed":0,"snapshots_deleted":0,"snapshot_deletion_failures":0}}}
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.