Databases 11 min read

Avoid Pitfalls: Hands‑On Elasticdump Migration from Elasticsearch to Easysearch

This guide walks through using the open‑source Elasticdump tool to migrate an Elasticsearch index—including mapping, settings, and data—to Easysearch, covering environment setup, SSL handling, step‑by‑step commands, verification methods, common errors, and performance‑tuning tips.

Mingyi World Elasticsearch
Mingyi World Elasticsearch
Mingyi World Elasticsearch
Avoid Pitfalls: Hands‑On Elasticdump Migration from Elasticsearch to Easysearch

Background

In many projects it is necessary to move data from an Elasticsearch cluster to Easysearch or another compatible search engine.

Tool Overview

What is Elasticdump?

Elasticdump is a command‑line utility for exporting and importing Elasticsearch indices. It supports migration of mapping, settings, data, HTTPS, authentication, and bulk transfer.

Migration Content

Mapping : field types and index structure.

Settings : shard count, replica count, and other index configurations.

Data : the actual documents.

Environment Preparation

Install Node.js

# Download and install from https://nodejs.org/

Install Elasticdump

npm install -g elasticdump

Confirm Connection Details

Source (Elasticsearch): https://<em>external‑IP</em>:9200 with user elastic and password changeme, using HTTPS.

Target (Easysearch): http://127.0.0.1:9200 (local deployment, HTTP).

Index to migrate: product-index.

Migration Steps

1. Handle SSL Certificate

Because the source uses a self‑signed certificate, disable verification temporarily.

# Windows
set NODE_TLS_REJECT_UNAUTHORIZED=0
# Linux/macOS
export NODE_TLS_REJECT_UNAUTHORIZED=0
Note: This setting is for development/testing only; production should use a valid certificate.

2. Migrate Mapping

elasticdump \
  --input=https://elastic:changeme@<em>external‑IP</em>:9200/product-index \
  --output=http://127.0.0.1:9200/product-index \
  --type=mapping

Parameters: --input: source URL with authentication. --output: target URL. --type=mapping: specifies mapping migration.

3. Migrate Settings

elasticdump \
  --input=https://elastic:changeme@<em>external‑IP</em>:9200/product-index \
  --output=http://127.0.0.1:9200/product-index \
  --type=settings

Some settings (e.g., number_of_shards) cannot be changed after index creation; warnings are normal.

4. Migrate Data

elasticdump \
  --input=https://elastic:changeme@<em>external‑IP</em>:9200/product-index \
  --output=http://127.0.0.1:9200/product-index \
  --type=data \
  --limit=5000

Parameters: --type=data: migrate document data. --limit=5000: transfer 5,000 documents per batch (adjustable).

5. Performance Tips

For small datasets use --limit between 1,000‑5,000.

For large datasets increase to 5,000‑10,000.

Enable parallel transfer with --concurrency=3.

Optional: Use CA Certificate

If you prefer not to disable SSL verification, provide the CA file via --input-ca for each step.

Verification

Check Index Creation

curl http://127.0.0.1:9200/_cat/indices?v

Compare Document Counts

# Source count
curl -u elastic:changeme -k https://<em>external‑IP</em>:9200/product-index/_count
# Target count
curl http://127.0.0.1:9200/product-index/_count

Sample Data

curl http://127.0.0.1:9200/product-index/_search?size=10

Common Issues and Solutions

SSL Certificate Error

Error: unable to verify the first certificate

Solution: set NODE_TLS_REJECT_UNAUTHORIZED=0 or use --input-ca with the proper certificate.

Authentication Failure

Error: 401 Unauthorized

Solution: verify username/password and ensure URL follows https://username:password@host:port/index.

Target Index Already Exists

Error: resource_already_exists_exception

Solution: delete the existing index first, e.g., curl -X DELETE http://127.0.0.1:9200/product-index.

Large Dataset Timeout

Reduce --limit, increase --timeout=120000 (ms), or raise --concurrency to speed up transfer.

Full Migration Script (Windows)

@echo off
echo ========================================
echo Elasticsearch to Easysearch Migration
echo ========================================

:: Set environment variable
set NODE_TLS_REJECT_UNAUTHORIZED=0

:: Source and target configuration
set SOURCE=https://elastic:changeme@<em>external‑IP</em>:9200
set TARGET=http://127.0.0.1:9200
set INDEX=product-index

echo Step 1: Migrating Mapping...
elasticdump --input=%SOURCE%/%INDEX% --output=%TARGET%/%INDEX% --type=mapping
if %errorlevel% neq 0 goto error

echo Step 2: Migrating Settings...
elasticdump --input=%SOURCE%/%INDEX% --output=%TARGET%/%INDEX% --type=settings
if %errorlevel% neq 0 goto error

echo Step 3: Migrating Data...
elasticdump --input=%SOURCE%/%INDEX% --output=%TARGET%/%INDEX% --type=data --limit=5000
if %errorlevel% neq 0 goto error

echo ========================================
echo Migration completed successfully!
echo ========================================
goto end

:error
echo ========================================
echo Migration failed! Please check errors above.
echo ========================================

:end
pause

Additional Performance Optimizations

Adjust batch size with --limit based on document size.

Enable concurrent transfer via --concurrency.

Ensure stable network connectivity between source and target.

Perform migrations during low‑traffic periods.

Use incremental migration with --searchBody to limit data by date range.

Conclusion

Elasticdump provides a fast and reliable way to move Elasticsearch indices to Easysearch. The essential steps are installing the tool, handling SSL, migrating mapping → settings → data in order, verifying the results, and tuning performance parameters as needed.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Data MigrationElasticsearchperformance tuningcommand-lineSSLElasticdumpEasysearch
Mingyi World Elasticsearch
Written by

Mingyi World Elasticsearch

The leading WeChat public account for Elasticsearch fundamentals, advanced topics, and hands‑on practice. Join us to dive deep into the ELK Stack (Elasticsearch, Logstash, Kibana, Beats).

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.