# Errors with High Level Rest Client After Upgrading to Elasticsearch 8.0.1

**URL:** https://discuss.elastic.co/t/errors-with-high-level-rest-client-after-upgrading-to-elasticsearch-8-0-1/298972
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [March 7, 2022, 1:43pm UTC](https://discuss.elastic.co/t/errors-with-high-level-rest-client-after-upgrading-to-elasticsearch-8-0-1/298972 "2022-03-07T13:43:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![chris.stack.bb](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@chris.stack.bb](https://discuss.elastic.co/u/chris.stack.bb)
#### Post date: [March 7, 2022, 1:43pm UTC](https://discuss.elastic.co/t/errors-with-high-level-rest-client-after-upgrading-to-elasticsearch-8-0-1/298972/1 "2022-03-07T13:43:47Z")

</div>

Hello,

After upgrading to Elasticsearch 8.0.1, I am having a variety of errors interfacing from my Java High Level Rest Client version 7.17.1 (originally tried with 7.15.2). The code now seems extremely sensitive to null pointer exceptions. There also seem to be new undocumented requirements. For example when creating an Index with an alias, I'm now forced to put alias.writeIndex(true) or I get an NPE.

However, I am currently stuck on Bulk Index Requests. I believe the data is being inserted correctly, but I am getting an NPE when Elasticsearch tries to parse the response, it is choking because the type parameter of the return is null. (DocWriteResponse line 116).

Here is a simplified extract of my code:

```auto
BulkRequest bulk = new BulkRequest();
	for(XContentBuilder data : bulkData) {
		IndexRequest req = new IndexRequest(indexName);
		req.source(data);
		req.type("_doc");
		bulk.add(req);
	}
BulkResponse resp = client.bulk(bulk, RequestOptions.DEFAULT);

```

client in the above code is a High Level Rest Client and all this code works fine on an ES 7.17.1 cluster. I did not originally have the type call above, but added it to see if that would fix the problem (it did not).

In my RestClientBuilder I have added (or tried to add) the Elasticsearch 7 compatibility headers like this:

```auto
Header[] defaultHeaders = {new BasicHeader("Accept", "application/vnd.elasticsearch+json; compatible-with=7"),
					new BasicHeader("Content-Type", "application/vnd.elasticsearch+json; compatible-with=7")};
			builder.setDefaultHeaders(defaultHeaders);
			RestClient llClient = builder.build();
			RestHighLevelClient client = new RestHighLevelClient(builder);

```

Does anyone have any tips or tricks to get this working with Elasticsearch 8.0.1?

Also I am running a single node on Windows 10 if that makes any difference.

---

<div class="post-metadata">

### Author: ![chris.stack.bb](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@chris.stack.bb](https://discuss.elastic.co/u/chris.stack.bb)
#### Post date: [March 7, 2022, 1:56pm UTC](https://discuss.elastic.co/t/errors-with-high-level-rest-client-after-upgrading-to-elasticsearch-8-0-1/298972/2 "2022-03-07T13:56:50Z")

</div>

Nevermind, I see this is being tracked here - [bulk index response from 8.0.0 not compatible although headers are set · Issue #84173 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/84173)

---

<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 4, 2022, 1:57pm UTC](https://discuss.elastic.co/t/errors-with-high-level-rest-client-after-upgrading-to-elasticsearch-8-0-1/298972/3 "2022-04-04T13:57:05Z")

</div>

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