# 0.54 \* 1000 = -8646911284551352000 in script\_field?!

**URL:** https://discuss.elastic.co/t/0-54-1000-8646911284551352000-in-script-field/23078
**Category:** Elasticsearch
**Created:** [April 3, 2015, 8:04am UTC](https://discuss.elastic.co/t/0-54-1000-8646911284551352000-in-script-field/23078 "2015-04-03T08:04:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![chenryn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chenryn/32/44917_2.png) [@chenryn](https://discuss.elastic.co/u/chenryn)
#### Post date: [April 3, 2015, 8:04am UTC](https://discuss.elastic.co/t/0-54-1000-8646911284551352000-in-script-field/23078/1 "2015-04-03T08:04:22Z")

</div>

$ cat test.sh  
curl  
1003.es.dip.sina.com.cn:9200/logstash-mweibo-nginx-2015.04.03/v5nginx/\_search?q=\_id:AUx-QvSBS-dhpiB8\_1f1&pretty  
-d '{  
"fields": ["request\_time"],  
"script\_fields" : {  
"test1" : {  
"script" : "doc["request\_time"].value"  
},  
"test2" : {  
"script" : "doc["request\_time"].value \* 1000"  
}  
}  
}'

$ sh test.sh  
{  
"took" : 7,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 56,  
"successful" : 56,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "logstash-mweibo-nginx-2015.04.03",  
"\_type" : "v5nginx",  
"\_id" : "AUx-QvSBS-dhpiB8\_1f1",  
"\_score" : 1.0,  
"fields" : {  
"test2" : [-8646911284551352000],  
"test1" : [4603039107142836552],  
"request\_time" : [0.54]  
}  
} ]  
}  
}

WHY?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CABwsoojyVwcf%2BuyG8TuWXEFSwj20L3FFyEKqJVyf8F02oy\_4Zw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABwsoojyVwcf%2BuyG8TuWXEFSwj20L3FFyEKqJVyf8F02oy_4Zw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [April 3, 2015, 9:47am UTC](https://discuss.elastic.co/t/0-54-1000-8646911284551352000-in-script-field/23078/2 "2015-04-03T09:47:57Z")

</div>

I think you are encoutering this bug:  
[Mapping updates should be synchronous · Issue #8688 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/8688). One of your shard  
dynamically mapped request\_time as an long and another one as a double. And  
at some point your shards got relocated what you see happening here is that  
the bits of your double value 0.54 are interpreted as a long by  
elasticsearch. The only way to work around this issue for now is to define  
mappings explicitely.

On Fri, Apr 3, 2015 at 10:04 AM, chenlin rao [rao.chenlin@gmail.com](mailto:rao.chenlin@gmail.com) wrote:

> $ cat test.sh  
> curl  
> [1003.es.dip.sina.com.cn:9200/logstash-mweibo-nginx-2015.04.03/v5nginx/\_search?q=\_id:AUx-QvSBS-dhpiB8\_1f1](http://1003.es.dip.sina.com.cn:9200/logstash-mweibo-nginx-2015.04.03/v5nginx/_search?q=_id:AUx-QvSBS-dhpiB8_1f1)&pretty  
> [http://1003.es.dip.sina.com.cn:9200/logstash-mweibo-nginx-2015.04.03/v5nginx/\_search?q=\_id:AUx-QvSBS-dhpiB8\_1f1\&pretty](http://1003.es.dip.sina.com.cn:9200/logstash-mweibo-nginx-2015.04.03/v5nginx/_search?q=_id:AUx-QvSBS-dhpiB8_1f1%5C&pretty)  
> -d '{  
> "fields": ["request\_time"],  
> "script\_fields" : {  
> "test1" : {  
> "script" : "doc["request\_time"].value"  
> },  
> "test2" : {  
> "script" : "doc["request\_time"].value \* 1000"  
> }  
> }  
> }'
> 
> $ sh test.sh  
> {  
> "took" : 7,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 56,  
> "successful" : 56,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "logstash-mweibo-nginx-2015.04.03",  
> "\_type" : "v5nginx",  
> "\_id" : "AUx-QvSBS-dhpiB8\_1f1",  
> "\_score" : 1.0,  
> "fields" : {  
> "test2" : [-8646911284551352000],  
> "test1" : [4603039107142836552],  
> "request\_time" : [0.54]  
> }  
> } ]  
> }  
> }
> 
> WHY?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CABwsoojyVwcf%2BuyG8TuWXEFSwj20L3FFyEKqJVyf8F02oy\_4Zw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABwsoojyVwcf%2BuyG8TuWXEFSwj20L3FFyEKqJVyf8F02oy_4Zw%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CABwsoojyVwcf%2BuyG8TuWXEFSwj20L3FFyEKqJVyf8F02oy\_4Zw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CABwsoojyVwcf%2BuyG8TuWXEFSwj20L3FFyEKqJVyf8F02oy_4Zw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAO5%3DkAgpq06MAEXuK02L3rLaha4u8dK216p%3DZj-pLbejPT6xgg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAO5%3DkAgpq06MAEXuK02L3rLaha4u8dK216p%3DZj-pLbejPT6xgg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:21am UTC](https://discuss.elastic.co/t/0-54-1000-8646911284551352000-in-script-field/23078/3 "2017-07-06T00:21:53Z")

</div>


