# Extract Elasticsearch data

**URL:** <https://discuss.elastic.co/t/extract-elasticsearch-data/368097>\
**Category:** Elasticsearch\
**Created:** [October 1, 2024, 2:30pm UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097 "2024-10-01T14:30:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [October 1, 2024, 2:30pm UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/1 "2024-10-01T14:30:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 2, 2024, 5:34am UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/2 "2024-10-02T05:34:07Z")

</div>

Which version of Elastiicsearch are you using?

Have you looked at the [snapshot and restore API](https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshot-restore.html)?

> [@dsagent](#):
>
> But I tried that and it didn't work

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

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [October 2, 2024, 6:06am UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/3 "2024-10-02T06:06:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 2, 2024, 6:11am UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/4 "2024-10-02T06:11:54Z")

</div>

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](https://github.com/elasticsearch-dump/elasticsearch-dump) (third party tool).

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [October 2, 2024, 6:20am UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/5 "2024-10-02T06:20:17Z")

</div>

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.....

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 2, 2024, 6:54am UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/6 "2024-10-02T06:54:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [October 2, 2024, 7:11am UTC](https://discuss.elastic.co/t/extract-elasticsearch-data/368097/7 "2024-10-02T07:11:13Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> Restore snapshot to the new cluster

Ok  
Thank you
