-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch Version
serverless
Installed Plugins
No response
Java Version
bundled
OS Version
Ubuntu 20.04.6 LTS (Focal Fossa)
Problem Description
We received a suppressed rest error recently that resulted in returning a 500 error to the client. However, I believe this should be a 4xx level error.
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: not_x_content_exception:
Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
From all the searching I've done, this appears to be caused by the user sending incorrectly formatted data to the endpoint (/_bulk in this case). Either a malformed YAML file (e.g. it's missing the leading ---) or a JSON file that is not explicitly an object, perhaps a string or list.
Steps to Reproduce
In this case, since it is a bulk request, I would assume that they formatted JSON lines incorrectly. Perhaps sending a list or string, instead of a json object. I can't see the actual request sent, so I can't confirm this.
I'm setting up a cluster in QA for testing now to try and reproduce it. I will update this if and when I have.
EDIT: Here is the command and response when I recreated this. I believe this should be a 4xx error, not a 500. Note the square brackets ([]) around the second json line.
EDIT x 2: I deleted revisions of this comment that contained credentials. The cluster has been destroyed, but we don't need them floating around for whatever reason.
curl -X POST -sk -u testing:password -H "Content-Type: application/json" -d \
'{"index":{"_index":"geonames"}}
[{"geonameid":1,"name":"testing","asciiname":"Nothing","alternatenames":"testing_alternatename,otheralternatename","feature_class":"P","feature_code":"PPL","country_code":"TS","admin1_code":"1","population":0,"dem":"0","timezone":"UTC","location":[0.0, 0.0]}]
' \
"https://[ES CLUSTER URL]:443/_bulk"Response:
{"errors":true,"took":0,"items":[{"index":{"_index":"geonames","_id":"-PKY6ZIBrcB8bW5HrKUd","status":500,"error":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}}]