Extract Elasticsearch data

I have data in Elasticsearch and I want to back up and after doing the backup restore it in another Elasticsearch
I do this to avoid problems that can occur similarly:
Unintentionally delete data
Or the failure of Elasticsearch
I will have a backup copy to repair a new elastic and restore the data

But I tried that and it didn't work
What is the solution to this?

Which version of Elastiicsearch are you using?

Have you looked at the snapshot and restore API?

You need to show exactly what you tried and provide details about exactly what went wrong and which error messages you saw.

Version 8.15.1

Yes, I did a snapshot, but it did not do the job, I want to export the data to an external file so that I can transfer it and run it in another device

There are no specific errors, I did it correctly, but the problem is that I want to take the Snapshot file, run it and restore it to another device

Once you have creted the snapshot you should be able to tar up the complete directory and move it to a different location before you untar and mount it on the new cluster and restore it.

It would be even easier if you create the snapshot on cloud storage, e.g. S3, and just connect the clusters to this.

If you want to export the documents and then reindex them into the new cluster I believe you will need to create a custom script or possibly use a tool like Logstash or elasticdump (third party tool).

1 Like

I got it.
Can you guide me with the steps to transfer the snapshot to a new cluster, knowing that the new group is in another device
For example:
1 Snapshot in the current cluster
2 Compress the resulting file.....

I have not done this in a few years but if I remember correctly I did the following:

  1. Create a and register a snapshot on a shared file system
  2. Create a snapshot and ensure this completes successfully
  3. tar and gz the whole directory so you can restore this in it's exact form somewhere else
  4. Move it to shared storage that can be reached by the second cluster
  5. Unzip and untar the full directory
  6. Register this location as a read-only snapshot repository in the new cluster (ensure path.repo is set correctly)
  7. Restore snapshot to the new cluster
1 Like

Ok
Thank you