mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
added missing package field mappings (#128391)
This commit is contained in:
parent
f289a5d78b
commit
0695df6497
2 changed files with 51 additions and 3 deletions
|
@ -157,6 +157,27 @@ describe('EPM template', () => {
|
|||
expect(mappings).toEqual(longWithIndexFalseMapping);
|
||||
});
|
||||
|
||||
it('tests processing keyword field with doc_values false', () => {
|
||||
const keywordWithIndexFalseYml = `
|
||||
- name: keywordIndexFalse
|
||||
type: keyword
|
||||
doc_values: false
|
||||
`;
|
||||
const keywordWithIndexFalseMapping = {
|
||||
properties: {
|
||||
keywordIndexFalse: {
|
||||
ignore_above: 1024,
|
||||
type: 'keyword',
|
||||
doc_values: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
const fields: Field[] = safeLoad(keywordWithIndexFalseYml);
|
||||
const processedFields = processFields(fields);
|
||||
const mappings = generateMappings(processedFields);
|
||||
expect(mappings).toEqual(keywordWithIndexFalseMapping);
|
||||
});
|
||||
|
||||
it('tests processing text field with multi fields', () => {
|
||||
const textWithMultiFieldsLiteralYml = `
|
||||
- name: textWithMultiFields
|
||||
|
@ -378,6 +399,34 @@ describe('EPM template', () => {
|
|||
expect(mappings).toEqual(keywordWithMultiFieldsMapping);
|
||||
});
|
||||
|
||||
it('tests processing wildcard field with multi fields with match_only_text type', () => {
|
||||
const wildcardWithMultiFieldsLiteralYml = `
|
||||
- name: wildcardWithMultiFields
|
||||
type: wildcard
|
||||
multi_fields:
|
||||
- name: text
|
||||
type: match_only_text
|
||||
`;
|
||||
|
||||
const wildcardWithMultiFieldsMapping = {
|
||||
properties: {
|
||||
wildcardWithMultiFields: {
|
||||
ignore_above: 1024,
|
||||
type: 'wildcard',
|
||||
fields: {
|
||||
text: {
|
||||
type: 'match_only_text',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const fields: Field[] = safeLoad(wildcardWithMultiFieldsLiteralYml);
|
||||
const processedFields = processFields(fields);
|
||||
const mappings = generateMappings(processedFields);
|
||||
expect(mappings).toEqual(wildcardWithMultiFieldsMapping);
|
||||
});
|
||||
|
||||
it('tests processing object field with no other attributes', () => {
|
||||
const objectFieldLiteralYml = `
|
||||
- name: objectField
|
||||
|
|
|
@ -244,9 +244,8 @@ function generateMultiFields(fields: Fields): MultiFields {
|
|||
multiFields[f.name] = { ...generateKeywordMapping(f), type: f.type };
|
||||
break;
|
||||
case 'long':
|
||||
multiFields[f.name] = { type: f.type };
|
||||
break;
|
||||
case 'double':
|
||||
case 'match_only_text':
|
||||
multiFields[f.name] = { type: f.type };
|
||||
break;
|
||||
}
|
||||
|
@ -302,7 +301,7 @@ function getDefaultProperties(field: Field): Properties {
|
|||
if (field.index !== undefined) {
|
||||
properties.index = field.index;
|
||||
}
|
||||
if (field.doc_values) {
|
||||
if (field.doc_values !== undefined) {
|
||||
properties.doc_values = field.doc_values;
|
||||
}
|
||||
if (field.copy_to) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue