# (RE)Unable to Use the dynamic template,for short,byte & float

**URL:** <https://discuss.elastic.co/t/re-unable-to-use-the-dynamic-template-for-short-byte-float/121438>\
**Category:** Elasticsearch\
**Created:** [February 26, 2018, 6:34am UTC](https://discuss.elastic.co/t/re-unable-to-use-the-dynamic-template-for-short-byte-float/121438 "2018-02-26T06:34:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [February 26, 2018, 6:34am UTC](https://discuss.elastic.co/t/re-unable-to-use-the-dynamic-template-for-short-byte-float/121438/1 "2018-02-26T06:34:20Z")

</div>

I am trying to create a template, in my template m trying to achive the dynamic mapping

Here is what i wrote,as in 6.2.1 the only boolean, date, double, long, object, string are automatically detected,facing issues for mapping the float,short & byte

Here if i index 127,its will be mapped to short from the short\_fields ,its fine,but while indexing 325566 ,getting exception Numeric value (325566) out of range of Java short,i want to suppress this and let long\_fields,should take care about this & it should be mapped to long. I have tried with corse:false,ignore\_malformed:true none of the worked as excpected,same with byte ,getting invalid byte object

```
[  
   "dynamic_templates":[  
      {  
         {  
            "short_fields":{  
               "match":"*",
               "match_mapping_type":"long",
               "mapping":{  
                  "type":"short",
                  "doc_values":true
               }
            }
         },
         {  
            "long_fields":{  
               "match":"*",
               "match_mapping_type":"long",
               "mapping":{  
                  "type":"long",
                  "doc_values":true
               }
            }
         }
```

---

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [February 26, 2018, 10:59am UTC](https://discuss.elastic.co/t/re-unable-to-use-the-dynamic-template-for-short-byte-float/121438/2 "2018-02-26T10:59:52Z")

</div>

How can we fix this?

---

<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:** [March 26, 2018, 11:12am UTC](https://discuss.elastic.co/t/re-unable-to-use-the-dynamic-template-for-short-byte-float/121438/3 "2018-03-26T11:12:57Z")

</div>

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