# Index 'string' type to field mapping type of 'float' or 'double' results in 'string'

**URL:** https://discuss.elastic.co/t/index-string-type-to-field-mapping-type-of-float-or-double-results-in-string/38233
**Category:** Elasticsearch
**Created:** [December 31, 2015, 7:44pm UTC](https://discuss.elastic.co/t/index-string-type-to-field-mapping-type-of-float-or-double-results-in-string/38233 "2015-12-31T19:44:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![horse\_badorties\_ny](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@horse\_badorties\_ny](https://discuss.elastic.co/u/horse_badorties_ny)
#### Post date: [December 31, 2015, 7:44pm UTC](https://discuss.elastic.co/t/index-string-type-to-field-mapping-type-of-float-or-double-results-in-string/38233/1 "2015-12-31T19:44:42Z")

</div>

Hello,

I have a mapping for a field in v1.7.1 where "dynamic": "strict", such as:

```auto
{
  "score": {
    "type": "float"
  }
}

```

Per the note in [mapping](https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-intro.html#mapping-intro) , I would think that the string value would be converted to the field type if possible and throw an error if not.

If the doc inserted has a string value for 'score', such as "1.1", es appears to index the field as a string. I get the same result if the field type is 'double'.

`{ "score": "1.1"}`

If the doc inserted has a number type for 'score', such as 1.1, es indexes it as the field type.

`{ "score": 1.1}`

If the field type is set to 'long' and insert the string "1.1", I receive an expected NumberFormatException.

I have tried setting the "ignore\_malformed" value to false, with no change in the results.

Should I expected a string value to be typed to the field's type and throw an error if the type conversion fails? If not, what are the expected results?

---

<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 5, 2017, 11:27pm UTC](https://discuss.elastic.co/t/index-string-type-to-field-mapping-type-of-float-or-double-results-in-string/38233/2 "2017-07-05T23:27:35Z")

</div>


