# Elastic8 java client allocation.max\_retries exception

**URL:** <https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868>\
**Category:** Elasticsearch\
**Created:** [July 5, 2022, 7:51am UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868 "2022-07-05T07:51:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Idorasi\_Paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/idorasi_paul/32/107909_2.png) [@Idorasi\_Paul](https://discuss.elastic.co/u/Idorasi_Paul)\
**Post date:** [July 5, 2022, 7:51am UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/1 "2022-07-05T07:51:33Z")

</div>

Hello, currently using elasticsearch-java 8.1.3 client to communicate with my es cluster. Index settings looks like this: ` "settings": { "index": { "number_of_shards": 1, "number_of_replicas": 7, "allocation.max_retries": 15 } }`

According to the documentation, allocation.max\_retries is still a valid setting but it's missing from co.elastic.clients.elasticsearch.indices.IndexSettings and `Exception: co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.indices.IndexSettings: Unknown field 'allocation.max_retries' (JSON path: index['allocation.max_retries']) (line no=1, column no=56, offset=55)` is thrown when deserializing. Is this a mistake or I'm doing something wrong?

---

<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:** [July 5, 2022, 12:21pm UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/2 "2022-07-05T12:21:53Z")

</div>

Welcome!

There is a workaround explained in this documentation.

> **[MissingRequiredPropertyException in a response | Elasticsearch Java API...](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/missing-required-property.html)**

---

<div class="post-metadata">

**Author:** ![Idorasi\_Paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/idorasi_paul/32/107909_2.png) [@Idorasi\_Paul](https://discuss.elastic.co/u/Idorasi_Paul)\
**Post date:** [July 5, 2022, 1:14pm UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/3 "2022-07-05T13:14:26Z")

</div>

But my issue is not that the field is required and not received. The field does not exist and it is received. I tried: `objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);` but this did not fix my issue.

---

<div class="post-metadata">

**Author:** ![Idorasi\_Paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/idorasi_paul/32/107909_2.png) [@Idorasi\_Paul](https://discuss.elastic.co/u/Idorasi_Paul)\
**Post date:** [July 5, 2022, 1:46pm UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/4 "2022-07-05T13:46:28Z")

</div>

Found the issue. Exception is thrown when indexSettings object is created. Issue: `indexSettings = settingsJson != null ? IndexSettings.of(i -> i.withJson(IOUtils.toInputStream(finalSettingsJson.toString(), StandardCharsets.UTF_8))) : null;`

Fix:

```auto
  var mapper = SimpleJsonpMapper.INSTANCE;
indexSettings = settingsJson != null ? IndexSettings.of(i -> i.withJson(mapper.jsonProvider().createParser(IOUtils.toInputStream(finalSettingsJson.toString(), StandardCharsets.UTF_8)), mapper)) : null;

```

---

<div class="post-metadata">

**Author:** ![Idorasi\_Paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/idorasi_paul/32/107909_2.png) [@Idorasi\_Paul](https://discuss.elastic.co/u/Idorasi_Paul)\
**Post date:** [July 11, 2022, 8:59am UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/5 "2022-07-11T08:59:31Z")

</div>

Any solution like this one for version 7.x?

---

<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:** [July 11, 2022, 10:30am UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/6 "2022-07-11T10:30:04Z")

</div>

I believe so. [MissingRequiredPropertyException in a response | Elasticsearch Java API Client [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/7.17/missing-required-property.html)

---

<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:** [August 8, 2022, 10:30am UTC](https://discuss.elastic.co/t/elastic8-java-client-allocation-max-retries-exception/308868/7 "2022-08-08T10:30:57Z")

</div>

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