How to migrate Elasticsearch/OpenSearch index data easily from one server to another

Kavish Baghel
2 min readDec 10, 2023

Recently, I got a requirement at work to migrate index data from one OpenSearch domain in an AWS account A to another OpenSearch domain present in another. I started looking for methods for accomplishing the same and found this tool named Elasticdump.

I found it super easy to use and it did the work easily for me. In this guide, I will share how I migrated the data of the indexes easily using Elasticdump.

My use case was a simple one. I had an OpenSearch domain setup in AWS account A which contained the data in the indexes and these indexes along with their data were to be copied to another OpenSearch domain in another AWS account B.

Install elasticdump easily with npm using the following command -

#To install elasticdump locally use the below command 

npm install elasticdump
#To install elasticdump globally use the below command

npm install elasticdump -g

Now we have installed elasticdump let’s move forward to migrate the data from one domain to another -

You can review/verify the data in your Elasticsearch/OpenSearch server using the following -

curl -XGET <endpoint-of-your-elasticsearch-server>/<your_index_name>

The following script will transfer all the data of your elasticsearch/opensearch index with the analyzer and mapping.

SOURCE_ES=source-es.example.com
DESTINATION_ES=destination-es.example.com
INDEX_NAME=my_index

elasticdump \
--input=$SOURCE_ES/$INDEX_NAME \
--output=$DESTINATION_ES/$INDEX_NAME \
--type=analyzer
elasticdump \
--input=$SOURCE_ES/$INDEX_NAME \
--output=$DESTINATION_ES/$INDEX_NAME \
--type=mapping
elasticdump \
--input=$SOURCE_ES/$INDEX_NAME \
--output=$DESTINATION_ES/$INDEX_NAME \
--type=data
echo "Index Data Transfer completed"

You can explore more functionalities of Elasticdump on their Github — https://github.com/elasticsearch-dump/elasticsearch-dump

--

--

Building, deploying, securing, and managing applications in the cloud with a DevSecOps mindset.