not_x_content_exception: Compressor detection error / body is not valid content(压缩格式检测错误/请求体不是有效内容)
Elasticsearch含义
Elasticsearch 无法将请求体识别为有效的结构化内容(JSON 等 XContent)。发送的数据不是预期格式或已损坏。
原因
请求体是无效的 JSON;Content-Type 头错误或缺失(未发送 application/json);请求体被意外以压缩/二进制形式发送;或向 _bulk 等需要换行分隔 JSON(NDJSON)的端点发送了普通 JSON。转义/编码错误也会触发。
解决方法
确认请求体是有效的 JSON,并发送 Content-Type: application/json 头。对 _bulk 端点使用 NDJSON:每行是一个独立的 JSON 对象,最后一行以换行符结尾(Content-Type: application/x-ndjson)。确保客户端库正确序列化请求体。如果使用压缩,发送相应的 Content-Encoding 头。
同一数据库的其他条目
- index_template_missing_exceptionIndex template is missing(索引模板不存在)
- settings_exceptionInvalid settings(无效的设置)
- shard_not_found_exceptionShard not found(未找到分片)
- document_source_missing_exceptionDocument source is missing(文档 source 不存在)
- node_not_connected_exceptionNode is not connected(节点未连接)
- receive_timeout_transport_exceptionRequest timed out waiting for a response from another node(等待另一节点响应时请求超时)
- routing_missing_exceptionRouting value is required for this document(此文档需要 routing 值)