Skip to content

ES|QL's streaming Apache Arrow helper needs better handling of server-side errors #3139

@JoshMock

Description

@JoshMock

🐛 Bug report

Reported by @cnasikas:

We’re using the JS esClient.helpers.esql().toArrowReader() helper to stream Arrow IPC results. When the ES|QL query produces errors like unsupported field types like date_range, Elasticsearch correctly returns a JSON error

(content-type: application/vnd.elasticsearch+json;compatible-with=9)

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"ES|QL type [date_range] is not supported by the Arrow format"}],"type":"illegal_argument_exception","reason":"ES|QL type [date_range] is not supported by the Arrow format"},"status":400}

but the helper still passes this response into AsyncRecordBatchStreamReader, which then throws a misleading Arrow metadata error ("Expected to read … metadata bytes").

To reproduce

still working on reproduction steps

Expected behavior

A more appropriate error should be thrown, and streaming should be cleanly terminated.

Node.js version

n/a

@elastic/elasticsearch version

9

Operating system

n/a

Any other relevant environment information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions