Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down