You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Elastic _bulk API is effectively multiple JSON objects concatenated one after the other; separated by newlines.
Older Elasticsearch clients (e.g. rsyslog, others) of the _bulk API may specify a legacy/incorrect Content-Type header of application/json (this implies a single JSON document). The newer -- correct -- Content-Type is "Content-Type: application/x-ndjson", but since this is a newer standard, the old clients never implemented using it.
qryn allows only application/x-ndjson, and rejects requests which use application/json.
Change Request
If qryn permitted "Content-Type: application/json", this would allow the older clients to be supported without changes. (Even though this is not strictly correct in the current time.) Perhaps it could be a setting whether to permit it or not?
The text was updated successfully, but these errors were encountered:
Thanks for raising the issue and for the matrix discussion motivating it. Overall this should be relatively simple but might have side effects so it needs a bit of research and testing. If you want to hack this in and test locally, you can simply change or extend this code block
(the mentioned code block actually had the same body in both the if and else. I think there's a better fix that actually makes the if block check for application/json and avoid doing req.body.split, and where the else block -- now handling x-ndjson -- uses _rawBody, but tbh I don't really understand the codebase+fastify well enough to know what to do.)
Background
_bulk
API is effectively multiple JSON objects concatenated one after the other; separated by newlines._bulk
API may specify a legacy/incorrectContent-Type
header ofapplication/json
(this implies a single JSON document). The newer -- correct --Content-Type
is "Content-Type: application/x-ndjson
", but since this is a newer standard, the old clients never implemented using it.application/x-ndjson
, and rejects requests which useapplication/json
.Change Request
If qryn permitted "
Content-Type: application/json
", this would allow the older clients to be supported without changes. (Even though this is not strictly correct in the current time.) Perhaps it could be a setting whether to permit it or not?The text was updated successfully, but these errors were encountered: