Skip to content

Commit

Permalink
[Fleet] Don't ignore "index: false" in integration index template (#1…
Browse files Browse the repository at this point in the history
…10234) (#110273)

* fix: don't ignore index prop when falsey

* test: add unit test for index false

Co-authored-by: Mark Hopkin <mark.hopkin@elastic.co>
  • Loading branch information
kibanamachine and hop-dev authored Aug 26, 2021
1 parent 8b284fc commit 85893b8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 85893b8

Please sign in to comment.