diff --git a/src/main/java/org/elasticsearch/index/mapper/object/DynamicTemplate.java b/src/main/java/org/elasticsearch/index/mapper/object/DynamicTemplate.java index ae6126bbace..08888e9aea2 100644 --- a/src/main/java/org/elasticsearch/index/mapper/object/DynamicTemplate.java +++ b/src/main/java/org/elasticsearch/index/mapper/object/DynamicTemplate.java @@ -154,7 +154,7 @@ public class DynamicTemplate { } public String mappingType(String dynamicType) { - return mapping.containsKey("type") ? mapping.get("type").toString() : dynamicType; + return mapping.containsKey("type") ? mapping.get("type").toString().replace("{dynamic_type}", dynamicType).replace("{dynamicType}", dynamicType) : dynamicType; } private boolean patternMatch(String pattern, String str) { diff --git a/src/test/java/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json b/src/test/java/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json index fa0293c89f7..9c8f8d8e6a3 100644 --- a/src/test/java/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json +++ b/src/test/java/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json @@ -5,13 +5,10 @@ "tempalte_1":{ "match":"multi*", "mapping":{ - "type":"multi_field", + "type":"{dynamic_type}", + "index":"analyzed", + "store":"yes", "fields":{ - "{name}":{ - "type":"{dynamic_type}", - "index":"analyzed", - "store":"yes" - }, "org":{ "type":"{dynamic_type}", "index":"not_analyzed",