-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Open
Labels
:Data Management/Health>bugTeam:Data ManagementMeta label for data/management teamMeta label for data/management team
Description
Elasticsearch Version
elasticsearch-9.2.0-SNAPSHOT
Installed Plugins
No response
Java Version
bundled
OS Version
Ubuntu 24.04.1 LTS
Problem Description
When restarting an Elasticsearch cluster, if an ES process starts successfully but no shards have been loaded yet, executing _cluster/health
may return "active_shards_percent_as_number": "NaN"
.
This happens because at that moment the cluster has not loaded any shards, so totalShardCount == 0
. Since the cluster state is not GREEN
, the calculation of active_shards_percent_as_number
results in NaN
.
// ClusterStateHealth.java
if (computeStatus.equals(ClusterHealthStatus.GREEN)) {
this.activeShardsPercent = 100;
} else {
this.activeShardsPercent = (((double) this.activeShards) / totalShardCount) * 100;
}
{
"cluster_name": "es-cluster",
"status": "yellow",
"timed_out": false,
"number_of_nodes": 3,
"number_of_data_nodes": 0,
"active_primary_shards": 0,
"active_shards": 0,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 190,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 1345,
"active_shards_percent_as_number": "NaN"
}
Steps to Reproduce
As described above
Logs (if relevant)
No response
Metadata
Metadata
Assignees
Labels
:Data Management/Health>bugTeam:Data ManagementMeta label for data/management teamMeta label for data/management team