Improved error message when the mapping document is malformed
This commit is contained in:
parent
7f0115ba9a
commit
27518b5e41
|
@ -242,6 +242,10 @@ public class DocumentMapperParser extends AbstractIndexComponent {
|
|||
throw new MapperParsingException("failed to parse mapping definition", e);
|
||||
}
|
||||
|
||||
if (root.keySet().size() == 0) {
|
||||
throw new MapperParsingException("malformed mapping definition: no JSON root object found");
|
||||
}
|
||||
|
||||
// we always assume the first and single key is the mapping type root
|
||||
if (root.keySet().size() != 1) {
|
||||
throw new MapperParsingException("mapping must have the `type` as the root object");
|
||||
|
|
Loading…
Reference in New Issue