diff --git a/packages/kbn-field-types/index.ts b/packages/kbn-field-types/index.ts index dc9e91b7b2d29..c5c5f7cba502d 100644 --- a/packages/kbn-field-types/index.ts +++ b/packages/kbn-field-types/index.ts @@ -13,7 +13,7 @@ export { getKbnFieldType, getKbnTypeNames, getFilterableKbnTypeNames, - normalizeType, + esFieldTypeToKibanaFieldType, } from './src/kbn_field_types'; export type { KbnFieldTypeOptions } from './src/types'; diff --git a/packages/kbn-field-types/src/kbn_field_types.ts b/packages/kbn-field-types/src/kbn_field_types.ts index 740e871c8bb88..2d03d3d1db782 100644 --- a/packages/kbn-field-types/src/kbn_field_types.ts +++ b/packages/kbn-field-types/src/kbn_field_types.ts @@ -49,7 +49,7 @@ export const castEsToKbnFieldTypeName = (esType: ES_FIELD_TYPES | string): KBN_F export const getFilterableKbnTypeNames = (): string[] => registeredKbnTypes.filter((type) => type.filterable).map((type) => type.name); -export function normalizeType(type: string) { +export function esFieldTypeToKibanaFieldType(type: string) { switch (type) { case ES_FIELD_TYPES._INDEX: case ES_FIELD_TYPES.GEO_POINT: diff --git a/packages/kbn-visualization-utils/__mocks__/suggestions_mock.ts b/packages/kbn-visualization-utils/__mocks__/suggestions_mock.ts index c563019d482b2..f8f765b14a64f 100644 --- a/packages/kbn-visualization-utils/__mocks__/suggestions_mock.ts +++ b/packages/kbn-visualization-utils/__mocks__/suggestions_mock.ts @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import type { Suggestion } from '../src/types'; +import type { TableChangeType } from '../src/types'; export const currentSuggestionMock = { title: 'Heat map', @@ -130,5 +130,5 @@ export const currentSuggestionMock = { }, datasourceId: 'textBased', columns: 2, - changeType: 'initial', -} as Suggestion; + changeType: 'initial' as TableChangeType, +}; diff --git a/src/plugins/data/common/search/expressions/esql.ts b/src/plugins/data/common/search/expressions/esql.ts index e68e9998014ad..96e5cedede514 100644 --- a/src/plugins/data/common/search/expressions/esql.ts +++ b/src/plugins/data/common/search/expressions/esql.ts @@ -7,7 +7,7 @@ */ import type { KibanaRequest } from '@kbn/core/server'; -import { normalizeType } from '@kbn/field-types'; +import { esFieldTypeToKibanaFieldType } from '@kbn/field-types'; import { i18n } from '@kbn/i18n'; import type { Datatable, ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; import { RequestAdapter } from '@kbn/inspector-plugin/common'; @@ -217,7 +217,7 @@ export const getEsqlFn = ({ getStartDependencies }: EsqlFnArguments) => { body.columns?.map(({ name, type }) => ({ id: name, name, - meta: { type: normalizeType(type) }, + meta: { type: esFieldTypeToKibanaFieldType(type) }, })) ?? []; const columnNames = columns.map(({ name }) => name); const rows = body.values.map((row) => zipObject(columnNames, row)); diff --git a/src/plugins/data/common/search/expressions/essql.ts b/src/plugins/data/common/search/expressions/essql.ts index 61df528fc2f14..8c5baa66f9f53 100644 --- a/src/plugins/data/common/search/expressions/essql.ts +++ b/src/plugins/data/common/search/expressions/essql.ts @@ -8,7 +8,7 @@ import type { KibanaRequest } from '@kbn/core/server'; import { buildEsQuery } from '@kbn/es-query'; -import { normalizeType } from '@kbn/field-types'; +import { esFieldTypeToKibanaFieldType } from '@kbn/field-types'; import { i18n } from '@kbn/i18n'; import type { Datatable, ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; import { RequestAdapter } from '@kbn/inspector-plugin/common'; @@ -241,7 +241,7 @@ export const getEssqlFn = ({ getStartDependencies }: EssqlFnArguments) => { body.columns?.map(({ name, type }) => ({ id: sanitize(name), name: sanitize(name), - meta: { type: normalizeType(type) }, + meta: { type: esFieldTypeToKibanaFieldType(type) }, })) ?? []; const columnNames = columns.map(({ name }) => name); const rows = body.rows.map((row) => zipObject(columnNames, row)); diff --git a/x-pack/plugins/observability_ai_assistant/server/functions/visualize_esql.ts b/x-pack/plugins/observability_ai_assistant/server/functions/visualize_esql.ts index 11702dcc564db..d4a1f867e3868 100644 --- a/x-pack/plugins/observability_ai_assistant/server/functions/visualize_esql.ts +++ b/x-pack/plugins/observability_ai_assistant/server/functions/visualize_esql.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { normalizeType } from '@kbn/field-types'; +import { esFieldTypeToKibanaFieldType } from '@kbn/field-types'; import type { ESQLSearchReponse } from '@kbn/es-types'; import { visualizeESQLFunction } from '../../common/functions/visualize_esql'; import type { FunctionRegistrationParameters } from '.'; @@ -34,7 +34,7 @@ export function registerVisualizeESQLFunction({ response.columns?.map(({ name, type }) => ({ id: name, name, - meta: { type: normalizeType(type) }, + meta: { type: esFieldTypeToKibanaFieldType(type) }, })) ?? []; return { content: columns }; }