elastic / elasticsearch-java

Official Elasticsearch Java Client
Apache License 2.0
397 stars 228 forks source link

Deserilizing error calling the healthReport() method. #834

Closed p4paul closed 1 week ago

p4paul commented 1 month ago

Java API client version

8.13.4

Java version

17

Elasticsearch Version

8.10.2

Problem description

I'm using co.elastic.clients:elasticsearch-java:8.13.4 and get a deserilizing error calling the healthReport() method:

HealthReportResponse health = myEsClient.healthReport();

Error:

co.elastic.clients.json.JsonpMappingException: 
Error deserializing co.elastic.clients.elasticsearch.core.health_report.SlmIndicator:
 co.elastic.clients.util.MissingRequiredPropertyException:
 Missing required property 'SlmIndicatorDetails.unhealthyPolicies' (JSON path: indicators.slm.details) (line no=1, column no=1294, offset=-1)

Debugging ElasticsearchTransportBase shows the response 'resp':

requestLine: GET /_health_report HTTP/1.1

is OK (HTTP/1.1 200 OK) I can also call this over REST and get some JSON, however your deceriliser breaks...

The value of content at line ElasticsearchTransportBase:396

{"status":"green","cluster_name":"docker-cluster","indicators":{"master_is_stable":{"status":"green","symptom":"The cluster has a stable master node","details":{"current_master":{"node_id":"uPJ5mfP4RP-UMnMU6C5ugQ","name":"es"},"recent_masters":[{"node_id":"uPJ5mfP4RP-UMnMU6C5ugQ","name":"es"}]}},"repository_integrity":{"status":"green","symptom":"No snapshot repositories configured."},"shards_availability":{"status":"green","symptom":"This cluster has all shards available.","details":{"creating_primaries":0,"unassigned_replicas":0,"restarting_primaries":0,"restarting_replicas":0,"initializing_primaries":0,"started_replicas":0,"initializing_replicas":0,"unassigned_primaries":0,"started_primaries":0}},"disk":{"status":"green","symptom":"The cluster has enough available disk space.","details":{"indices_with_readonly_block":0,"nodes_with_enough_disk_space":1,"nodes_with_unknown_disk_status":0,"nodes_over_high_watermark":0,"nodes_over_flood_stage_watermark":0}},"shards_capacity":{"status":"green","symptom":"The cluster has enough room to add new shards.","details":{"data":{"max_shards_in_cluster":1000},"frozen":{"max_shards_in_cluster":3000}}},"slm":{"status":"green","symptom":"No Snapshot Lifecycle Management policies configured","details":{"slm_status":"RUNNING","policies":0}},"ilm":{"status":"green","symptom":"Index Lifecycle Management is running","details":{"policies":20,"stagnating_indices":0,"ilm_status":"RUNNING"}}}}

Originally mentioned here... https://discuss.elastic.co/t/error-using-java-api-calling-elasticsearchclient-method-healthreport/361478