[Fleet] Don't ignore "index: false" in integration index template (#110234)
* fix: don't ignore index prop when falsey * test: add unit test for index false
This commit is contained in:
parent
602392e88d
commit
2a05ec9ff5
|
@ -174,6 +174,26 @@ describe('EPM template', () => {
|
|||
expect(template).toMatchSnapshot(path.basename(ymlPath));
|
||||
});
|
||||
|
||||
it('tests processing long field with index false', () => {
|
||||
const longWithIndexFalseYml = `
|
||||
- name: longIndexFalse
|
||||
type: long
|
||||
index: false
|
||||
`;
|
||||
const longWithIndexFalseMapping = {
|
||||
properties: {
|
||||
longIndexFalse: {
|
||||
type: 'long',
|
||||
index: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
const fields: Field[] = safeLoad(longWithIndexFalseYml);
|
||||
const processedFields = processFields(fields);
|
||||
const mappings = generateMappings(processedFields);
|
||||
expect(mappings).toEqual(longWithIndexFalseMapping);
|
||||
});
|
||||
|
||||
it('tests processing text field with multi fields', () => {
|
||||
const textWithMultiFieldsLiteralYml = `
|
||||
- name: textWithMultiFields
|
||||
|
|
|
@ -277,7 +277,7 @@ function generateTextMapping(field: Field): IndexTemplateMapping {
|
|||
function getDefaultProperties(field: Field): Properties {
|
||||
const properties: Properties = {};
|
||||
|
||||
if (field.index) {
|
||||
if (field.index !== undefined) {
|
||||
properties.index = field.index;
|
||||
}
|
||||
if (field.doc_values) {
|
||||
|
|
Loading…
Reference in a new issue