# Mapping longs and doubles

**URL:** <https://discuss.elastic.co/t/mapping-longs-and-doubles/50463>\
**Category:** Elasticsearch\
**Created:** [May 19, 2016, 3:37pm UTC](https://discuss.elastic.co/t/mapping-longs-and-doubles/50463 "2016-05-19T15:37:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tswider](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@tswider](https://discuss.elastic.co/u/tswider)\
**Post date:** [May 19, 2016, 3:37pm UTC](https://discuss.elastic.co/t/mapping-longs-and-doubles/50463/1 "2016-05-19T15:37:30Z")

</div>

Can I set mapping so es will force longs into doubles on insert? I am indexing telemetry events for a game and I have no idea what will come in any particular event, it is difficult to prevent type conflicts. It would be nice if I could force all numbers into doubles. Thank you for your help 🙂

---

<div class="post-metadata">

**Author:** ![tswider](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@tswider](https://discuss.elastic.co/u/tswider)\
**Post date:** [May 20, 2016, 8:43am UTC](https://discuss.elastic.co/t/mapping-longs-and-doubles/50463/2 "2016-05-20T08:43:31Z")

</div>

Ok I have it. To do that you need to add this to the mapping:  
`{ ____"dynamic_templates": [________{ ____________"longs": {________________"mapping": { ____________________"type": "double"________________ }, ________________"match_mapping_type": "long"____________ } ________}____] }`

sorry for the strange lines but I do not know how to fix the formatting on that page

---

<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, 10:50pm UTC](https://discuss.elastic.co/t/mapping-longs-and-doubles/50463/3 "2017-07-05T22:50:10Z")

</div>


