Back to Skills

elasticsearch-file-ingest

Ingest and transform data files (CSV/JSON/Parquet/Arrow IPC) into Elasticsearch with stream processing and custom transforms. Use when loading files or batch importing data — not for reindexing, general ingest pipeline design, or bulk API patterns.

531stars41forksUpdated 7/9/2026

Security Assessment

Low Risk(70/100)

Detected risks:

Secret Exposure([SKILL.md] API_KEY=, [SKILL.md] PASSWORD=)
Security Score70/100

About elasticsearch-file-ingest

Streams and transforms large data files into Elasticsearch, handling NDJSON, CSV, Parquet, and Arrow IPC formats. The stream-based design processes large files without exhausting memory and reaches high throughput of 50k+ documents per second on commodity hardware, making it suited to loading files or batch-importing data rather than reindexing or general pipeline design. The skill is self-contained: its scripts folder and package.json live in the skill directory, dependencies are installed with npm install, and it requires Elasticsearch 8.x or 9.x plus Node.js 22+. Connection settings are supplied exclusively through environment variables, never as command-line arguments, covering Elastic Cloud (ELASTICSEARCH_CLOUD_ID plus ELASTICSEARCH_API_KEY), a direct URL with API key, basic authentication, and local development, with an optional ELASTICSEARCH_INSECURE flag to skip TLS verification in development. A connection test, node scripts/ingest.js test, should always run first, and ingestion should not proceed until it succeeds. Ingestion is driven by node scripts/ingest.js ingest with a required --target index and a source chosen from --file, which supports wildcards like logs/*.json for batch imports, or --stdin. Source format is set with --source-format (ndjson, csv, parquet, arrow). Mappings can be supplied via --mappings or inferred with --infer-mappings, which sends a sample to Elasticsearch's _text_structure/find_structure endpoint to derive both mappings and an ingest pipeline; importantly, --infer-mappings must not be combined with --source-format csv, or the index ends up empty. Additional options control CSV parsing, pipelines, index deletion, buffer size, progress display, and stall warnings. Custom JavaScript transform functions passed with --transform modify documents during ingestion: a function can enrich a document (for example adding a full_name field), skip it by returning null or undefined, or split one source document into many targets by returning an array. Custom index mappings are provided as JSON. Together these let files be cleaned, reshaped, and enriched on the way into Elasticsearch.

FAQ

Which file formats and versions are supported?

NDJSON, CSV, Parquet, and Arrow IPC, ingested into Elasticsearch 8.x or 9.x. Node.js 22+ is required.

How are Elasticsearch credentials provided?

Only through environment variables, never command-line arguments, supporting Elastic Cloud (cloud ID plus API key), a direct URL with API key, and basic authentication.

Why should I not combine --infer-mappings with --source-format csv?

Inference already sends a raw sample to the _text_structure/find_structure endpoint, which returns mappings plus a CSV-processor ingest pipeline. Adding --source-format csv parses the CSV both client-side and server-side, producing an empty index.

Can I modify documents during ingestion?

Yes, via a JavaScript transform passed with --transform. A transform can enrich a document, skip it by returning null or undefined, or split one document into multiple by returning an array.

What should I do before ingesting?

Run npm install once, then verify connectivity with node scripts/ingest.js test. If the test fails, resolve the connection issue before proceeding with ingestion.

All Files

9 files
examples/mappings.json0.4 KB
View
examples/transform.js0.9 KB
View
references/patterns.md1.6 KB
View
SKILL.md10.6 KB
View
examples/skip-transform.js0.8 KB
View
examples/split-transform.js0.7 KB
View
package.json0.4 KB
View
references/troubleshooting.md2.1 KB
View
scripts/ingest.js17.6 KB
View

Install elasticsearch-file-ingest

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill