Elasticsearch Default Display

My real understanding is

  • Elasticsearch creates display indexes the first time you receive JSON datasets.
  • This mapping cannot be changed, but the datasets can be re-mapped.

Question -

Forget about re-matching. Is there a way to tell ES to behave by default as -

"Consider everything that is not a date to be of string type"?

Also, will I lose much if I do this?

Update -

I added a file config/mappings/_default/mapping.jsonwith the following contents -

{
    "dynamic_templates": [
        {
            "template_1": {
                "match": "*",
                "match_mapping_type": "int",
                "mapping": {
                    "type": "string"
                }
            },
            "template_2": {
                "match": "*",
                "match_mapping_type": "long",
                "mapping": {
                    "type": "string"
                }
            }
        }
    ]
}

I also tried to install the following at-config/default_mapping.json

{
    "_default_" : {
        "match": "*",
        "match_mapping_type": "int",
        "mapping": {
                "type": "string"
        }
    }
}

"" - , int long string. int long string , ? dynamic_templates _all?

II -

, elasticsearch -

[2014-02-04 10:48:34,396][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
    at org.elasticsearch.index.mapper.DocumentMapperParser.extractMapping(DocumentMapperParser.java:268)
    at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:155)
    at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:314)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:193)
    at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:309)
    ... 5 more
2014-02-04 10:48:34 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2014-02-04 10:48:33 +0000 error_class="Net::HTTPServerException" error="400 \"Bad Request\"" instance=17509700
+3
1

, , , . , , , , json ( ). , , .

apis , , . , - . , , put mapping api , , .

, . , . multi-fields, .

, , , , . . , , .

+6

All Articles