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.
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 elasticdumpConfirm 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=0Note: 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=mappingParameters: --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=settingsSome 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=5000Parameters: --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?vCompare 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/_countSample Data
curl http://127.0.0.1:9200/product-index/_search?size=10Common Issues and Solutions
SSL Certificate Error
Error: unable to verify the first certificateSolution: set NODE_TLS_REJECT_UNAUTHORIZED=0 or use --input-ca with the proper certificate.
Authentication Failure
Error: 401 UnauthorizedSolution: verify username/password and ensure URL follows https://username:password@host:port/index.
Target Index Already Exists
Error: resource_already_exists_exceptionSolution: 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
pauseAdditional 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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).
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
