# Should "NaN" string be in a float field?

**URL:** <https://discuss.elastic.co/t/should-nan-string-be-in-a-float-field/164121>\
**Category:** Elasticsearch\
**Created:** [January 14, 2019, 9:57am UTC](https://discuss.elastic.co/t/should-nan-string-be-in-a-float-field/164121 "2019-01-14T09:57:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DidierB](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@DidierB](https://discuss.elastic.co/u/DidierB)\
**Post date:** [January 14, 2019, 9:57am UTC](https://discuss.elastic.co/t/should-nan-string-be-in-a-float-field/164121/1 "2019-01-14T09:57:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 11, 2019, 10:11am UTC](https://discuss.elastic.co/t/should-nan-string-be-in-a-float-field/164121/2 "2019-02-11T10:11:58Z")

</div>

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