Repository navigation
Description
Summary
elastic es helpers bulk-ingest currently passes each parsed document straight through to the bulk API. There is no way to modify, enrich, filter, or split documents on the client side during ingestion. This is more of a scope / direction question than a concrete feature request — there are several valid answers, and picking one would unblock the ingest story.
Current surface
The ingest-pipeline option (--pipeline <name>) covers server-side transformation via Elasticsearch ingest processors. That works for grok, geoip, set, rename, script (Painless), etc. — but only for transformations the user can express as an ingest pipeline, and only after the pipeline has been created.
There is no client-side transform hook.
Use cases that don't fit ingest pipelines
- Document splitting — turn one source row into multiple target documents (e.g. split a tweet into one doc per hashtag). Ingest pipelines operate 1:1.
- Pre-parse filtering — drop documents before they hit the wire (
if !doc.email.contains("@") skip). An ingest pipeline can set_ingest.drop, but every dropped doc still pays the network round-trip. - Enrichment from local context — add
{"ingest_host": "<local hostname>", "batch_id": "<uuid>"}to every doc, with the value coming from the local environment rather than the document. - Schema reshape before inference — flatten / rename / retype fields before
--infer-mappingssees them, so the inferred mapping matches the target schema. - Secret redaction before send — strip PII client-side so it never enters ES at all (vs. an ingest pipeline that runs after the doc has reached the cluster).
Options I see
A. Pipe through an external program
Document the cat data.ndjson | jq '...' | elastic es helpers bulk-ingest --input-file - pattern in --help. No CLI code change. Works for most item-1..3 cases as long as the transform fits in jq. Doesn't help with formats the external program can't parse (CSV/Parquet), so pairs with #185 but doesn't replace it.
B. Flag-driven declarative transforms
Add narrow flags for the common cases:
--rename-field <from>=<to> # repeatable
--drop-field <path> # repeatable
--add-field <path>=<value> # repeatable
--filter-expr <jmespath> # drop docs where this is true
No user scripting, no security surface. Covers ~60% of practical needs. Probably the right MVP.
C. JS transform plugin
--transform <path-to-js>
Load a user .js/.mjs file, call its default export as (doc) => doc | null | doc[] (the node-es-transformer contract). This is what elasticsearch-file-ingest currently does via its bundled script. Maximum flexibility but opens a scripting + security surface (untrusted JS execution, module resolution, etc.).
D. WASM / sandboxed expression language
Like option C but constrained — a small expression language (CEL, Rego, or an embedded Lua/Starlark) that can read/write doc fields without arbitrary code. More work than C, but safer.
What I'd suggest
- Start with A + B: document the external-pipe pattern, and add
--rename-field/--drop-field/--add-fieldfor the trivial cases. Ship both in one release. This covers the majority of the file-ingest skill's transform workload without the CLI becoming a scripting runtime. - Defer C/D unless user demand specifically wants in-process transforms that
jq/ external programs can't express.
If the team has an opinion here, capturing it on this issue lets skill authors stop maintaining their own transform runtimes (elasticsearch-file-ingest is the immediate case — see sandbox PR #359).
Relationship to other issues
- #185 asks for CSV/Parquet/Arrow parsing in
bulk-ingest. Independent of this issue — parsing is about format, transforms are about content. - #184 (text-structure) is a one-shot mapping + pipeline inference — not a streaming transform.
Environment
- CLI:
0.1.0-alpha.1 - Surfaced during: https://github.com/elastic/agent-skills-sandbox elasticsearch skills migration (PR #359)
Activity
walterra commentedon Apr 21, 2026
for context: the
elasticsearch-file-ingestskill uses this package under the hood: https://github.com/walterra/node-es-transformerit's something i created years ago for internal use to easily ingest largish csv files etc. or to reindex e.g. from a remote to a local cluster including data transformations so we have an easier way handling datasets for testing. here's one internal project that make use of it under the hood too: https://github.com/elastic/ml-aiops-reindex-helper
another use case which uses the package under the hood is this demo that streams the Bluesky Firehose to ES bulk requests: https://github.com/walterra/atproto2elasticsearch
the main use case is it handles transforming a node/file-stream into bulk requests including backpressure handling. would be great if this could be inspiration for the CLI to support these type of things out of the box!
github-actions commentedon Oct 7, 2026
This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 2 days.
github-actions commentedon Oct 9, 2026
This issue was closed because it has been stalled for 2 days with no activity.