# How can we take import index in elasticsearch to export in new Index of elasticsearch...?

**URL:** <https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687>\
**Category:** Elasticsearch\
**Created:** [July 10, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687 "2020-07-10T11:17:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![navdeepk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navdeepk/32/58687_2.png) [@navdeepk](https://discuss.elastic.co/u/navdeepk)\
**Post date:** [July 10, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687/1 "2020-07-10T11:17:29Z")

</div>

Actually, I have to take backup of index to export in new elasticsearch....

---

<div class="post-metadata">

**Author:** ![defalt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/defalt/32/71379_2.png) [@defalt](https://discuss.elastic.co/u/defalt)\
**Post date:** [July 10, 2020, 11:33am UTC](https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687/2 "2020-07-10T11:33:19Z")

</div>

Did I understand you correctly: You want to copy an index into a new index?

---

<div class="post-metadata">

**Author:** ![navdeepk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navdeepk/32/58687_2.png) [@navdeepk](https://discuss.elastic.co/u/navdeepk)\
**Post date:** [July 11, 2020, 5:41am UTC](https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687/3 "2020-07-11T05:41:58Z")

</div>

I want to restore/backup elasticsearch indices.....Trying with snapshot....But dont understand where snapshot is located and where this code has to be executed...

PUT /\_snapshot/my\_backup  
{  
"type": "fs",  
"settings": {  
"location": "my\_backup\_location"  
}  
}

What I have done so far is create a direcotry(backup) in elasticsearch and run these comaands

mkdir -p /etc/elasticsearch/backup  
chown -R elasticsearch /etc/elasticsearch/backup  
sudo apt-get install curl  
#add the required path.repo to elasticsearch yaml file  
cat \>\> /etc/elasticsearch/elasticsearch.yml \<\< EOF  
path.repo: ["/etc/elasticsearch/backup"]  
EOF

we are refering from this

> **[How to create and restore an elasticsearch index using a bash script](https://medium.com/@ebaneckatuh/how-to-create-and-restore-an-elasticsearch-index-using-a-bash-script-1ff1e66f0e8f)**
>
> In a minute!!

---

<div class="post-metadata">

**Author:** ![defalt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/defalt/32/71379_2.png) [@defalt](https://discuss.elastic.co/u/defalt)\
**Post date:** [July 13, 2020, 7:03am UTC](https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687/4 "2020-07-13T07:03:54Z")

</div>

Are you using a single node or a cluster? If you have a cluster you have to set the `path.repo` on all nodes. After that you register a repository with the api you posted above. Then you can take a snapshot and it will be stored in your registered repository in the path.repo which you set.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 10, 2020, 7:03am UTC](https://discuss.elastic.co/t/how-can-we-take-import-index-in-elasticsearch-to-export-in-new-index-of-elasticsearch/240687/5 "2020-08-10T07:03:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
