# Exception during create index operation using java high level rest client

**URL:** https://discuss.elastic.co/t/exception-during-create-index-operation-using-java-high-level-rest-client/123108
**Category:** Elasticsearch
**Created:** [March 8, 2018, 3:27pm UTC](https://discuss.elastic.co/t/exception-during-create-index-operation-using-java-high-level-rest-client/123108 "2018-03-08T15:27:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AshutoshB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashutoshb/32/28577_2.png) [@AshutoshB](https://discuss.elastic.co/u/AshutoshB)
#### Post date: [March 8, 2018, 3:27pm UTC](https://discuss.elastic.co/t/exception-during-create-index-operation-using-java-high-level-rest-client/123108/1 "2018-03-08T15:27:08Z")

</div>

Hi,

I am using java high level rest client v6.2.2 to connect es cluster v5.3.1. The create index api creates the index successfully but throws the exception:

```
Exception in thread "main" java.io.IOException: Unable to parse response body for Response{requestLine=PUT /<my index name>?master_timeout=30s&timeout=30s HTTP/1.1, host=cluster host, response=HTTP/1.1 200 OK}
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:507)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:474)
	at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:77)
	at com.sensano.App.createIndex(App.java:66)
	at com.sensano.App.main(App.java:52)
Caused by: java.lang.IllegalArgumentException: Required [index]
	at org.elasticsearch.common.xcontent.ConstructingObjectParser$Target.finish(ConstructingObjectParser.java:449)
	at org.elasticsearch.common.xcontent.ConstructingObjectParser$Target.access$000(ConstructingObjectParser.java:350)
	at org.elasticsearch.common.xcontent.ConstructingObjectParser.parse(ConstructingObjectParser.java:170)
	at org.elasticsearch.common.xcontent.ConstructingObjectParser.apply(ConstructingObjectParser.java:162)
	at org.elasticsearch.action.admin.indices.create.CreateIndexResponse.fromXContent(CreateIndexResponse.java:128)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:618)
	at org.elasticsearch.client.RestHighLevelClient.lambda$performRequestAndParseEntity$2(RestHighLevelClient.java:474)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:505)
	... 4 more

```

I have the following code:

```
CreateIndexRequest request = new CreateIndexRequest(index);
request.source(SCHEMA_JSON, XContentType.JSON);
CreateIndexResponse createIndexResponse = esRestHighLevelClient.indices().create(request);

```

SCHEMA\_JSON : contains mapping, index settings etc.

Am I doing something wrong?

Thanks in advance for your help.

Best,  
Ashutosh

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [March 8, 2018, 3:49pm UTC](https://discuss.elastic.co/t/exception-during-create-index-operation-using-java-high-level-rest-client/123108/2 "2018-03-08T15:49:28Z")

</div>

> I am using java high level rest client v6.2.2 to connect es cluster v5.3.1.

That's the problem.

Sadly the 6.x client is not fully compatible with 5.x.

Read here: [Compatibility | Java REST Client [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-compatibility.html)

---

<div class="post-metadata">

### Author: ![AshutoshB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashutoshb/32/28577_2.png) [@AshutoshB](https://discuss.elastic.co/u/AshutoshB)
#### Post date: [March 10, 2018, 8:32pm UTC](https://discuss.elastic.co/t/exception-during-create-index-operation-using-java-high-level-rest-client/123108/3 "2018-03-10T20:32:50Z")

</div>

Tanks David for your reply. It seems I miss understood the compatibility staff between low-level and high-level rest client.

Best,  
Ashutosh

---

<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: [April 7, 2018, 8:33pm UTC](https://discuss.elastic.co/t/exception-during-create-index-operation-using-java-high-level-rest-client/123108/4 "2018-04-07T20:33:30Z")

</div>

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