DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 964,423 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Migrate elastic search indices
Anvar Nazar
Anvar Nazar

Posted on

Migrate elastic search indices

So you want to migrate Elasticsearch indices from one installation to another. The solution presented here will need Node.js and the package elasticdump from NPM. You will need to set up these on a system from which you want to do the migrations. Let's start.

First make sure Node.js is installed.

Then install elasticdump by running the command.

npm i elasticdump -g

Note: This -g will install elasticdump globally. If you got a permission error run with sudo

Now we can use this package to move an index from one es to another.

elasticdump \
  --input=http://i1.es.in:9200/index_1 \
  --output=http://i2.es.in:9200/index_1 \
  --type=mapping
Enter fullscreen mode Exit fullscreen mode

--input= arg is the es source instance where you want to move the index from

--output= is the destinaation es

--type= has three options

  1. mapping if you only want to move index mapping
  2. data if you want to migrate data
  3. analyzer includes analyzer and mapping

Do this query to list all indices on an elastic instance
GET _cat/indices?v

Top comments (2)

Collapse
 
biotechsastri profile image
sastri

Does this work in migration from Elastic to OpenSearch?

Collapse
 
anvarnazar profile image
Anvar Nazar Author • Edited on

Yes. I have done that before.

๐ŸŒš Life is too short to browse without dark mode