ES|QL's streaming Apache Arrow helper needs better handling of server-side errors
Area: HelpersCategory: Bug
### 🐛 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_
0 条评论