nisham22
10/19/2017 - 9:26 AM

Snapshot

Creating repository

curl -XPUT http://localhost:9200/_snapshot/test_backup -d '{
     "type": "fs",
     "settings": {
       "compress" : true,
       "location": "/elastic/factweavers/esbackup" 
     }
}'
curl -XPUT http://localhost:9200/_snapshot/s3backup?pretty=true -d '{
  "type":"s3",
  "settings":{  
   "bucket":"bucket_name",
   "region": "us-east-1",
   "access_key": "A$CESSKEY4S3TYPE",
   "secret_key": "7BdwdsECREtkEYisSOGiVENSrEz"
    }
}'

Taking Snapshot

Backup cluster
curl -XPUT http://localhost:9200/_snapshot/test_backup/snapshot_name?wait_for_completion=true
Indices in cluster
curl -XPUT http://localhost:9200/_snapshot/test_backup/snapshot_name -d '{
     "indices": "index-1,index-2",
     "ignore_unavailable": true,
     "include_global_state": false
}'

Restoring the Snapshot

Cluster Restore
curl -XPOST http://localhost:9200/_snapshot/test_backup/snapshot_name/_restore
indices in cluster
curl -XPOST http://localhost:9200/_snapshot/test_backup/snapshot_name/_restore -d '{
     "indices": "index_1,index_2",
     "ignore_unavailable": true,
     "include_global_state": true,
}'

Get All Repository

curl -XGET http://localhost:9200/_snapshot/test_backup/_all?pretty=true

Get Snapshot Names

curl -XGET http://localhost:9200/_snapshot/s3backup/_all?pretty=true | jq '.snapshots[] | .snapshot'