Map all int and long datavalues to string


(erbdex) #1

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


(system) #2