not_x_content_exception: Compressor detection error / body is not valid content (압축 감지 오류 / 본문이 유효한 콘텐츠가 아님)
Elasticsearch의미
Elasticsearch가 요청 본문을 유효한 구조화 콘텐츠(JSON 같은 XContent)로 인식하지 못했다. 전송된 데이터가 예상 형식이 아니거나 손상되었다.
원인
요청 본문이 유효하지 않은 JSON이거나, Content-Type 헤더가 잘못되었거나 없거나(application/json 미전송), 본문이 실수로 압축/바이너리로 전송되었거나, 줄바꿈 구분 JSON(NDJSON)을 기대하는 _bulk 같은 엔드포인트에 일반 JSON을 보낸 경우다. 이스케이프/인코딩 오류도 원인이 된다.
해결 방법
요청 본문이 유효한 JSON인지 확인하고 Content-Type: application/json 헤더를 보낸다. _bulk 엔드포인트에는 각 줄이 별도 JSON 객체이고 마지막 줄이 줄바꿈으로 끝나는 NDJSON을 사용한다(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
- 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 값이 필요)