# Set up content-type in elasticsearch 5.1

**URL:** https://discuss.elastic.co/t/set-up-content-type-in-elasticsearch-5-1/81399
**Category:** Elasticsearch
**Created:** [April 6, 2017, 4:00am UTC](https://discuss.elastic.co/t/set-up-content-type-in-elasticsearch-5-1/81399 "2017-04-06T04:00:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hrishi\_es](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@hrishi\_es](https://discuss.elastic.co/u/hrishi_es)
#### Post date: [April 6, 2017, 4:00am UTC](https://discuss.elastic.co/t/set-up-content-type-in-elasticsearch-5-1/81399/1 "2017-04-06T04:00:26Z")

</div>

Hi,

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

> java.io.IOException: Request POST [http://localhost:9251/testindex](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(JestHttpClient.java:179)

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("cluster.name", UUID.randomUUID().toString())  
> .build();  
> Node node = new PluginConfigurableNode (settings, Arrays.asList(Netty4Plugin.class));  
> node.start();  
> return node.client();  
> }  
> private static class PluginConfigurableNode extends Node {  
> public PluginConfigurableNode (Settings preparedSettings, Collection\<Class\<? extends Plugin\>\> classpathPlugins) {  
> super(InternalSettingsPreparer.prepareEnvironment(preparedSettings, null), classpathPlugins);  
> }  
> }

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 4, 2017, 4:00am UTC](https://discuss.elastic.co/t/set-up-content-type-in-elasticsearch-5-1/81399/2 "2017-05-04T04:00:29Z")

</div>

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