Set up content-type in elasticsearch 5.1


I recently upgraded to Elasticsearch 5.1 and found out that its compulsory to set Content type in my Integration tests. Right now i Get below error Request POST http://localhost:9251/testindex HTTP/1.1 yielded text/plain; charset=UTF-8, should be json: HTTP/1.1 400 Bad Request
at io.searchbox.client.http.JestHttpClient.deserializeResponse(

Anyone knows how to set a content-type for the response?

My current code looks like this,

final Settings settings = Settings.builder()
.put("http.port", port)
.put("http.enabled", true)
.put("path.home", "/tmp")
.put("http.type", "netty4")
.put("transport.type", "local")
.put("", UUID.randomUUID().toString())
Node node = new PluginConfigurableNode (settings, Arrays.asList(Netty4Plugin.class));
return node.client();
private static class PluginConfigurableNode extends Node {
public PluginConfigurableNode (Settings preparedSettings, Collection<Class<? extends Plugin>> classpathPlugins) {
super(InternalSettingsPreparer.prepareEnvironment(preparedSettings, null), classpathPlugins);

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