diff --git a/config/serverless.yml b/config/serverless.yml index 6fbe9496f705b3..726d0540e1dfe5 100644 --- a/config/serverless.yml +++ b/config/serverless.yml @@ -138,7 +138,7 @@ xpack.actions.queued.max: 10000 # Disables ESQL in advanced settings (hides it from the UI) uiSettings: overrides: - discover:enableESQL: true + enableESQL: true # Task Manager xpack.task_manager.allow_reading_invalid_state: false diff --git a/docs/discover/try-esql.asciidoc b/docs/discover/try-esql.asciidoc index 6c827240c1832d..c95733fd42e6b3 100644 --- a/docs/discover/try-esql.asciidoc +++ b/docs/discover/try-esql.asciidoc @@ -11,7 +11,7 @@ In this tutorial we'll use the {kib} sample web logs in Discover and Lens to exp [[prerequisite]] === Prerequisite -To be able to select **Try {esql}** from the Data views menu the `discover:enableESQL` setting must be enabled from **Stack Management > Advanced Settings**. It is enabled by default. +To be able to select **Try {esql}** from the Data views menu the `enableESQL` setting must be enabled from **Stack Management > Advanced Settings**. It is enabled by default. [float] [[tutorial-try-esql]] diff --git a/docs/management/advanced-options.asciidoc b/docs/management/advanced-options.asciidoc index 9e400f01c88ddb..3501b440d13ba7 100644 --- a/docs/management/advanced-options.asciidoc +++ b/docs/management/advanced-options.asciidoc @@ -209,6 +209,9 @@ The default selection in the time filter. The maximum height that a cell occupies in a table. Set to 0 to disable truncation. +[[enableESQL]]`enableESQL`:: +This setting enables ES|QL in Kibana. + [float] [[presentation-labs]] ==== Presentation Labs @@ -290,9 +293,6 @@ in the current data view is used. The columns that appear by default on the *Discover* page. The default is `_source`. -[[discover:enableESQL]]`discover:enableESQL`:: -experimental[] Allows ES|QL queries for search. - [[discover-max-doc-fields-displayed]]`discover:maxDocFieldsDisplayed`:: Specifies the maximum number of fields to show in the document column of the *Discover* table. diff --git a/packages/kbn-discover-utils/index.ts b/packages/kbn-discover-utils/index.ts index 0434a05a9ce922..7a7fedfb5f1e33 100644 --- a/packages/kbn-discover-utils/index.ts +++ b/packages/kbn-discover-utils/index.ts @@ -13,7 +13,6 @@ export { DEFAULT_COLUMNS_SETTING, DOC_HIDE_TIME_COLUMN_SETTING, DOC_TABLE_LEGACY, - ENABLE_ESQL, FIELDS_LIMIT_SETTING, HIDE_ANNOUNCEMENTS, MAX_DOC_FIELDS_DISPLAYED, diff --git a/packages/kbn-discover-utils/src/constants.ts b/packages/kbn-discover-utils/src/constants.ts index 7582b610c66388..acd34290d29de8 100644 --- a/packages/kbn-discover-utils/src/constants.ts +++ b/packages/kbn-discover-utils/src/constants.ts @@ -12,7 +12,6 @@ export const CONTEXT_TIE_BREAKER_FIELDS_SETTING = 'context:tieBreakerFields'; export const DEFAULT_COLUMNS_SETTING = 'defaultColumns'; export const DOC_HIDE_TIME_COLUMN_SETTING = 'doc_table:hideTimeColumn'; export const DOC_TABLE_LEGACY = 'doc_table:legacy'; -export const ENABLE_ESQL = 'discover:enableESQL'; export const FIELDS_LIMIT_SETTING = 'fields:popularLimit'; export const HIDE_ANNOUNCEMENTS = 'hideAnnouncements'; export const MAX_DOC_FIELDS_DISPLAYED = 'discover:maxDocFieldsDisplayed'; diff --git a/packages/kbn-esql-utils/constants.ts b/packages/kbn-esql-utils/constants.ts index 51dcbab83654b7..a50f03ebea1e28 100644 --- a/packages/kbn-esql-utils/constants.ts +++ b/packages/kbn-esql-utils/constants.ts @@ -9,3 +9,4 @@ // we are expecting to retrieve this from an API instead // https://github.com/elastic/elasticsearch/issues/107069 export const ESQL_LATEST_VERSION = '2024.04.01'; +export const ENABLE_ESQL = 'enableESQL'; diff --git a/packages/kbn-esql-utils/index.ts b/packages/kbn-esql-utils/index.ts index 0d04f40b856120..f8e93981d9c244 100644 --- a/packages/kbn-esql-utils/index.ts +++ b/packages/kbn-esql-utils/index.ts @@ -19,4 +19,4 @@ export { TextBasedLanguages, } from './src'; -export { ESQL_LATEST_VERSION } from './constants'; +export { ESQL_LATEST_VERSION, ENABLE_ESQL } from './constants'; diff --git a/packages/kbn-management/settings/setting_ids/index.ts b/packages/kbn-management/settings/setting_ids/index.ts index 771d60fb573aa6..f4a30dac6cb121 100644 --- a/packages/kbn-management/settings/setting_ids/index.ts +++ b/packages/kbn-management/settings/setting_ids/index.ts @@ -73,7 +73,7 @@ export const CONTEXT_DEFAULT_SIZE_ID = 'context:defaultSize'; export const CONTEXT_STEP_ID = 'context:step'; export const CONTEXT_TIE_BREAKER_FIELDS_ID = 'context:tieBreakerFields'; export const DEFAULT_COLUMNS_ID = 'defaultColumns'; -export const DISCOVER_ENABLE_ESQL_ID = 'discover:enableESQL'; +export const ENABLE_ESQL_ID = 'enableESQL'; export const DISCOVER_MAX_DOC_FIELDS_DISPLAYED_ID = 'discover:maxDocFieldsDisplayed'; export const DISCOVER_MODIFY_COLUMNS_ON_SWITCH_ID = 'discover:modifyColumnsOnSwitch'; export const DISCOVER_ROW_HEIGHT_OPTION_ID = 'discover:rowHeightOption'; diff --git a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx index 0af9e4ab303a41..9353df2c63a2d5 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useEffect, useMemo, useRef } from 'react'; import type { AggregateQuery, Query, TimeRange } from '@kbn/es-query'; import { type DataView, DataViewType } from '@kbn/data-views-plugin/public'; import { DataViewPickerProps } from '@kbn/unified-search-plugin/public'; -import { ENABLE_ESQL } from '@kbn/discover-utils'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { TextBasedLanguages } from '@kbn/esql-utils'; import { useSavedSearch, diff --git a/src/plugins/discover/public/plugin.tsx b/src/plugins/discover/public/plugin.tsx index 902cc0a38e7179..3563697138cc44 100644 --- a/src/plugins/discover/public/plugin.tsx +++ b/src/plugins/discover/public/plugin.tsx @@ -29,6 +29,7 @@ import { HomePublicPluginSetup } from '@kbn/home-plugin/public'; import { Start as InspectorPublicPluginStart } from '@kbn/inspector-plugin/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import { DEFAULT_APP_CATEGORIES } from '@kbn/core/public'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { IndexPatternFieldEditorStart } from '@kbn/data-view-field-editor-plugin/public'; import { DataViewsServicePublic } from '@kbn/data-views-plugin/public'; @@ -44,7 +45,7 @@ import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/ import type { UnifiedDocViewerStart } from '@kbn/unified-doc-viewer-plugin/public'; import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public'; import type { LensPublicStart } from '@kbn/lens-plugin/public'; -import { TRUNCATE_MAX_HEIGHT, ENABLE_ESQL } from '@kbn/discover-utils'; +import { TRUNCATE_MAX_HEIGHT } from '@kbn/discover-utils'; import type { NoDataPagePluginStart } from '@kbn/no-data-page-plugin/public'; import type { ObservabilityAIAssistantPublicSetup, diff --git a/src/plugins/discover/server/ui_settings.ts b/src/plugins/discover/server/ui_settings.ts index f09d96f150a9b5..fab0d56c0d828e 100644 --- a/src/plugins/discover/server/ui_settings.ts +++ b/src/plugins/discover/server/ui_settings.ts @@ -30,7 +30,6 @@ import { TRUNCATE_MAX_HEIGHT, SHOW_FIELD_STATISTICS, ROW_HEIGHT_OPTION, - ENABLE_ESQL, } from '@kbn/discover-utils'; import { DEFAULT_ROWS_PER_PAGE, ROWS_PER_PAGE_OPTIONS } from '../common/constants'; @@ -310,25 +309,4 @@ export const getUiSettings: ( schema: schema.number({ min: 0 }), requiresPageReload: true, }, - [ENABLE_ESQL]: { - name: i18n.translate('discover.advancedSettings.enableESQLTitle', { - defaultMessage: 'Enable ES|QL', - }), - value: true, - description: i18n.translate('discover.advancedSettings.enableESQLDescription', { - defaultMessage: - 'This setting enables ES|QL in Kibana. By switching it off you will hide the ES|QL user interface from various applications. However, users will be able to access existing ES|QL saved searches, visualizations, etc. If you have feedback on this experience please reach out to us on {link}', - values: { - link: - `` + - i18n.translate('discover.advancedSettings.enableESQL.discussLinkText', { - defaultMessage: 'https://ela.st/esql-feedback', - }) + - '', - }, - }), - requiresPageReload: true, - category: ['discover'], - schema: schema.boolean(), - }, }); diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts index 0ed695f0b19994..1cf68fdf92f366 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts @@ -539,7 +539,7 @@ export const stackManagementSchema: MakeSchemaFrom = { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, }, - 'discover:enableESQL': { + enableESQL: { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, }, diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts index 86c25366d4cebf..8464207aaa1d60 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts @@ -34,7 +34,7 @@ export interface UsageStats { 'discover:searchFieldsFromSource': boolean; 'discover:showFieldStatistics': boolean; 'discover:showMultiFields': boolean; - 'discover:enableESQL': boolean; + enableESQL: boolean; 'discover:maxDocFieldsDisplayed': number; 'securitySolution:rulesTableRefresh': string; 'observability:enableInspectEsQueries': boolean; diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 8773c3a99f9d20..f5eb21f859bca1 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -10254,7 +10254,7 @@ "description": "Non-default value of setting." } }, - "discover:enableESQL": { + "enableESQL": { "type": "boolean", "_meta": { "description": "Non-default value of setting." diff --git a/src/plugins/text_based_languages/kibana.jsonc b/src/plugins/text_based_languages/kibana.jsonc index 545c1878cc4e4c..7e9aba22067e8d 100644 --- a/src/plugins/text_based_languages/kibana.jsonc +++ b/src/plugins/text_based_languages/kibana.jsonc @@ -4,7 +4,7 @@ "owner": "@elastic/kibana-esql", "plugin": { "id": "textBasedLanguages", - "server": false, + "server": true, "browser": true, "optionalPlugins": [ "indexManagement" diff --git a/src/plugins/text_based_languages/server/index.ts b/src/plugins/text_based_languages/server/index.ts new file mode 100644 index 00000000000000..bca404b161bf8a --- /dev/null +++ b/src/plugins/text_based_languages/server/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export const plugin = async () => { + const { TextBasedLanguagesServerPlugin } = await import('./plugin'); + return new TextBasedLanguagesServerPlugin(); +}; diff --git a/src/plugins/text_based_languages/server/plugin.ts b/src/plugins/text_based_languages/server/plugin.ts new file mode 100644 index 00000000000000..95a341a467cc59 --- /dev/null +++ b/src/plugins/text_based_languages/server/plugin.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/server'; +import { getUiSettings } from './ui_settings'; + +export class TextBasedLanguagesServerPlugin implements Plugin { + public setup(core: CoreSetup) { + core.uiSettings.register(getUiSettings()); + return {}; + } + + public start(core: CoreStart) { + return {}; + } + + public stop() {} +} diff --git a/src/plugins/text_based_languages/server/ui_settings.ts b/src/plugins/text_based_languages/server/ui_settings.ts new file mode 100644 index 00000000000000..32717b0d2cb8c0 --- /dev/null +++ b/src/plugins/text_based_languages/server/ui_settings.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { i18n } from '@kbn/i18n'; +import { schema } from '@kbn/config-schema'; + +import type { UiSettingsParams } from '@kbn/core/server'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; + +export const getUiSettings: () => Record = () => ({ + [ENABLE_ESQL]: { + name: i18n.translate('textBasedLanguages.advancedSettings.enableESQLTitle', { + defaultMessage: 'Enable ES|QL', + }), + value: true, + description: i18n.translate('textBasedLanguages.advancedSettings.enableESQLDescription', { + defaultMessage: + 'This setting enables ES|QL in Kibana. By switching it off you will hide the ES|QL user interface from various applications. However, users will be able to access existing ES|QL saved searches, visualizations, etc. If you have feedback on this experience please reach out to us on {link}', + values: { + link: + `` + + i18n.translate('textBasedLanguages.advancedSettings.enableESQL.discussLinkText', { + defaultMessage: 'https://ela.st/esql-feedback', + }) + + '', + }, + }), + requiresPageReload: true, + schema: schema.boolean(), + }, +}); diff --git a/src/plugins/text_based_languages/tsconfig.json b/src/plugins/text_based_languages/tsconfig.json index 8d3fef08e23a9f..2cb4eddcbf7a04 100644 --- a/src/plugins/text_based_languages/tsconfig.json +++ b/src/plugins/text_based_languages/tsconfig.json @@ -15,7 +15,10 @@ "@kbn/core", "@kbn/expressions-plugin", "@kbn/data-views-plugin", - "@kbn/index-management" + "@kbn/index-management", + "@kbn/i18n", + "@kbn/config-schema", + "@kbn/esql-utils" ], "exclude": [ "target/**/*", diff --git a/test/functional/apps/discover/group3/_request_counts.ts b/test/functional/apps/discover/group3/_request_counts.ts index 636f3343877fd5..3503258cb6c0e5 100644 --- a/test/functional/apps/discover/group3/_request_counts.ts +++ b/test/functional/apps/discover/group3/_request_counts.ts @@ -37,7 +37,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', 'bfetch:disable': true, - 'discover:enableESQL': true, + enableESQL: true, }); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); diff --git a/test/functional/apps/discover/group4/_esql_view.ts b/test/functional/apps/discover/group4/_esql_view.ts index 31f323500b119a..57c924e44693a1 100644 --- a/test/functional/apps/discover/group4/_esql_view.ts +++ b/test/functional/apps/discover/group4/_esql_view.ts @@ -35,7 +35,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const defaultSettings = { defaultIndex: 'logstash-*', - 'discover:enableESQL': true, + enableESQL: true, }; describe('discover esql view', async function () { diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index_data_visualizer.tsx b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index_data_visualizer.tsx index 7482e686db33ef..d5f8f17b9ee17a 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index_data_visualizer.tsx +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index_data_visualizer.tsx @@ -32,7 +32,7 @@ import { UrlStateProvider, } from '@kbn/ml-url-state'; import type { SavedSearch } from '@kbn/saved-search-plugin/public'; -import { ENABLE_ESQL } from '@kbn/discover-utils'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { EuiCallOut } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { getCoreStart, getPluginsStart } from '../../kibana_services'; diff --git a/x-pack/plugins/data_visualizer/tsconfig.json b/x-pack/plugins/data_visualizer/tsconfig.json index 428311f87b305b..61a7a80484eb94 100644 --- a/x-pack/plugins/data_visualizer/tsconfig.json +++ b/x-pack/plugins/data_visualizer/tsconfig.json @@ -78,7 +78,6 @@ "@kbn/visualization-utils", "@kbn/ml-time-buckets", "@kbn/aiops-log-rate-analysis", - "@kbn/discover-utils", "@kbn/react-kibana-context-render", "@kbn/react-kibana-context-theme" ], diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.tsx index d4db046665fc7d..3206947c2a9b70 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.tsx @@ -11,6 +11,7 @@ import type { Observable } from 'rxjs'; import { css } from '@emotion/react'; import { i18n } from '@kbn/i18n'; import { render, unmountComponentAtNode } from 'react-dom'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { DataViewBase, EsQueryConfig, @@ -1556,7 +1557,7 @@ export class Embeddable public getIsEditable() { // for ES|QL, editing is allowed only if the advanced setting is on - if (Boolean(this.isTextBasedLanguage()) && !this.deps.uiSettings.get('discover:enableESQL')) { + if (Boolean(this.isTextBasedLanguage()) && !this.deps.uiSettings.get(ENABLE_ESQL)) { return false; } return ( diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action.test.tsx index 27372f10ce9737..97b59a93829e37 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action.test.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action.test.tsx @@ -32,7 +32,7 @@ describe('create Lens panel action', () => { uiSettings: { ...core.uiSettings, get: (setting: string) => { - return setting === 'discover:enableESQL'; + return setting === 'enableESQL'; }, }, } as CoreStart; diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts index 3e77f8979a8724..b99583ddf3103e 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts @@ -9,7 +9,7 @@ import type { CoreStart } from '@kbn/core/public'; import { getLensAttributesFromSuggestion } from '@kbn/visualization-utils'; import { IncompatibleActionError } from '@kbn/ui-actions-plugin/public'; import { PresentationContainer } from '@kbn/presentation-containers'; -import { getESQLAdHocDataview, getIndexForESQLQuery } from '@kbn/esql-utils'; +import { getESQLAdHocDataview, getIndexForESQLQuery, ENABLE_ESQL } from '@kbn/esql-utils'; import type { Datasource, Visualization } from '../../types'; import type { LensPluginStartDependencies } from '../../plugin'; import { fetchDataFromAggregateQuery } from '../../datasources/text_based/fetch_data_from_aggregate_query'; @@ -28,7 +28,7 @@ export const [getDatasourceMap, setDatasourceMap] = createGetterSetter< >('DatasourceMap', false); export function isCreateActionCompatible(core: CoreStart) { - return core.uiSettings.get('discover:enableESQL'); + return core.uiSettings.get(ENABLE_ESQL); } export async function executeCreateAction({ diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx index a6c7a8bcf6bc0f..7525f491e697ad 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx @@ -51,7 +51,7 @@ describe('inapp editing of Lens embeddable', () => { uiSettings: { ...core.uiSettings, get: (setting: string) => { - return setting === 'discover:enableESQL'; + return setting === 'enableESQL'; }, }, } as CoreStart; diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action_helpers.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action_helpers.tsx index 168dbebe3ebd2d..0a3dc8feebe0bb 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action_helpers.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action_helpers.tsx @@ -8,6 +8,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import type { CoreStart } from '@kbn/core/public'; import { isOfAggregateQueryType } from '@kbn/es-query'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { toMountPoint } from '@kbn/react-kibana-mount'; import { IncompatibleActionError } from '@kbn/ui-actions-plugin/public'; import type { LensPluginStartDependencies } from '../../../plugin'; @@ -21,7 +22,7 @@ export function isEmbeddableEditActionCompatible( ) { // for ES|QL is compatible only when advanced setting is enabled const query = attributes.state.query; - return isOfAggregateQueryType(query) ? core.uiSettings.get('discover:enableESQL') : true; + return isOfAggregateQueryType(query) ? core.uiSettings.get(ENABLE_ESQL) : true; } export async function executeEditEmbeddableAction({ diff --git a/x-pack/plugins/ml/public/application/datavisualizer/datavisualizer_selector.tsx b/x-pack/plugins/ml/public/application/datavisualizer/datavisualizer_selector.tsx index 1b5f3acdaedd22..41b2ac3a47d371 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/datavisualizer_selector.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/datavisualizer_selector.tsx @@ -23,7 +23,7 @@ import { import { FormattedMessage } from '@kbn/i18n-react'; import { useTimefilter } from '@kbn/ml-date-picker'; -import { ENABLE_ESQL } from '@kbn/discover-utils'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { isFullLicense } from '../license'; import { useMlKibana, useNavigateToPath } from '../contexts/kibana'; import { HelpMenu } from '../components/help_menu'; diff --git a/x-pack/plugins/ml/public/plugin.ts b/x-pack/plugins/ml/public/plugin.ts index e3bf7e3520649e..d762bb9557268d 100644 --- a/x-pack/plugins/ml/public/plugin.ts +++ b/x-pack/plugins/ml/public/plugin.ts @@ -50,7 +50,7 @@ import type { SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/publ import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public'; import type { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public'; import type { FieldFormatsRegistry } from '@kbn/field-formats-plugin/common'; -import { ENABLE_ESQL } from '@kbn/discover-utils'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; import type { MlSharedServices } from './application/services/get_shared_ml_services'; import { getMlSharedServices } from './application/services/get_shared_ml_services'; import { registerManagementSection } from './application/management'; diff --git a/x-pack/plugins/ml/tsconfig.json b/x-pack/plugins/ml/tsconfig.json index dba33a6043bc81..4b3ae3a3f0beb2 100644 --- a/x-pack/plugins/ml/tsconfig.json +++ b/x-pack/plugins/ml/tsconfig.json @@ -124,7 +124,7 @@ "@kbn/presentation-containers", "@kbn/presentation-panel-plugin", "@kbn/shared-ux-utility", - "@kbn/discover-utils", "@kbn/react-kibana-context-render", + "@kbn/esql-utils", ], } diff --git a/x-pack/plugins/observability_solution/logs_explorer/public/hooks/use_esql.tsx b/x-pack/plugins/observability_solution/logs_explorer/public/hooks/use_esql.tsx index b34cae81f303a7..e26474b6165e6f 100644 --- a/x-pack/plugins/observability_solution/logs_explorer/public/hooks/use_esql.tsx +++ b/x-pack/plugins/observability_solution/logs_explorer/public/hooks/use_esql.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { ENABLE_ESQL } from '@kbn/esql-utils'; import { DataSourceSelection, isDatasetSelection } from '../../common/data_source_selection'; import { useKibanaContextForPlugin } from '../utils/use_kibana'; @@ -27,7 +27,7 @@ export const useEsql = ({ dataSourceSelection }: EsqlContextDeps): UseEsqlResult services: { uiSettings, discover }, } = useKibanaContextForPlugin(); - const isEsqlEnabled = uiSettings?.get('discover:enableESQL'); + const isEsqlEnabled = uiSettings?.get(ENABLE_ESQL); const esqlPattern = isDatasetSelection(dataSourceSelection) ? dataSourceSelection.selection.dataset.name diff --git a/x-pack/plugins/observability_solution/logs_explorer/tsconfig.json b/x-pack/plugins/observability_solution/logs_explorer/tsconfig.json index 7c4224eadac192..35bd2b0a7ffb22 100644 --- a/x-pack/plugins/observability_solution/logs_explorer/tsconfig.json +++ b/x-pack/plugins/observability_solution/logs_explorer/tsconfig.json @@ -46,6 +46,7 @@ "@kbn/unified-field-list", "@kbn/unified-search-plugin", "@kbn/xstate-utils", + "@kbn/esql-utils", ], "exclude": [ "target/**/*" diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/functions/query/esql_docs/esql-kibana.txt b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/functions/query/esql_docs/esql-kibana.txt index 798a9befd7647c..5fcce8c997ee71 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/functions/query/esql_docs/esql-kibana.txt +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/functions/query/esql_docs/esql-kibana.txt @@ -10,7 +10,7 @@ Get started with ES|QLedit To get started with ES|QL in Discover, open the main menu and select Discover. Next, from the Data views menu, select Try ES|QL. The ability to select ES|QL from the Data views menu can be enabled and -disabled using the `discover:enableESQL` setting from +disabled using the `enableESQL` setting from Advanced Settings. The query baredit After switching to ES|QL mode, the query bar shows a sample query. For example: diff --git a/x-pack/plugins/stack_alerts/public/rule_types/es_query/expression/query_form_type_chooser.tsx b/x-pack/plugins/stack_alerts/public/rule_types/es_query/expression/query_form_type_chooser.tsx index f551d078314b6c..005adb7be25ef2 100644 --- a/x-pack/plugins/stack_alerts/public/rule_types/es_query/expression/query_form_type_chooser.tsx +++ b/x-pack/plugins/stack_alerts/public/rule_types/es_query/expression/query_form_type_chooser.tsx @@ -50,7 +50,7 @@ export const QueryFormTypeChooser: React.FC = ({ onFormTypeSelect, }) => { const { uiSettings } = useTriggerUiActionServices(); - const isEsqlEnabled = uiSettings?.get('discover:enableESQL'); + const isEsqlEnabled = uiSettings?.get('enableESQL'); const formTypeItems = useMemo(() => { const items: Array<{ formType: SearchType; label: string; description: string }> = [ diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index d65c505c95ea78..7e7d4218db8fe8 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -2301,8 +2301,8 @@ "discover.advancedSettings.docTableHideTimeColumnText": "Permet de masquer la colonne ''Time'' dans Discover et dans toutes les recherches enregistrées des tableaux de bord.", "discover.advancedSettings.docTableHideTimeColumnTitle": "Masquer la colonne ''Time''", "discover.advancedSettings.documentExplorerLinkText": "Explorateur de documents", - "discover.advancedSettings.enableESQL.discussLinkText": "discuss.elastic.co/c/elastic-stack/kibana", - "discover.advancedSettings.enableESQLTitle": "Activer ES|QL", + "textBasedLanguages.advancedSettings.enableESQL.discussLinkText": "discuss.elastic.co/c/elastic-stack/kibana", + "textBasedLanguages.advancedSettings.enableESQLTitle": "Activer ES|QL", "discover.advancedSettings.fieldsPopularLimitText": "Les N champs les plus populaires à afficher", "discover.advancedSettings.fieldsPopularLimitTitle": "Limite de champs populaires", "discover.advancedSettings.maxDocFieldsDisplayedText": "Le nombre maximal de champs renvoyés dans le résumé du document", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index a90eb95137a9cb..60e15dd80a172f 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2299,8 +2299,8 @@ "discover.advancedSettings.docTableHideTimeColumnText": "Discover と、ダッシュボードのすべての保存された検索で、「時刻」列を非表示にします。", "discover.advancedSettings.docTableHideTimeColumnTitle": "「時刻」列を非表示", "discover.advancedSettings.documentExplorerLinkText": "ドキュメントエクスプローラー", - "discover.advancedSettings.enableESQL.discussLinkText": "discuss.elastic.co/c/elastic-stack/kibana", - "discover.advancedSettings.enableESQLTitle": "ES|QLを有効化", + "textBasedLanguages.advancedSettings.enableESQL.discussLinkText": "discuss.elastic.co/c/elastic-stack/kibana", + "textBasedLanguages.advancedSettings.enableESQLTitle": "ES|QLを有効化", "discover.advancedSettings.fieldsPopularLimitText": "最も頻繁に使用されるフィールドのトップNを表示します", "discover.advancedSettings.fieldsPopularLimitTitle": "頻繁に使用されるフィールドの制限", "discover.advancedSettings.maxDocFieldsDisplayedText": "ドキュメント概要でレンダリングされるフィールドの最大数", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 45b79ec3364c3c..430a3b8d469163 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2303,8 +2303,8 @@ "discover.advancedSettings.docTableHideTimeColumnText": "在 Discover 中和仪表板上的所有已保存搜索中隐藏“时间”列。", "discover.advancedSettings.docTableHideTimeColumnTitle": "隐藏“时间”列", "discover.advancedSettings.documentExplorerLinkText": "Document Explorer", - "discover.advancedSettings.enableESQL.discussLinkText": "discuss.elastic.co/c/elastic-stack/kibana", - "discover.advancedSettings.enableESQLTitle": "启用 ES|QL", + "textBasedLanguages.advancedSettings.enableESQL.discussLinkText": "discuss.elastic.co/c/elastic-stack/kibana", + "textBasedLanguages.advancedSettings.enableESQLTitle": "启用 ES|QL", "discover.advancedSettings.fieldsPopularLimitText": "要显示的排名前 N 最常见字段", "discover.advancedSettings.fieldsPopularLimitTitle": "常见字段限制", "discover.advancedSettings.maxDocFieldsDisplayedText": "在文档摘要中渲染的最大字段数目", diff --git a/x-pack/test/functional/apps/discover/visualize_field.ts b/x-pack/test/functional/apps/discover/visualize_field.ts index e2cb7962db7ae7..b1eadf89a52978 100644 --- a/x-pack/test/functional/apps/discover/visualize_field.ts +++ b/x-pack/test/functional/apps/discover/visualize_field.ts @@ -31,7 +31,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const monacoEditor = getService('monacoEditor'); const defaultSettings = { - 'discover:enableESQL': true, + enableESQL: true, }; async function setDiscoverTimeRange() { diff --git a/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts b/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts index ae1004db12cf35..7fdea1ff3d6480 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts @@ -35,7 +35,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'x-pack/test/functional/fixtures/kbn_archiver/discover/default' ); await kibanaServer.uiSettings.replace({ - 'discover:enableESQL': true, + enableESQL: true, }); await PageObjects.common.navigateToApp('discover'); await PageObjects.timePicker.setDefaultAbsoluteRange();