Skip to content

Commit

Permalink
[ES|QL] Rename the setting to a more generic one and move to the gene…
Browse files Browse the repository at this point in the history
…ral section (#182074)

## Summary

Renames the setting from discover:enableESQL to enableESQL and moves it
to the General Section

<img width="985" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/ebafe7cd-4695-413c-a0e3-90e3574139e5">

We checked the telemetry and a very small percentage of users have
switched off this setting. It was also on tech preview so we decided in
favor of this change as more and more applications are using this
setting to hide ESQL from their applications.

<img width="850" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/404f2494-8a17-4a9d-943a-d9d72b324bc0">

### Release note
We renamed the advanced setting which hides the ES|QL from the UI from
`discover:enableESQL` to `enableESQL`. You have to switch it off again
if you want to disable ES|QL features from your kibana applications.

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
stratoula and kibanamachine authored May 1, 2024
1 parent 0842c60 commit f3d18fa
Show file tree
Hide file tree
Showing 40 changed files with 117 additions and 63 deletions.
2 changes: 1 addition & 1 deletion config/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/discover/try-esql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
6 changes: 3 additions & 3 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
1 change: 0 additions & 1 deletion packages/kbn-discover-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-discover-utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-esql-utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion packages/kbn-esql-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export {
TextBasedLanguages,
} from './src';

export { ESQL_LATEST_VERSION } from './constants';
export { ESQL_LATEST_VERSION, ENABLE_ESQL } from './constants';
2 changes: 1 addition & 1 deletion packages/kbn-management/settings/setting_ids/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/discover/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down
22 changes: 0 additions & 22 deletions src/plugins/discover/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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:
`<a href="https://ela.st/esql-feedback" target="_blank" rel="noopener">` +
i18n.translate('discover.advancedSettings.enableESQL.discussLinkText', {
defaultMessage: 'https://ela.st/esql-feedback',
}) +
'</a>',
},
}),
requiresPageReload: true,
category: ['discover'],
schema: schema.boolean(),
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'discover:enableESQL': {
enableESQL: {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10254,7 +10254,7 @@
"description": "Non-default value of setting."
}
},
"discover:enableESQL": {
"enableESQL": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/text_based_languages/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"owner": "@elastic/kibana-esql",
"plugin": {
"id": "textBasedLanguages",
"server": false,
"server": true,
"browser": true,
"optionalPlugins": [
"indexManagement"
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/text_based_languages/server/index.ts
Original file line number Diff line number Diff line change
@@ -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();
};
23 changes: 23 additions & 0 deletions src/plugins/text_based_languages/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -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() {}
}
36 changes: 36 additions & 0 deletions src/plugins/text_based_languages/server/ui_settings.ts
Original file line number Diff line number Diff line change
@@ -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<string, UiSettingsParams> = () => ({
[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:
`<a href="https://ela.st/esql-feedback" target="_blank" rel="noopener">` +
i18n.translate('textBasedLanguages.advancedSettings.enableESQL.discussLinkText', {
defaultMessage: 'https://ela.st/esql-feedback',
}) +
'</a>',
},
}),
requiresPageReload: true,
schema: schema.boolean(),
},
});
5 changes: 4 additions & 1 deletion src/plugins/text_based_languages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*",
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/group3/_request_counts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/group4/_esql_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/data_visualizer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/lens/public/embeddable/embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('create Lens panel action', () => {
uiSettings: {
...core.uiSettings,
get: (setting: string) => {
return setting === 'discover:enableESQL';
return setting === 'enableESQL';
},
},
} as CoreStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
}
Loading

0 comments on commit f3d18fa

Please sign in to comment.