# Libcurl PUT error not\_x\_content\_exception

**URL:** <https://discuss.elastic.co/t/libcurl-put-error-not-x-content-exception/46313>\
**Category:** Elasticsearch\
**Created:** [April 5, 2016, 1:18am UTC](https://discuss.elastic.co/t/libcurl-put-error-not-x-content-exception/46313 "2016-04-05T01:18:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethicator](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@ethicator](https://discuss.elastic.co/u/ethicator)\
**Post date:** [April 5, 2016, 1:18am UTC](https://discuss.elastic.co/t/libcurl-put-error-not-x-content-exception/46313/1 "2016-04-05T01:18:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:02pm UTC](https://discuss.elastic.co/t/libcurl-put-error-not-x-content-exception/46313/2 "2017-07-05T23:02:26Z")

</div>


