From 5c9df88fa74535495aa4c3cd27f7d2823a4f3088 Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Wed, 3 May 2023 09:51:21 +0200 Subject: [PATCH] [Discover] Switch from "at" to "charAt" for better browser support --- src/plugins/data/common/search/tabify/tabify_docs.test.ts | 3 ++- src/plugins/data/common/search/tabify/tabify_docs.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/data/common/search/tabify/tabify_docs.test.ts b/src/plugins/data/common/search/tabify/tabify_docs.test.ts index fd61995705c86..0026fd1734b50 100644 --- a/src/plugins/data/common/search/tabify/tabify_docs.test.ts +++ b/src/plugins/data/common/search/tabify/tabify_docs.test.ts @@ -200,6 +200,7 @@ describe('tabify_docs', () => { _size: 12, _score: 77, _source: {}, + invalid_meta: 'test', }, ], }, @@ -216,7 +217,7 @@ describe('tabify_docs', () => { }, }, }, - metaFields: ['_id', '_index', '_score', '_type', '_size'], + metaFields: ['_id', '_index', '_score', '_type', '_size', 'invalid_meta'], fieldFormats: fieldFormats as any, }); const table = tabifyDocs(responsePlugin, dataView); diff --git a/src/plugins/data/common/search/tabify/tabify_docs.ts b/src/plugins/data/common/search/tabify/tabify_docs.ts index 471d472577a96..f57346917d286 100644 --- a/src/plugins/data/common/search/tabify/tabify_docs.ts +++ b/src/plugins/data/common/search/tabify/tabify_docs.ts @@ -107,7 +107,8 @@ export function flattenHit(hit: Hit, indexPattern?: DataView, params?: TabifyDoc // Merge all valid meta fields into the flattened object indexPattern?.metaFields?.forEach((fieldName) => { - const isExcludedMetaField = EXCLUDED_META_FIELDS.includes(fieldName) || fieldName.at(0) !== '_'; + const isExcludedMetaField = + EXCLUDED_META_FIELDS.includes(fieldName) || fieldName.charAt(0) !== '_'; if (isExcludedMetaField) { return; }