# Failed to put mappings on indices:cannot be changed from type \[float\] to \[long\]

**URL:** https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230
**Category:** Elasticsearch
**Created:** [November 26, 2016, 3:11am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230 "2016-11-26T03:11:22Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)
#### Post date: [November 26, 2016, 3:11am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/1 "2016-11-26T03:11:22Z")

</div>

sometimes we got such exception on ES log :[customFields.ext\_default\_UDF104547548283008] cannot be changed from type [float] to [long].  
And these field were from user input, the data can be float or long, why ES will raise this error?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 26, 2016, 4:53am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/2 "2016-11-26T04:53:10Z")

</div>

They are two different structures, you can't convert between them without losing some of the contents of a float value.

---

<div class="post-metadata">

### Author: ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)
#### Post date: [November 27, 2016, 2:07pm UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/3 "2016-11-27T14:07:17Z")

</div>

OK thanks.  
so, you mean this exception just tell me there some content lose, but the whole document still update successfully?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 27, 2016, 7:46pm UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/4 "2016-11-27T19:46:46Z")

</div>

No, it rejects the doc.

---

<div class="post-metadata">

### Author: ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)
#### Post date: [November 28, 2016, 1:52am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/5 "2016-11-28T01:52:24Z")

</div>

ok, thanks. I have no idea how to fix it. Like the inner field below, next time the value maybe changed to 100.00, i should make it save successfully.

"ext\_default\_UDF105095590305856": {  
"value": 100,  
"currency": "USD"  
},

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 28, 2016, 2:33am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/6 "2016-11-28T02:33:55Z")

</div>

You need to normalise it before sending to ES.

---

<div class="post-metadata">

### Author: ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)
#### Post date: [November 28, 2016, 9:32am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/7 "2016-11-28T09:32:43Z")

</div>

It's not easy to do that, since the filed name is dynamic too. ☹

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [November 28, 2016, 11:02am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/8 "2016-11-28T11:02:51Z")

</div>

Having dynamic field names like that can be very inefficient and cause problems in the form of [mapping explosion](https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion) unless the expected number of dynamically generated fields is low.

---

<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: [December 26, 2016, 11:02am UTC](https://discuss.elastic.co/t/failed-to-put-mappings-on-indices-cannot-be-changed-from-type-float-to-long/67230/9 "2016-12-26T11:02:55Z")

</div>

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