Ensure that field mappings are given a type

This commit is contained in:
Matthew Bargar 2015-11-18 20:36:38 -05:00
parent 2dcbbf6006
commit 675bb7c0c6
2 changed files with 16 additions and 1 deletions

View file

@ -8,7 +8,9 @@ module.exports = Joi.object({
name: Joi.string().required(),
count: Joi.number().integer(),
scripted: Joi.boolean(),
mapping: Joi.object()
mapping: Joi.object({
type: Joi.string().required()
}).unknown()
})),
fieldFormatMap: Joi.object()
});

View file

@ -31,8 +31,21 @@ define(function (require) {
.send(_.assign(createTestData().indexPatternWithMappings, {fields: {}}))
.expect(400),
// Fields must have a name
request.post('/index-patterns')
.send(_.assign(createTestData().indexPatternWithMappings, {fields: [{count: 0}]}))
.expect(400),
// Mapping requires type
request.post('/index-patterns')
.send(_.assign(createTestData().indexPatternWithMappings, {
fields: [{
'name': 'geo.coordinates',
'count': 0,
'scripted': false,
'mapping': {'index': 'not_analyzed', 'doc_values': false}
}]
}))
.expect(400)
]);
});