Solved : Content-Type header [] is not supported ES6
![Solved : Content-Type header [] is not supported ES6](https://www.gotals.com/wp-content/uploads/2019/06/Elasticsearch-Content-Type-header-is-not-supported-682x340.png)
Content-Type header [] is not supported Elasticsearch 6, problem is from Elastic search 6 onwards,we must send headers in the query.
Elasticsearch 6.0, all REST requests that include a body must also provide the correct content-type for that body. in Elasticsearch 6.0, that setting defaults to true, and there is no way to disable it.
{Read:- 5 Ways to Improve SEO on Your WordPress Site }
In earlier releases of Elasticsearch, the content-type was optional, and if it was missing or not recognised, then the server would sniff the content and make an educated guess regarding the content-type. That will no longer happen in Elasticsearch 6.0 – every incoming request needs to have the correct content-type for the body it contains.
So here is the details of my issue,
{“error”:“Content-Type header [] is not supported”,“status”:406} When Inserting Data to Elasticsearch 6 using ES put() API in Zend.
{Read:- How to Build a WordPress Site in 1 Day }
Solution : Content-Type header [] is not supported ES6
added the Content-Type in CurlFactory.php in Zend Elasticsearch library
File : library/Elasticsearch/vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php
Old :
1 2 3 4 |
// cURL sometimes adds a content-type by default. Prevent this. if (!Core::hasHeader($request, 'Content-Type')) { $options[CURLOPT_HTTPHEADER][] = 'Content-Type:'; } |
Change to :
1 2 3 4 |
// cURL sometimes adds a content-type by default. Prevent this. if (!Core::hasHeader($request, 'Content-Type')) { $options[CURLOPT_HTTPHEADER][] = <strong>'Content-Type:application/json';</strong> } |
PFA :
{Read:- 10 WordPress Mistakes to Avoid }

Content-Type header [] is not supported
It looks like you’ve misspelled the word “const” on your website. I thought you would like to know :). Silly mistakes can ruin your site’s credibility. I’ve used a tool called SpellScan.com in the past to keep mistakes off of my website.
-Sean Thompson Sr.