From 7a54b240345260c5d5b1e28149c836783dc3849e Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 13 Oct 2023 18:27:10 +0200 Subject: [PATCH] More linting --- .../services/epm/elasticsearch/template/template.test.ts | 2 +- .../server/services/epm/elasticsearch/template/template.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.test.ts index 72e4262b20741..f0459b10c8570 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.test.ts @@ -1219,7 +1219,7 @@ describe('EPM template', () => { const fields: Field[] = safeLoad(textWithRuntimeFieldsLiteralYml); expect(() => { const processedFields = processFields(fields); - const mappings = generateMappings(processedFields); + generateMappings(processedFields); }).toThrow(); }); diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts index ecc9e033111f9..a13d0155f44ca 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts @@ -300,6 +300,9 @@ function _generateMappings( matchingType = field.object_type_mapping_type ?? field.object_type; break; case 'group': + if (!field?.fields) { + break; + } const subFields = field.fields.map((subField) => ({ ...subField, type: 'object',