DBAtlas · Database operations atlas

not_x_content_exception: Compressor detection error / body is not valid content

Elasticsearch

What does it mean?

Elasticsearch could not recognize the request body as valid structured content (XContent such as JSON). The data sent is not in the expected format or is corrupted.

Why does it happen?

The request body is invalid JSON; a wrong or missing Content-Type header (application/json not sent); the body was accidentally sent compressed/binary; or plain JSON was sent to endpoints such as _bulk that expect newline-delimited JSON (NDJSON). Escaping/encoding errors also trigger it.

How to fix it

Verify that the request body is valid JSON and send the Content-Type: application/json header. For the _bulk endpoint use NDJSON, where each line is a separate JSON object and the final line ends with a newline (Content-Type: application/x-ndjson). Make sure your client library serializes the body correctly. If you use compression, send the appropriate Content-Encoding header.

Open in DBAtlas →

More from this engine