Skip to content

es helpers bulk-ingest: duplicate Content-Type header on NDJSON ingest #361

@l-trotta

Description

@l-trotta

elastic es helpers bulk-ingest with NDJSON input fails with 406 because the request reaches Elasticsearch with Content-Type: application/x-ndjson, application/x-ndjson. The helper sets the header explicitly, and the transport layer also sets it for NDJSON bodies. Effectively the NDJSON path is unusable.

Reproducer (CLI 0.1.1):

$ printf '{"name":"a"}\n{"name":"b"}\n' > /tmp/x.ndjson && elastic es helpers bulk-ingest --index test --data-file /tmp/x.ndjson --source-format ndjson --json
{"error":{"code":"transport_error","status_code":406,"body":{"error":"Content-Type header [application/x-ndjson, application/x-ndjson] is not supported","status":406}}}

Suggested fix: drop the explicit Content-Type: application/x-ndjson header in the helper and let the transport set it once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions