title: Set Content-type header to Elasticsearch-php client
body: <p>I'm trying to use Elasticsearch-php version 5.0 to send search queries to Elasticsearch 6.4.2.</p>
  
  <p>One of the breaking changes from 5.0 to 6.0 is that there is the "<a href="https://www.elastic.co/blog/strict-content-type-checking-for-elasticsearch-rest-requests" rel="nofollow noreferrer">strict content type validation</a>"
  which means that requests to Elasticsearch must sent with "Content-type: application/json" header.</p>
  
  <p>In order to add this header,  I tried to use polyfractal's suggestion from <a href="https://github.com/elastic/elasticsearch-php/issues/205" rel="nofollow noreferrer">this thread</a>:</p>
  
  <pre><code>    $params = [
      'index' =&gt; $index,
      'type' =&gt; $mapping,
      'body' =&gt; $query,
      'client' =&gt; [
          'curl' =&gt; [CURLOPT_HTTPHEADER =&gt; array('Content-type: text/plain')]
          ]
      ];
  
      $res = $this-&gt;mESClient-&gt;search($params); // this is Elasticsearch/Client
  
      return $res;
  </code></pre>
  
  <p>but for some reason, I keep getting "Notice: Array to string conversion" when the code tries to do <a href="http://php.net/manual/en/function.curl-setopt-array.php" rel="nofollow noreferrer">curl_setopt_array()</a>, and the request is net sent.</p>
  
  <p>Please note: that when I remove the 'client' part of the $params array the request is being received in the Elasticsearch.</p>