From b266e38e1858dc9d400facffabf7bf7eb7680563 Mon Sep 17 00:00:00 2001 From: ocshawn Date: Tue, 14 Jun 2022 17:06:57 -0500 Subject: [PATCH] fix/setupNestedArrayFields: fix field check to also serch for sub catigories using dot seperated feild names, also fix lint error in queries file --- src/components/Utils/queries.js | 1 + src/server/es/index.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Utils/queries.js b/src/components/Utils/queries.js index fb519463..5f5608ee 100644 --- a/src/components/Utils/queries.js +++ b/src/components/Utils/queries.js @@ -243,6 +243,7 @@ export const getGQLFilter = (filterObj) => { // This filter only has a combine setting so far. We can ignore it. return; } else { + // eslint-disable-next-line no-console console.error(filterValues); throw new Error('Invalid filter object'); } diff --git a/src/server/es/index.js b/src/server/es/index.js index 76ba0fe9..122361dc 100644 --- a/src/server/es/index.js +++ b/src/server/es/index.js @@ -226,7 +226,14 @@ class ES { } const fields = doc._source.array; fields.forEach((field) => { - if (!this.fieldTypes[index][field]) { + const fieldArr = field.split('.'); + if (!(this.fieldTypes[index][field] + || ( + fieldArr.length > 1 + && _.has(this.fieldTypes[index], + fieldArr.join('.properties.')) + ) + )) { const errMsg = `[ES.initialize] wrong array entry from config: field "${field}" not found in index ${index}, skipped.`; log.error(errMsg); return;