title: Elasticsearch 5.5 getting error 'not_x_content_exception' using CURL
body: <p>I'm getting below error: while I trying to create mapping and its properties</p>
  
  <pre><code>Array
  (
  [error] =&gt; Array
      (
          [root_cause] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [type] =&gt; not_x_content_exception
                          [reason] =&gt; Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
                      )
  
              )
  
          [type] =&gt; not_x_content_exception
          [reason] =&gt; Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
      )
  
  [status] =&gt; 500
  </code></pre>
  
  <p>)</p>
  
  <p>I'm Using CURL-here is my code using Codeigniter and elasticsearch</p>
  
  <pre><code>    $create ='
                  {
                  "properties": {
                      "message": {
                        "type": "text"
                          }
                    }
                  }
                  ';
      $response = $this-&gt;elasticsearch-&gt;custome_function("_mapping/tweet","PUT", $create);
  </code></pre>
  
  <p>Here is my class file: </p>
  
  <pre><code>class ElasticSearch
  {
  public $index;
  /**
   * constructor setting the config variables for server ip and index.
   */
     public function __construct()
     {
      $ci = &amp;get_instance();
      $ci -&gt; config -&gt; load("elasticsearch");
      $this -&gt; server = 'http://localhost:9200'; //$ci -&gt; config -&gt; item('es_server');
      $this -&gt; index = "my_index";        // configured in constant file //$ci -&gt; config -&gt; item('index');
  }
  
  private function call($path, $method = 'GET', $data = null)
  {
      if (!$this -&gt; index) {
          throw new Exception('$this-&gt;index needs a value');
      }
      $url = $this -&gt; server . '/' . $this -&gt; index . '/' . $path;
      $headers = array('Accept: application/json', 'Content-Type: application/json', );
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      switch($method) {
          case 'GET' :
              break;
          case 'POST' :
              curl_setopt($ch, CURLOPT_POST, true);
              curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
              break;
          case 'PUT' :
              curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
              curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
              break;
          case 'DELETE' :
              curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
              break;
      }
      $response = curl_exec($ch);
      $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      return json_decode($response, true);
  }
  
  
   public function custome_function($type,$method,$query)
   {
      return $this -&gt; call($type,$method,$query);
   }
   }
  </code></pre>
  
  <p>Can anyone suggest me how to create mappings and properties or is there any alternate way to create mappings</p>