# Missing required property on Elastic Cluster Health check

**URL:** <https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [December 4, 2024, 11:03am UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458 "2024-12-04T11:03:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![p4paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/p4paul/32/65034_2.png) [@p4paul](https://discuss.elastic.co/u/p4paul)\
**Post date:** [December 4, 2024, 11:03am UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458/1 "2024-12-04T11:03:53Z")

</div>

Very similar to [Error: using Java API calling ElasticsearchClient method healthReport()](https://discuss.elastic.co/t/error-using-java-api-calling-elasticsearchclient-method-healthreport/361478)

Updating the Java client (from 8.15.3) to `elasticsearch-java:8.16.1` and calling...

```auto
HealthResponse healthModel = getEsClient().cluster().health();

```

throws...

```auto
co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'HealthResponse.unassignedPrimaryShards'

```

The Elasticsearch instance is old 7.x version (but still supported)

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [December 4, 2024, 11:20am UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458/2 "2024-12-04T11:20:51Z")

</div>

Hello! You can refer to this [github issue](https://github.com/elastic/elasticsearch-java/issues/913) which describes the same problem, and use the proposed workaround. To summarize, yes 7.x is still supported, but the java client is forward compatible, not backward (as the [readme states](https://github.com/elastic/elasticsearch-java?tab=readme-ov-file#compatibility)); this is because the server might add/remove parameters, and newer versions of the client will always match the current server version.

---

<div class="post-metadata">

**Author:** ![p4paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/p4paul/32/65034_2.png) [@p4paul](https://discuss.elastic.co/u/p4paul)\
**Post date:** [December 4, 2024, 2:10pm UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458/3 "2024-12-04T14:10:10Z")

</div>

Thank you for the link - I tried setting `ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true)`, but now get:

```auto
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "co.elastic.clients.util.ApiTypeHelper.requireNonNull(Object, Object, String)" is null

```

I guess if the property is missing then the value is null. Perhaps there is another DANGEROUS\_... option?

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [December 4, 2024, 4:03pm UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458/4 "2024-12-04T16:03:23Z")

</div>

Ah that's unfortunate, it's the same case as in the issue, and the workaround doesn't work. The solution here is either to update the server version, or to use the **low level rest client** to perform the call, which will bypass any form of validation and just return pure json:

```java
Response health = restClient.performRequest(new Request("GET", "/_cluster/health"));
String jsonResponse = new String(health.getEntity().getContent().readAllBytes(), UTF_8);

```

---

<div class="post-metadata">

**Author:** ![p4paul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/p4paul/32/65034_2.png) [@p4paul](https://discuss.elastic.co/u/p4paul)\
**Post date:** [December 5, 2024, 11:14am UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458/5 "2024-12-05T11:14:32Z")

</div>

Thank you. I'll figure something out; probably a low level rest call.

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [July 14, 2025, 9:21am UTC](https://discuss.elastic.co/t/missing-required-property-on-elastic-cluster-health-check/371458/6 "2025-07-14T09:21:00Z")

</div>

Updating this thread since this is still a common issue: from versions \>8.18 of the java client, the `DANGEROUS_disableRequiredPropertiesCheck` workaround also works for integers and other primitives.
