Hi,
I'm developing a client in Linux using C++/libcurl/libjsoncpp and am getting the following error message from elasticsearch when sending the following via PUT:
From libcurl as verbose debug output enable:
PUT /mydocs/file/_mapping?pretty=true HTTP/1.1
Host: localhost:9200
Content-type: application/json
Accept: application/json
Content-Length: 297
Expect: 100-continue
HTTP/1.1 100 Continue
Actual json string sent via PUT:
{
"file" : {
"properties" : {
"filename" : {
"type" : "string"
},
"path" : {
"type" : "string"
},
"text" : {
"term_vector" : "with_positions_offsets",
"type" : "string"
}
}
}
}
From libcurl as verbose debug output enable:
We are completely uploaded and fine
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 374
Connection #0 to host localhost left intact
Response received from elasticsearch:
ES response:{
"error" : {
"root_cause" : [ {
"type" : "not_x_content_exception",
"reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
} ],
"type" : "not_x_content_exception",
"reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
},
"status" : 500
}
The following command works from the command line without error:
curl -X PUT 'localhost:9200/mydocs/file/_mapping?pretty=true' -d '
{
"file": {
"properties": {
"filename": { "type": "string" },
"path": { "type": "string" },
"text": { "type": "string", "term_vector":"with_positions_offsets" }
}
}
}'
Response from elasticsearch:
{
"acknowledged" : true
}
FWIW. I'm able to send commands via curl and PUT without any data with error. I'm also able to sent JSON data via POST error. The error appears to occur only when using PUT with data.
Thanks in advance
Prakash