I want to take snapshot of an index present in my local, and save the snapshot at some remote location i.e. another machine. How can I use elastic search snapshot functionality for this?
Asked
Active
Viewed 1,707 times
3
-
I don't understand your question. Have you checked out the documentation about snapshot and restore? Is it something you already tried from there? – Andrei Stefan Nov 13 '14 at 10:04
-
I have already checked the documentation and taking snapshot at my local machine worked fine. But the scenario that I am trying is I have two machines, on both machines I have elastic search up. Now I want to take snapshot of an index which is present in my local machine and store that snapshot in a folder of another machine. – user3876291 Nov 13 '14 at 10:08
1 Answers
-1
On the machine where you want to transfer your snapshot, define a snapshot repository just like you did for the machine where you took the snapshot. For example:
$ curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/mount/restore/my_backup",
"compress": true
}
}'
Assuming that your snapshot was something like the following:
PUT /_snapshot/my_backup/my_first_snapshot
Copy everything from the snapshot directory on the source machine to the /mount/restore/my_backup
on the destination machine. And then POST /_snapshot/my_backup/my_first_snapshot/_restore
. This is, also, in the documentation.
UPDATE: as per @EricLandry's comment, it seems there is a way: url
type repository. I haven't tested it, but it looks promising after the description.

Andrei Stefan
- 51,654
- 6
- 98
- 89
-
Thank u for the reply, but i want to do this task on the fly. I do not want to copy the data from my local to the remote machine manually. I want this task to be accomplished as a PUT request. Is it possible? – user3876291 Nov 14 '14 at 07:49
-
1No, that's not possible. There is no automatic copying feature. You need to copy the files manually. – Andrei Stefan Nov 14 '14 at 08:07
-
1https://www.elastic.co/guide/en/elasticsearch/reference/1.6/modules-snapshots.html#_read_only_url_repository – Eric Landry Jul 14 '15 at 14:00
-
Did you ever figure out how to achieve this? Was it with the Read-only URL Repository listed in the link above by Eric? – susieloo_ Sep 26 '16 at 20:53
-
An HTTP migration is possible using the _bulk API via a tool like [esm](https://github.com/medcl/esm). – Marc Feb 07 '23 at 09:11