Elastic8 java client allocation.max_retries exception

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?


There is a workaround explained in this documentation.

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.

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;


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

Any solution like this one for version 7.x?

I believe so. MissingRequiredPropertyException in a response | Elasticsearch Java API Client [7.17] | Elastic

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