How to Backup and Restore with Elasticsearch

The snapshot and restore module allows to create snapshots of individual indices or an entire cluster into a remote repository like shared file system, S3, or HDFS.

The full detailed documentation is here.


Check if the config files have « path.repo »:

$ nano /etc/elasticsearch/elasticsearch.yml


Create snapshot with this command:

PUT /_snapshot/backup
  "type": "fs",
  "settings": {
      "compress": true,
      "location": "/usr/share/elasticsearch/backup"

This command show snapshot path:

GET /_snaptshot/


 Initiate the backup with this command based on the snapshot:

PUT /_snapshot/backup/snapshot_1
  "indices": "recipes",
  "ignore_unavailable": true,
  "include_global_state": false

To show the status of the snapshot:

 GET /_snapshot/backup/snapshot_1

The files created:


Create also the same snapshot path:

Execute this type of command to restore:

 POST /_snapshot/my_backup/snapshot_1/_restore


How to delete a snaptshot:

$ delete /_snapshot/backup/snapshot_1