# Statistical Facets starts returning inconsistent values (very large numbers 1E18)

**URL:** https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883
**Category:** Elasticsearch
**Created:** [May 19, 2015, 7:57am UTC](https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883 "2015-05-19T07:57:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gbilic](https://avatars.discourse-cdn.com/v4/letter/g/90ced4/32.png) [@gbilic](https://discuss.elastic.co/u/gbilic)
#### Post date: [May 19, 2015, 7:57am UTC](https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883/1 "2015-05-19T07:57:03Z")

</div>

Hi,

We are running an 8 nodes cluster of elastic v1.5.  
We are experiencing a strange behavior of statistical facets queries on one particular field (type double) of an index (4 shards, 1 replica).  
It's starting to return very large values (like 1E18) for total, max, mean, sum\_of\_squares, variance and std\_deviation. Min and count values are correct. It happens even on small doc count, we get the same result with sum aggregation.

Did anyone already experience this issue ?  
How to fix it ? (close/open index, reindex, cluster restart)

Thanx in advance,  
Guillaume

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [May 19, 2015, 9:39am UTC](https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883/2 "2015-05-19T09:39:40Z")

</div>

I think you got hit by this bug: [https://github.com/elastic/elasticsearch/issues/8688](https://github.com/elastic/elasticsearch/issues/8688) which will be fixed in 2.0. What probably happened is that you field got dynamically mapped as a long on a shard and a double on another shard, then shard moved and you either ended up interpreting long bits as doubles or double bits as longs. The only work-around in 1.x would be to map fields explicitely prior to indexing. Unfortunately in your case there is not other fix than reindexing.

---

<div class="post-metadata">

### Author: ![gbilic](https://avatars.discourse-cdn.com/v4/letter/g/90ced4/32.png) [@gbilic](https://discuss.elastic.co/u/gbilic)
#### Post date: [May 19, 2015, 12:05pm UTC](https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883/3 "2015-05-19T12:05:01Z")

</div>

Thank you Adrien.  
Do you think we can use the documents of the actual index and reindex them in another one ? Strangely the values seem correct.

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [May 19, 2015, 12:22pm UTC](https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883/4 "2015-05-19T12:22:52Z")

</div>

You can use the `_source` documents to reindex, the issues are only within the index and/or doc values.

---

<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: [July 6, 2017, 12:13am UTC](https://discuss.elastic.co/t/statistical-facets-starts-returning-inconsistent-values-very-large-numbers-1e18/883/5 "2017-07-06T00:13:18Z")

</div>


