最近在使用java api進行ES入庫操做時,報以下錯誤:java
{"took":150,"errors":true,"items":[{"index":{"_index":"test","_type":"type1","_id":"794719072","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}}}json
通過排查發現,在入庫過程當中,java錯誤的將字符串1 (「1」)進行了入庫操做,即將以下格式的數據進行入庫:api
{"index":{"_index":"test","_type":"type1"}} "1"
則會報上述錯誤,入庫數據格式有誤,mapping沒法解析app