|
@@ -49,6 +49,15 @@ public class DynamicTemplateTests extends ESTestCase {
|
|
|
templateDef.put("mapping", Collections.singletonMap("store", true));
|
|
|
// if a wrong match type is specified, we ignore the template
|
|
|
assertNull(DynamicTemplate.parse("my_template", templateDef, Version.V_5_0_0_alpha5));
|
|
|
+
|
|
|
+ Map<String, Object> templateDef2 = new HashMap<>();
|
|
|
+ templateDef2.put("match_mapping_type", "text");
|
|
|
+ templateDef2.put("mapping", Collections.singletonMap("store", true));
|
|
|
+ // if a wrong match type is specified, we ignore the template
|
|
|
+ IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
|
|
|
+ () -> DynamicTemplate.parse("my_template", templateDef2, Version.V_6_0_0_alpha1_UNRELEASED));
|
|
|
+ assertEquals("No xcontent type matched on [text], possible values are [object, string, long, double, boolean, date, binary]",
|
|
|
+ e.getMessage());
|
|
|
}
|
|
|
|
|
|
public void testMatchAllTemplate() {
|