Skip to content

Instantly share code, notes, and snippets.

@benoitjpnet
Created February 13, 2014 14:03
Show Gist options
  • Save benoitjpnet/8975529 to your computer and use it in GitHub Desktop.
Save benoitjpnet/8975529 to your computer and use it in GitHub Desktop.
# Yout need to register a repository.
# This action need to be only done one time.
# $ curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{
# "type": "fs",
# "settings": {
# "location": "/home/backup/elasticsearch",
# "compress": true
# }
# }'
date=$(date +%Y%m%d%H%M)
# Take a snapshot
curl -XPUT "localhost:9200/_snapshot/backup/snapshot_${date}?wait_for_completion=true"
# To restore: List snapshots, close all indexes & restore one snapshot.
# curl -XGET "localhost:9200/_snapshot/backup/_all?pretty=true"
# curl -XPOST "localhost:9200/_all/_close"
# curl -XPOST "localhost:9200/_snapshot/backup/snapshot_DATE/_restore?wait_for_completion=true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment