I am new to elasticseach and trying to implement small assignment for my own learning prospect. I am referring https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html link to create a dynamic template; however while running the query mentioned below I am getting "type" : "mapper_parsing_exception", "reason" : "Root mapping definition has unsupported parameters: error .
Can someone please assist me with the error? looks like I haven't defined my template name in proper place .
PUT e_review_dynamictemplate
{
"mappings": {
"date_detection": true,
"dynamic_date_formats": ["dd/MM/yyyy"],
"numeric_detection": true,
"My_dynamic_templates": [
{
"e_full_name": {
"path_match": "*_Name",
"mapping": {
"type": "text",
"copy_to": "e_full_name",
"norms": false
}
},
"integers": {
"match_mapping_type": "long",
"mapping": {
"type": "integer",
"index": false
}
},
"strings": {
"match_mapping_type": "string",
"match": "Achievements:*",
"unmatch": "Improvements:*",
"mapping": {
"type": "long"
}
}
}
]
}
}
Thanks in advance! Nivedita
CodePudding user response:
you just missed the dynamic_templates properties in the mappings object. You just have to replace My_dynamic_templates by dynamic_templates.
The custom names are used in template definitions inside the dynamic_templates array.
Here is the corrected snippet :
PUT e_review_dynamictemplate
{
"mappings": {
"date_detection": true,
"dynamic_date_formats": [
"dd/MM/yyyy"
],
"numeric_detection": true,
"dynamic_templates": [
{
"e_full_name": {
"path_match": "*_Name",
"mapping": {
"type": "text",
"copy_to": "e_full_name",
"norms": false
}
}
},
{
"integers": {
"match_mapping_type": "long",
"mapping": {
"type": "integer",
"index": false
}
}
},
{
"strings": {
"match_mapping_type": "string",
"match": "Achievements:*",
"unmatch": "Improvements:*",
"mapping": {
"type": "long"
}
}
}
]
}
}
