title: Cannot get data from Elastic 6.0: “error”:”Content-Type header [text/plain] is not supported”,”status”:406
body: <p>I create a client in java and want to get the query results from index but got the 406 error:
  "Content-Type header [text/plain] is not supported","status":406.</p>
  
  <p>Java platform: 1.6</p>
  
  <p>ES version: 6.0</p>
  
  <p>Below is the code snippet:</p>
  
  <pre><code>  Client clientInstance = Client.create();
    clientInstance.addFilter(new HTTPBasicAuthFilter("", ""));
   WebResource webResource =
    clientInstance.resource("http://hostname:9200/indexname/_search");
  ClientResponse response=webResource.entity(dsl).accept("application/json").get(ClientResponse.class); 
  String result = response.getEntity(String.class);
  </code></pre>
  
  <p>I use the dsl in Kibana and can get the correct query results. But it did not get the correct response in java and throw 406 error.</p>
  
  <p>How can I fix this issue? Thanks very much!</p>