# Map all int and long datavalues to string

**URL:** <https://discuss.elastic.co/t/map-all-int-and-long-datavalues-to-string/15590>\
**Category:** Elasticsearch\
**Created:** [February 4, 2014, 11:36am UTC](https://discuss.elastic.co/t/map-all-int-and-long-datavalues-to-string/15590 "2014-02-04T11:36:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erbdex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erbdex/32/1520_2.png) [@erbdex](https://discuss.elastic.co/u/erbdex)\
**Post date:** [February 4, 2014, 11:36am UTC](https://discuss.elastic.co/t/map-all-int-and-long-datavalues-to-string/15590/1 "2014-02-04T11:36:30Z")

</div>

i am looking at mapping _all_ the int/long/float/double values that elasticsearch receives to string type.

This is what i have done-

1. Created config/mappings/\_default/mapping.json
2. Added-  
{  
"data" : {  
"dynamic\_templates" : [  
{  
"string\_template" : {  
"match" : "\*",  
"match\_mapping\_type" : "int",  
"mapping" : {  
"type" : "string"  
}  
}  
}  
]  
}  
}

ES is throwing this exception-

[2014-02-04 11:27:33,550][DEBUG][action.admin.indices.create] [Her] [logstash-2014.02.04] failed to create  
org.elasticsearch.index.mapper.MapperParsingException: mapping [mapping.json]  
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:312)  
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:298)  
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:135)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:701)  
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map

---

<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, 1:52am UTC](https://discuss.elastic.co/t/map-all-int-and-long-datavalues-to-string/15590/2 "2017-07-06T01:52:46Z")

</div>


