Cannot read data from Elastic 6.0: "error":"Content-Type header [text/plain] is not supported","status":406


Hi experts,

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.

Java platform: 1.6
ES version: 6.0

Below is the code snippet:

  Client clientInstance = Client.create();
  clientInstance.addFilter(new HTTPBasicAuthFilter("", "")); // No Auth in sample RI

  WebResource webResource =
  ClientResponse response =

  String resultEntity = response.getEntity(String.class);

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.

How can I fix this issue? Thanks veru much!

(David Pilato) #2

You need to provide the Content-Type.

(Val Crettaz) #4

I didn't see it was cross-posted, but I answered here


Yes, it solves this issue and thanks.

(system) #6

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