Elasticsearch-dump is a command-line tool and Node.js package designed to import and export data from Elasticsearch and OpenSearch clusters. Written in JavaScript, it provides functionality for backing up, restoring, and migrating indices between Elasticsearch instances or to and from files. The tool supports multiple output formats including JSON and CSV, making it useful for data archival, disaster recovery, and index migration scenarios.
The core functionality works by accepting an input source and an output destination, both of which can be either an Elasticsearch or OpenSearch URL or a file path. Standard input and output are also supported. For Elasticsearch or OpenSearch endpoints, users specify the protocol, host, port, and index name in URL format. The tool uses Elasticsearch's scroll API under the hood to safely export large datasets by maintaining a consistent snapshot in time, preventing memory issues during large exports.
The dump format generated by elasticdump is line-delimited JSON, where each line represents a valid JSON object but the file as a whole is not valid JSON. This design allows dump files to be streamed and appended without requiring whole-file parser integrity checks. The tool has undergone several major version changes with breaking changes, including format changes in version 1.0.0, removal of bulk options in version 2.0.0, migration from scan/scroll to scroll in version 2.1.0, and OpenSearch support added in version 6.76.0.
Beyond the standard elasticdump binary, the package includes multielasticdump, a wrapper that enables parallel dumping and loading across multiple indices simultaneously. This tool forks into multiple subprocesses, defaulting to the number of CPU cores available on the host machine. It supports regex-based index matching, custom matchers for complex filtering logic, and options to ignore or include specific data types such as mappings, analyzers, aliases, settings, and templates. Users can add prefixes and suffixes to index names during operations and control the order in which indices are processed.
The tool supports advanced features including custom transformation modules that can modify documents during export or import operations, searchBody templates for modifying queries, and special handling for nested data in CSV format through flattening to a single level. Docker images are available for containerized deployment, with official images published to Docker Hub. The tool also supports bypassing self-signed certificate errors through environment variables.
Common issue categories include questions, feature requests, and items marked as working as expected. The repository's contributor network overlaps with major projects including Microsoft's VSCode and TypeScript repositories, as well as the Rust language repository, indicating involvement from developers across multiple ecosystems.