Skip to content

Instantly share code, notes, and snippets.

@denzhel
Last active April 14, 2022 18:27
Show Gist options
  • Select an option

  • Save denzhel/0213745b3984ed29ce606668ea3770a2 to your computer and use it in GitHub Desktop.

Select an option

Save denzhel/0213745b3984ed29ce606668ea3770a2 to your computer and use it in GitHub Desktop.
elasticsearch snapshot commands

Use the following command to configure a S3 repository to restore snapshot from:

curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_snapshot/s3-backup?pretty' -d'
{
 "type" : "s3",
 "settings" : {
 "bucket" : "<bucketName>",
 "region": "us-west-1",
 "base_path" : "<someDirectory>" <=== This can be omitted if snapshots are located at root
 }
 }'

Use the following to list all snapshots in the configured repository:

curl -X GET "localhost:9200/_snapshot/s3-backup/_all/?pretty"

Use the following to restore a certain snapshot:

curl -X POST http://localhost:9200/_snapshot/s3-backup/<snapshotName>/_restore?pretty=true

Use the following to delete a snapshot from the repository:

curl -X DELETE "localhost:9200/_snapshot/s3-backup/<snapshotName>?pretty"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment