Should "NaN" string be in a float field?

Hello,
I collect information on metrics on my Elasticsearchs. I've seen the following return of API _health (v5.5.0):

Mon Jan 14 10:46:52 CET 2019
{
"cluster_name" : "my cluster",
"status" : "red",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 3,
"number_of_in_flight_fetch" : 1842,
"task_max_waiting_in_queue_millis" : 6993,
"active_shards_percent_as_number" : "NaN"
}
Mon Jan 14 10:47:52 CET 2019
{
"cluster_name" : "mycluster",
"status" : "red",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 14956,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 194,
"number_of_in_flight_fetch" : 2108,
"task_max_waiting_in_queue_millis" : 67039,
"active_shards_percent_as_number" : 0.0
}

As you can see, if I send those API return in a ES index for monitoring, the active_shards_percent_as_number field should be defined as float but what would happen if this NaN string comes? If it's the first of a new daily index it will set this field as a string and any event with float will be discarded, if the mapping is forced to float this event will be discarded. In fact, I use ES since years, I didn't even know that "NaN" string could appear in this field.

I think the best thing is that if it's a NaN, the field should not be put in the API return json object.

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