Skip to content

Instantly share code, notes, and snippets.

@greglboxer
Last active April 19, 2016 19:46
Show Gist options
  • Save greglboxer/6f72ca52dea2bf03eec6630993e0423f to your computer and use it in GitHub Desktop.
Save greglboxer/6f72ca52dea2bf03eec6630993e0423f to your computer and use it in GitHub Desktop.

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

To Create a Repostitory Referencing an S3 Bucket

PUT https://<elastic-search-host>:9200/_snapshot/s3-backup
 {
     "type": "s3",
     "settings": {
         "bucket": "<s3 bucket name>",
         "region": "us-east-1",
         "access_key": "<aws access key>",
         "secret_key": "<aws secret key>"
     }
 }

To Create a Snapshot

https://www.elastic.co/guide/en/elasticsearch/client/curator/current/snapshot.html

docker run --rm bobrik/curator:3.4.0 --host <elastic-search host> --port 9200 --use_ssl --ssl-no-validate snapshot --repository s3-backup indices --older-than 1 --time-unit days --timestring '%Y.%m.%d'

To list all snapshots: https://<elastic-search-host>:9200/_snapshot/s3-backup/_all
To retrieve a snapshot status: https://<elastic-search-host>:9200/_snapshot/s3-backup/<snapshot name>/_status

To Restore a Snapshot

POST https://<elastic-search-host>:9200/_snapshot/s3-backup/<snapshot name>/_restore
{
  "indices": "<index name>, <index name>",
  "ignore_unavailable": "true",
  "include_global_state": false,
  "rename_pattern": "logstash-(.+)",
  "rename_replacement": "restored-logstash-$1"
}

Curator Documentation

https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment