ElasticsearchClient.healthReport() give cluster status as yellow even though cluster is green

Hi

Noticing one weird issue where ElasticsearchClient.healthReport() gives status as Yellow even though the cluster status is green

/_cluster/health

{
  "cluster_name": "es_cluster",
  "status": "green",
  "timed_out": false,
  "number_of_nodes": 18,
  "number_of_data_nodes": 6,
  "active_primary_shards": 567,
  "active_shards": 1098,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 0,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 100.0
}

code snippet used to get the report

ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true);
HealthReportResponse report = client.healthReport();
ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(false);

ElasticsearchClient.healthReport() call debug response

Please let me know if any other information will help

Which version of Elasticsearch are you using?

The cluster name does seem to be the same.

Are you sure you are talking to the same cluster?

i am using version 8.12.2

yes just modified the name in the question to avoid exposing the name

Hello! I see you're disabling the required properties check, likely because otherwise the call won't work. We have recently fixed the client so that cluster().health() can now be called without exception, so could you try using a version of the java client > 8.15.0?

I have tested this myself, the status green is returned correctly:

1 Like

@ltrotta Thank you for the quick response. the solution works with the current version i am using 8.12.2. is there any optimisation or bug fixes present in version >8.15.0 or i can go ahead with the current version.

@sibasish.palo there are many bugfixes on the client side, but ideally I recommend using a version of the client closest to the version of the server, so that there's no discrepancy between the API definitions.

One other thing that I'm not sure was clear here -- /cluster/health and /_health_report are two very different things, despite having misleadingly similar names and response colors. /_cluster/health only gives information about whether shards are allocated. /_health_report checks a lot of things throughout the cluster (including shard allocation). So it would not be unusual for /_cluster/health to report green (all shards are allocated) but /_health_report to report yellow (for any of a wide variety of reasons)

Thank you for the details, found the issue why the cluster is showing Yellow status