ES5.5 warning "Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header." even though the Content-Type header is present

I see a very weird behaviour after I upgraded from ES 2.3.5 to 5.5.0. I'm using Perl Search::Elasticsearch v. 5.02 (newest available) for sending logs directly to ES. Most of the time all looks fine, but for some requests ES replies with a warning

Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header.

All log documents have the same format, use the same logging configuration. I debugged the network traffic with Wireshark and I can see that the Content-Type header is there.

Sample conversation with a warning:

POST /logger-2017-30/drone_log HTTP/1.1
Host: 10.101.143.139:9200
Content-Type: application/json
User-Agent: HTTP-Tiny/0.070
Content-Length: 187

{"lvl":3,"i":668,"an":15116633,"timestamp":1500993836,"msg":"Fetching: xxx \n","who":"xxx::ready:2742","cid":28,"stime":1500993836308402,"host":"xxx","mem":0}
HTTP/1.1 201 Created
Location: /logger-2017-30/drone_log/AV16NFVCD0Cxilazahyj
Warning: 299 Elasticsearch-5.5.0-260387d "Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header." "Tue, 25 Jul 2017 14:43:56 GMT"
content-type: application/json; charset=UTF-8
content-length: 171

{"_index":"logger-2017-30","_type":"drone_log","_id":"AV16NFVCD0Cxilazahyj","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"created":true}

Similar conversation to the same ES host without a warning:

POST /logger-2017-30/drone_log HTTP/1.1
Host: 10.101.143.139:9200
User-Agent: HTTP-Tiny/0.070
Content-Type: application/json
Content-Length: 261

{"cid":28,"host":"xxx","mem":0,"stime":1500993796983344,"who":"xxx::document_list:752","timestamp":1500993796,"an":15021170,"i":678,"msg":"SKIPPED xxx\n","lvl":2}
HTTP/1.1 201 Created
Location: /logger-2017-30/drone_log/AV16M7ukD0Cxilazaf9x
content-type: application/json; charset=UTF-8
content-length: 171

{"_index":"logger-2017-30","_type":"drone_log","_id":"AV16M7ukD0Cxilazaf9x","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"created":true}

I see the same warnings registered on the ES server side (for some requests). What can be the problem here? I could not reproduce it using cURL or a simple Perl script - always works without a warning, even when I run it in an endless loop for some time.

I investigated the traffic on the ES server side and it showed the same conversations: requests from the Perl client coming in with Content-Type: application/json and ES replies to some of them with the warning. However, I also saw massive amounts of these warnings issued for a totally different client (PHP) on a different server which indeed was not putting the Content-Type header correctly. When that was fixed, the warnings towards the Perl client ceased. Would there be some synchronization issue in ES that would cause the warnings to leak to an unrelated HTTP request? Anyway, no more warnings anywhere now.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.