Dynamic templates exception

Hello,

I am updating the version 1.7 to 5.0 of ElasticSearch.

I have the following exception concerning a json mapping :

MapperParsingException[Failed to parse mapping [service]: Mapping definition for [prices] has unsupported parameters: [dynamic_templates : [{prices={mapping={type=integer}, match_mapping_type=text}}]]]; nested: MapperParsingException[Mapping definition for [prices] has unsupported parameters: [dynamic_templates : [{prices={mapping={type=integer}, match_mapping_type=text}}]]];

// my json code

 {
    "service" : {
        "dynamic": "false",
        "_source": {
            "excludes": [
                "facets",
                "filters",
                "searchText",
                "pubSearchText",
                "sort"
            ]
        },
        "properties": {
            "category":                  { "type": "integer" },
            "brand":                     { "type": "text", "index": "not_analyzed" },
            "facets":                    { "type": "text", "index": "not_analyzed" },
            "filters":                   { "type": "keyword", "index": "not_analyzed" },
            "searchText":                { "type": "text", "index": "analyzed", "search_analyzer" : "analyzer", "analyzer" : "index_analyzer"},
            "pubSearchText":             { "type": "text", "index": "analyzed", "analyzer": "folding" },
            "reference":                 { "type": "text", "index": "analyzed", "analyzer": "folding" },
            "brandName":                 { "type": "text", "index": "analyzed", "analyzer": "folding" },
            "categoryName":              { "type": "text", "index": "analyzed", "analyzer": "folding" },
            "sort" : {
                "properties": {
                    "prices": {
                        "dynamic": "true",
                        "type": "object",
                        "dynamic_templates": [{
                            "prices" : {
                                "match" : "*",
                                "mapping" : { "type" : "integer" }
                            }
                        }]
                    },
                    "px12":                 { "type": "integer" },
                    "px24":                 { "type": "integer" },
                    "pxSe":                 { "type": "integer" },
                    "publishedDate":        { "type": "long"    },
                    "salesLevel":           { "type": "integer" },
                    "dartyComSort":         { "type": "integer" }
                }
            }
        }
		
    }
}

I think "dynamic_templates" is misplaced.

Please help me :slight_smile:

Thank you very much.

dynamic_templates are a top level feature of mappings. they need to be at the same level as the root dynamic setting. See https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html

Ok thanks.

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