|
@@ -133,4 +133,13 @@ public class MappingParserTests extends MapperServiceTestCase {
|
|
|
);
|
|
|
assertEquals("Type [alias] cannot be used in multi field", e.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ public void testBadMetadataMapper() throws IOException {
|
|
|
+ XContentBuilder builder = topMapping(b -> { b.field(RoutingFieldMapper.NAME, "required"); });
|
|
|
+ IllegalArgumentException e = expectThrows(
|
|
|
+ IllegalArgumentException.class,
|
|
|
+ () -> createMappingParser(Settings.EMPTY).parse("_doc", new CompressedXContent(BytesReference.bytes(builder)))
|
|
|
+ );
|
|
|
+ assertEquals("[_routing] config must be an object", e.getMessage());
|
|
|
+ }
|
|
|
}
|