From 7c01257055b9521def55a77bbc5e881910ed7273 Mon Sep 17 00:00:00 2001 From: Nodir Latipov Date: Fri, 22 Apr 2022 11:02:56 +0500 Subject: [PATCH] [Unified Search] Move autocomplete logic to unified search plugin (#129977) * feat: move autocomplete logic from data plugin to unified search * minor fix after comments * updated Documentation: data.autocomplete -> unifiedSearch.autocomplete * changed renameFromRoot order for autocomplete * removed extra renameFromRoot in config deprecations, updated test * added configPath for unified search plugin * Update kibana.json * updated path to autocomplete * fix conflict * fix conflict * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * fix Linting * fix functional_with_es_ssl test --- config/kibana.yml | 4 +- docs/setup/settings.asciidoc | 4 +- packages/kbn-optimizer/limits.yml | 2 +- .../src/field_value_match/index.tsx | 2 +- .../src/field_value_match_any/index.tsx | 2 +- .../src/field_value_wildcard/index.tsx | 2 +- .../use_field_value_autocomplete/index.ts | 2 +- .../resources/base/bin/kibana-docker | 5 + src/plugins/controls/kibana.json | 3 +- .../public/__stories__/controls.stories.tsx | 2 +- src/plugins/controls/public/services/data.ts | 1 - src/plugins/controls/public/services/index.ts | 2 + .../controls/public/services/kibana/data.ts | 3 +- .../controls/public/services/kibana/index.ts | 2 + .../public/services/kibana/unified_search.ts | 26 +++ .../public/services/storybook/data.ts | 11 +- .../public/services/storybook/index.ts | 2 + .../services/storybook/unified_search.ts | 25 +++ .../controls/public/services/stub/index.ts | 3 +- .../public/services/unified_search.ts | 13 ++ src/plugins/controls/public/types.ts | 2 + .../options_list_suggestions_route.ts | 4 +- src/plugins/controls/server/plugin.ts | 6 +- src/plugins/controls/tsconfig.json | 3 +- src/plugins/data/config.ts | 22 --- src/plugins/data/kibana.json | 2 +- src/plugins/data/public/index.ts | 19 +-- src/plugins/data/public/mocks.ts | 14 -- src/plugins/data/public/plugin.ts | 9 -- src/plugins/data/public/types.ts | 7 - src/plugins/data/server/index.ts | 5 +- src/plugins/data/server/mocks.ts | 6 - src/plugins/data/server/plugin.ts | 6 - .../input_control_vis/public/plugin.ts | 14 +- src/plugins/unified_search/config.ts | 25 ++- src/plugins/unified_search/kibana.json | 6 +- .../autocomplete/autocomplete_service.ts | 6 +- .../collectors/create_usage_collector.ts | 0 .../public/autocomplete/collectors/index.ts | 0 .../public/autocomplete/collectors/types.ts | 0 .../public/autocomplete/index.ts | 0 .../providers/kql_query_suggestion/README.md | 0 .../__fixtures__/index_pattern_response.json | 0 .../kql_query_suggestion/conjunction.test.ts | 5 +- .../kql_query_suggestion/conjunction.tsx | 18 +-- .../kql_query_suggestion/field.test.ts | 3 +- .../providers/kql_query_suggestion/field.tsx | 8 +- .../providers/kql_query_suggestion/index.ts | 6 +- .../lib/escape_kuery.test.ts | 0 .../kql_query_suggestion/lib/escape_kuery.ts | 0 .../kql_query_suggestion/operator.test.ts | 3 +- .../kql_query_suggestion/operator.tsx | 50 +++--- .../sort_prefix_first.test.ts | 0 .../kql_query_suggestion/sort_prefix_first.ts | 0 .../providers/kql_query_suggestion/types.ts | 7 +- .../kql_query_suggestion/value.test.ts | 4 +- .../providers/kql_query_suggestion/value.ts | 12 +- .../providers/query_suggestion_provider.ts | 4 +- .../value_suggestion_provider.test.ts | 8 +- .../providers/value_suggestion_provider.ts | 11 +- .../filter_editor/phrase_suggestor.tsx | 8 +- src/plugins/unified_search/public/index.ts | 18 ++- src/plugins/unified_search/public/mocks.ts | 20 +++ src/plugins/unified_search/public/plugin.ts | 32 +++- .../query_bar_top_row.test.tsx | 8 + .../query_string_input.test.tsx | 8 + .../query_string_input/query_string_input.tsx | 15 +- src/plugins/unified_search/public/services.ts | 4 + .../typeahead/suggestion_component.test.tsx | 2 +- .../public/typeahead/suggestion_component.tsx | 2 +- .../typeahead/suggestions_component.test.tsx | 2 +- .../typeahead/suggestions_component.tsx | 2 +- .../unified_search/public/typeahead/types.ts | 2 +- src/plugins/unified_search/public/types.ts | 16 +- .../autocomplete/autocomplete_service.ts | 0 .../server/autocomplete/index.ts | 0 .../server/autocomplete/routes.ts | 0 .../server/autocomplete/terms_agg.test.ts | 0 .../server/autocomplete/terms_agg.ts | 2 +- .../server/autocomplete/terms_enum.test.ts | 0 .../server/autocomplete/terms_enum.ts | 4 +- .../autocomplete/value_suggestions_route.ts | 2 +- .../server/config_deprecations.test.ts | 137 ++++++++++++++++ .../server/config_deprecations.ts | 59 +++++++ .../unified_search/server/data_views/index.ts | 9 ++ src/plugins/unified_search/server/index.ts | 40 +++++ src/plugins/unified_search/server/mocks.ts | 23 +++ src/plugins/unified_search/server/plugin.ts | 50 ++++++ src/plugins/unified_search/tsconfig.json | 4 +- .../test_suites/core_plugins/rendering.ts | 10 +- x-pack/plugins/apm/kibana.json | 3 +- .../components/shared/kuery_bar/index.tsx | 7 +- x-pack/plugins/apm/public/plugin.ts | 5 +- .../fleet/.storybook/context/stubs.tsx | 2 + x-pack/plugins/fleet/kibana.json | 2 +- .../components/agent_logs/filter_dataset.tsx | 6 +- .../agent_logs/filter_log_level.tsx | 6 +- .../fleet/public/mock/plugin_dependencies.ts | 2 + x-pack/plugins/fleet/public/plugin.ts | 3 + .../public/components/search_bar.test.tsx | 2 + .../autocomplete_field/autocomplete_field.tsx | 2 +- .../autocomplete_field/suggestion_item.tsx | 6 +- .../containers/with_kuery_autocompletion.tsx | 10 +- .../metrics_explorer/components/kuery_bar.tsx | 2 +- x-pack/plugins/lens/kibana.json | 3 +- .../dimension_panel/dimension_editor.tsx | 1 + .../dimension_panel/dimension_panel.test.tsx | 2 + .../dimension_panel/dimension_panel.tsx | 2 + .../droppable/droppable.test.ts | 2 + .../dimension_panel/reference_editor.test.tsx | 2 + .../dimension_panel/reference_editor.tsx | 2 + .../public/indexpattern_datasource/index.ts | 11 +- .../indexpattern.test.ts | 18 ++- .../indexpattern_datasource/indexpattern.tsx | 4 + .../definitions/date_histogram.test.tsx | 3 + .../definitions/filters/filters.test.tsx | 2 + .../formula/editor/formula_editor.tsx | 8 +- .../formula/editor/math_completion.test.ts | 20 +-- .../formula/editor/math_completion.ts | 19 ++- .../operations/definitions/index.ts | 2 + .../definitions/last_value.test.tsx | 2 + .../definitions/percentile.test.tsx | 10 +- .../definitions/ranges/ranges.test.tsx | 5 +- .../definitions/static_value.test.tsx | 8 +- .../definitions/terms/terms.test.tsx | 2 + x-pack/plugins/lens/public/plugin.ts | 9 +- .../components/builder/builder.stories.tsx | 2 +- .../builder/entry_renderer.stories.tsx | 2 +- .../builder/entry_renderer.test.tsx | 10 +- .../components/builder/entry_renderer.tsx | 2 +- .../builder/exception_item_renderer.test.tsx | 4 +- .../builder/exception_item_renderer.tsx | 2 +- .../builder/exception_items_renderer.test.tsx | 4 +- .../builder/exception_items_renderer.tsx | 2 +- x-pack/plugins/lists/tsconfig.json | 1 + x-pack/plugins/maps/public/kibana_services.ts | 2 +- x-pack/plugins/ml/kibana.json | 3 +- x-pack/plugins/ml/public/application/app.tsx | 2 +- .../application/util/dependency_cache.ts | 4 +- x-pack/plugins/ml/public/plugin.ts | 3 + x-pack/plugins/monitoring/kibana.json | 2 +- .../kuery_bar/autocomplete_field.tsx | 2 +- .../public/components/kuery_bar/index.tsx | 2 +- .../components/kuery_bar/suggestion_item.tsx | 2 +- .../kuery_bar/with_kuery_autocompletion.tsx | 10 +- x-pack/plugins/security_solution/kibana.json | 3 +- .../exceptions/add_exception_flyout/index.tsx | 4 +- .../edit_exception_flyout/index.tsx | 4 +- .../components/query_bar/index.test.tsx | 7 + .../components/threat_match/index.test.tsx | 2 +- .../threat_match/list_item.test.tsx | 2 +- .../common/lib/kibana/kibana_react.mock.ts | 3 + .../mock/endpoint/app_context_render.tsx | 2 +- .../rules/severity_mapping/index.tsx | 2 +- .../view/components/form/index.test.tsx | 1 + .../view/components/form/index.tsx | 6 +- .../timeline/query_bar/index.test.tsx | 7 + x-pack/plugins/synthetics/kibana.json | 3 +- .../plugins/synthetics/public/apps/plugin.ts | 2 + .../lazy_wrapper/monitor_status.tsx | 2 +- .../translations/translations/fr-FR.json | 149 +++++++++++++++-- .../translations/translations/ja-JP.json | 150 ++++++++++++++++-- .../translations/translations/zh-CN.json | 150 ++++++++++++++++-- 163 files changed, 1253 insertions(+), 392 deletions(-) create mode 100644 src/plugins/controls/public/services/kibana/unified_search.ts create mode 100644 src/plugins/controls/public/services/storybook/unified_search.ts create mode 100644 src/plugins/controls/public/services/unified_search.ts rename src/plugins/{data => unified_search}/public/autocomplete/autocomplete_service.ts (93%) rename src/plugins/{data => unified_search}/public/autocomplete/collectors/create_usage_collector.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/collectors/index.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/collectors/types.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/index.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/README.md (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts (95%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx (69%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/field.test.ts (97%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/field.tsx (93%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/index.ts (93%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/operator.test.ts (97%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/operator.tsx (65%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts (100%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/types.ts (73%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/value.test.ts (97%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/kql_query_suggestion/value.ts (89%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/query_suggestion_provider.ts (90%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/value_suggestion_provider.test.ts (97%) rename src/plugins/{data => unified_search}/public/autocomplete/providers/value_suggestion_provider.ts (95%) rename src/plugins/{data => unified_search}/server/autocomplete/autocomplete_service.ts (100%) rename src/plugins/{data => unified_search}/server/autocomplete/index.ts (100%) rename src/plugins/{data => unified_search}/server/autocomplete/routes.ts (100%) rename src/plugins/{data => unified_search}/server/autocomplete/terms_agg.test.ts (100%) rename src/plugins/{data => unified_search}/server/autocomplete/terms_agg.ts (97%) rename src/plugins/{data => unified_search}/server/autocomplete/terms_enum.test.ts (100%) rename src/plugins/{data => unified_search}/server/autocomplete/terms_enum.ts (95%) rename src/plugins/{data => unified_search}/server/autocomplete/value_suggestions_route.ts (97%) create mode 100644 src/plugins/unified_search/server/config_deprecations.test.ts create mode 100644 src/plugins/unified_search/server/config_deprecations.ts create mode 100644 src/plugins/unified_search/server/data_views/index.ts create mode 100644 src/plugins/unified_search/server/index.ts create mode 100644 src/plugins/unified_search/server/mocks.ts create mode 100644 src/plugins/unified_search/server/plugin.ts diff --git a/config/kibana.yml b/config/kibana.yml index 50ddad9a4b32a..4233bf2882a29 100644 --- a/config/kibana.yml +++ b/config/kibana.yml @@ -159,8 +159,8 @@ # =================== Search Autocomplete =================== # Time in milliseconds to wait for autocomplete suggestions from Elasticsearch. # This value must be a whole number greater than zero. Defaults to 1000ms -#data.autocomplete.valueSuggestions.timeout: 1000 +#unifiedSearch.autocomplete.valueSuggestions.timeout: 1000 # Maximum number of documents loaded by each shard to generate autocomplete suggestions. # This value must be a whole number greater than zero. Defaults to 100_000 -#data.autocomplete.valueSuggestions.terminateAfter: 100000 +#unifiedSearch.autocomplete.valueSuggestions.terminateAfter: 100000 diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index f5dca28a7da1c..2d52abc1f0138 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -289,11 +289,11 @@ is an alternative to `elasticsearch.username` and `elasticsearch.password`. | `interpreter.enableInVisualize` | Enables use of interpreter in Visualize. *Default: `true`* -| `data.autocomplete.valueSuggestions.timeout:` {ess-icon} +| `unifiedSearch.autocomplete.valueSuggestions.timeout:` {ess-icon} | Time in milliseconds to wait for autocomplete suggestions from {es}. This value must be a whole number greater than zero. *Default: `"1000"`* -| `data.autocomplete.valueSuggestions.terminateAfter:` {ess-icon} +| `unifiedSearch.autocomplete.valueSuggestions.terminateAfter:` {ess-icon} | Maximum number of documents loaded by each shard to generate autocomplete suggestions. This value must be a whole number greater than zero. *Default: `"100000"`* diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 2540976c106f5..98089f1f1c5fb 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -122,7 +122,7 @@ pageLoadAssetSize: sessionView: 77750 cloudSecurityPosture: 19109 visTypeGauge: 24113 - unifiedSearch: 49195 + unifiedSearch: 104869 data: 454087 expressionXY: 26500 eventAnnotation: 19334 diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx index 096058fcc0aa3..bfede3a8fcc4d 100644 --- a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx +++ b/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx @@ -21,7 +21,7 @@ import { uniq } from 'lodash'; import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; // TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715 -// import { AutocompleteStart } from '../../../../../../../src/plugins/data/public'; +// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public'; type AutocompleteStart = any; import * as i18n from '../translations'; diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx index 5a36e155c548f..8f5afbbc86629 100644 --- a/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx +++ b/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx @@ -13,7 +13,7 @@ import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution- import { DataViewBase, DataViewFieldBase } from '@kbn/es-query'; // TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715 -// import { AutocompleteStart } from '../../../../../../../src/plugins/data/public'; +// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public'; type AutocompleteStart = any; import * as i18n from '../translations'; diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx index 82b9cb029d8dc..82d36aef83728 100644 --- a/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx +++ b/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx @@ -15,7 +15,7 @@ import { uniq } from 'lodash'; import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; // TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715 -// import { AutocompleteStart } from '../../../../../../../src/plugins/data/public'; +// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public'; type AutocompleteStart = any; import * as i18n from '../translations'; diff --git a/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts b/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts index ca0868e5056a6..1b2de4567fe2a 100644 --- a/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts +++ b/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts @@ -12,7 +12,7 @@ import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution- import { DataViewBase, DataViewFieldBase, getDataViewFieldSubtypeNested } from '@kbn/es-query'; // TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715 -// import { AutocompleteStart } from '../../../../../../../../src/plugins/data/public'; +// import { AutocompleteStart } from '../../../../../../../../src/plugins/unified_search/public'; type AutocompleteStart = any; interface FuncArgs { diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index fbf6d64170ee8..ca81383ba639f 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -40,6 +40,11 @@ kibana_vars=( csp.report_to data.autocomplete.valueSuggestions.terminateAfter data.autocomplete.valueSuggestions.timeout + unifiedSearch.autocomplete.valueSuggestions.terminateAfter + unifiedSearch.autocomplete.valueSuggestions.timeout + unifiedSearch.autocomplete.querySuggestions.enabled + unifiedSearch.autocomplete.valueSuggestions.enabled + unifiedSearch.autocomplete.valueSuggestions.tiers elasticsearch.customHeaders elasticsearch.hosts elasticsearch.logQueries diff --git a/src/plugins/controls/kibana.json b/src/plugins/controls/kibana.json index 20afd63505a73..e87af3f517af2 100644 --- a/src/plugins/controls/kibana.json +++ b/src/plugins/controls/kibana.json @@ -17,7 +17,8 @@ "expressions", "embeddable", "dataViews", - "data" + "data", + "unifiedSearch" ], "optionalPlugins": [] } diff --git a/src/plugins/controls/public/__stories__/controls.stories.tsx b/src/plugins/controls/public/__stories__/controls.stories.tsx index 74d0d3e9de6a9..481016af72a36 100644 --- a/src/plugins/controls/public/__stories__/controls.stories.tsx +++ b/src/plugins/controls/public/__stories__/controls.stories.tsx @@ -31,7 +31,7 @@ import { decorators } from './decorators'; import { ControlsPanels } from '../control_group/types'; import { ControlGroupContainer } from '../control_group'; import { pluginServices, registry } from '../services/storybook'; -import { replaceValueSuggestionMethod } from '../services/storybook/data'; +import { replaceValueSuggestionMethod } from '../services/storybook/unified_search'; import { injectStorybookDataView } from '../services/storybook/data_views'; import { populateStorybookControlFactories } from './storybook_control_factories'; import { OptionsListRequest } from '../services/options_list'; diff --git a/src/plugins/controls/public/services/data.ts b/src/plugins/controls/public/services/data.ts index 74c30a1f6d70e..4e9db3b68e904 100644 --- a/src/plugins/controls/public/services/data.ts +++ b/src/plugins/controls/public/services/data.ts @@ -24,7 +24,6 @@ export interface ControlsDataService { ) => Observable<{ min?: number; max?: number }>; getDataView: DataPublicPluginStart['dataViews']['get']; getDataView$: (id: string) => Observable; - autocomplete: DataPublicPluginStart['autocomplete']; query: DataPublicPluginStart['query']; searchSource: DataPublicPluginStart['search']['searchSource']; timefilter: DataPublicPluginStart['query']['timefilter']['timefilter']; diff --git a/src/plugins/controls/public/services/index.ts b/src/plugins/controls/public/services/index.ts index cf358dac8b48b..ac2e8374ad06b 100644 --- a/src/plugins/controls/public/services/index.ts +++ b/src/plugins/controls/public/services/index.ts @@ -12,6 +12,7 @@ import { ControlsOverlaysService } from './overlays'; import { registry as stubRegistry } from './stub'; import { ControlsPluginStart } from '../types'; import { ControlsDataService } from './data'; +import { ControlsUnifiedSearchService } from './unified_search'; import { ControlsService } from './controls'; import { ControlsHTTPService } from './http'; import { ControlsOptionsListService } from './options_list'; @@ -22,6 +23,7 @@ export interface ControlsServices { dataViews: ControlsDataViewsService; overlays: ControlsOverlaysService; data: ControlsDataService; + unifiedSearch: ControlsUnifiedSearchService; http: ControlsHTTPService; settings: ControlsSettingsService; diff --git a/src/plugins/controls/public/services/kibana/data.ts b/src/plugins/controls/public/services/kibana/data.ts index 3a36b929c7cb0..29a96a98c7e76 100644 --- a/src/plugins/controls/public/services/kibana/data.ts +++ b/src/plugins/controls/public/services/kibana/data.ts @@ -43,7 +43,7 @@ const minMaxAgg = (field?: DataViewField) => { export const dataServiceFactory: DataServiceFactory = ({ startPlugins }) => { const { - data: { query: queryPlugin, search, autocomplete }, + data: { query: queryPlugin, search }, } = startPlugins; const { data } = startPlugins; @@ -95,7 +95,6 @@ export const dataServiceFactory: DataServiceFactory = ({ startPlugins }) => { from(fetchFieldRange(dataView, fieldName, input)), getDataView: data.dataViews.get, getDataView$: (id: string) => from(data.dataViews.get(id)), - autocomplete, query: queryPlugin, searchSource: search.searchSource, timefilter: queryPlugin.timefilter.timefilter, diff --git a/src/plugins/controls/public/services/kibana/index.ts b/src/plugins/controls/public/services/kibana/index.ts index bed97091bed55..1bb8f600ecf81 100644 --- a/src/plugins/controls/public/services/kibana/index.ts +++ b/src/plugins/controls/public/services/kibana/index.ts @@ -22,6 +22,7 @@ import { dataServiceFactory } from './data'; import { httpServiceFactory } from './http'; import { optionsListServiceFactory } from './options_list'; import { settingsServiceFactory } from './settings'; +import { unifiedSearchServiceFactory } from './unified_search'; export const providers: PluginServiceProviders< ControlsServices, @@ -29,6 +30,7 @@ export const providers: PluginServiceProviders< > = { http: new PluginServiceProvider(httpServiceFactory), data: new PluginServiceProvider(dataServiceFactory), + unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory), overlays: new PluginServiceProvider(overlaysServiceFactory), dataViews: new PluginServiceProvider(dataViewsServiceFactory), settings: new PluginServiceProvider(settingsServiceFactory), diff --git a/src/plugins/controls/public/services/kibana/unified_search.ts b/src/plugins/controls/public/services/kibana/unified_search.ts new file mode 100644 index 0000000000000..15cb3a02ca45e --- /dev/null +++ b/src/plugins/controls/public/services/kibana/unified_search.ts @@ -0,0 +1,26 @@ +/* + * 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 { KibanaPluginServiceFactory } from '@kbn/presentation-util-plugin/public'; +import { ControlsUnifiedSearchService } from '../unified_search'; +import { ControlsPluginStartDeps } from '../../types'; + +export type UnifiedSearchServiceFactory = KibanaPluginServiceFactory< + ControlsUnifiedSearchService, + ControlsPluginStartDeps +>; + +export const unifiedSearchServiceFactory: UnifiedSearchServiceFactory = ({ startPlugins }) => { + const { + unifiedSearch: { autocomplete }, + } = startPlugins; + + return { + autocomplete, + }; +}; diff --git a/src/plugins/controls/public/services/storybook/data.ts b/src/plugins/controls/public/services/storybook/data.ts index 38a8d01d8c7c8..5d8cacad9b7b3 100644 --- a/src/plugins/controls/public/services/storybook/data.ts +++ b/src/plugins/controls/public/services/storybook/data.ts @@ -9,20 +9,11 @@ import { of, Observable } from 'rxjs'; import { PluginServiceFactory } from '@kbn/presentation-util-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { DataViewField, DataView } from '@kbn/data-views-plugin/common'; +import { DataView } from '@kbn/data-views-plugin/common'; import { ControlsDataService } from '../data'; -let valueSuggestionMethod = ({ field, query }: { field: DataViewField; query: string }) => - Promise.resolve(['storybook', 'default', 'values']); -export const replaceValueSuggestionMethod = ( - newMethod: ({ field, query }: { field: DataViewField; query: string }) => Promise -) => (valueSuggestionMethod = newMethod); - export type DataServiceFactory = PluginServiceFactory; export const dataServiceFactory: DataServiceFactory = () => ({ - autocomplete: { - getValueSuggestions: valueSuggestionMethod, - } as unknown as DataPublicPluginStart['autocomplete'], query: {} as unknown as DataPublicPluginStart['query'], searchSource: { create: () => ({ diff --git a/src/plugins/controls/public/services/storybook/index.ts b/src/plugins/controls/public/services/storybook/index.ts index f586063e5a339..751aaeefee9c2 100644 --- a/src/plugins/controls/public/services/storybook/index.ts +++ b/src/plugins/controls/public/services/storybook/index.ts @@ -14,6 +14,7 @@ import { } from '@kbn/presentation-util-plugin/public'; import { ControlsServices } from '..'; import { dataServiceFactory } from './data'; +import { unifiedSearchServiceFactory } from './unified_search'; import { overlaysServiceFactory } from './overlays'; import { dataViewsServiceFactory } from './data_views'; import { httpServiceFactory } from '../stub/http'; @@ -28,6 +29,7 @@ export const providers: PluginServiceProviders = { dataViews: new PluginServiceProvider(dataViewsServiceFactory), http: new PluginServiceProvider(httpServiceFactory), data: new PluginServiceProvider(dataServiceFactory), + unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory), overlays: new PluginServiceProvider(overlaysServiceFactory), settings: new PluginServiceProvider(settingsServiceFactory), diff --git a/src/plugins/controls/public/services/storybook/unified_search.ts b/src/plugins/controls/public/services/storybook/unified_search.ts new file mode 100644 index 0000000000000..cb7df1bd1e483 --- /dev/null +++ b/src/plugins/controls/public/services/storybook/unified_search.ts @@ -0,0 +1,25 @@ +/* + * 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 { PluginServiceFactory } from '@kbn/presentation-util-plugin/public'; +import { DataViewField } from '@kbn/data-views-plugin/common'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import { ControlsUnifiedSearchService } from '../unified_search'; + +let valueSuggestionMethod = ({ field, query }: { field: DataViewField; query: string }) => + Promise.resolve(['storybook', 'default', 'values']); +export const replaceValueSuggestionMethod = ( + newMethod: ({ field, query }: { field: DataViewField; query: string }) => Promise +) => (valueSuggestionMethod = newMethod); + +export type UnifiedSearchServiceFactory = PluginServiceFactory; +export const unifiedSearchServiceFactory: UnifiedSearchServiceFactory = () => ({ + autocomplete: { + getValueSuggestions: valueSuggestionMethod, + } as unknown as UnifiedSearchPublicPluginStart['autocomplete'], +}); diff --git a/src/plugins/controls/public/services/stub/index.ts b/src/plugins/controls/public/services/stub/index.ts index 9b767496fa985..4cd138689452f 100644 --- a/src/plugins/controls/public/services/stub/index.ts +++ b/src/plugins/controls/public/services/stub/index.ts @@ -20,6 +20,7 @@ import { dataServiceFactory } from '../storybook/data'; import { dataViewsServiceFactory } from '../storybook/data_views'; import { optionsListServiceFactory } from '../storybook/options_list'; import { settingsServiceFactory } from '../storybook/settings'; +import { unifiedSearchServiceFactory } from '../storybook/unified_search'; export const providers: PluginServiceProviders = { http: new PluginServiceProvider(httpServiceFactory), @@ -27,7 +28,7 @@ export const providers: PluginServiceProviders = { overlays: new PluginServiceProvider(overlaysServiceFactory), dataViews: new PluginServiceProvider(dataViewsServiceFactory), settings: new PluginServiceProvider(settingsServiceFactory), - + unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory), controls: new PluginServiceProvider(controlsServiceFactory), optionsList: new PluginServiceProvider(optionsListServiceFactory), }; diff --git a/src/plugins/controls/public/services/unified_search.ts b/src/plugins/controls/public/services/unified_search.ts new file mode 100644 index 0000000000000..2c69537b62d65 --- /dev/null +++ b/src/plugins/controls/public/services/unified_search.ts @@ -0,0 +1,13 @@ +/* + * 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 { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; + +export interface ControlsUnifiedSearchService { + autocomplete: UnifiedSearchPublicPluginStart['autocomplete']; +} diff --git a/src/plugins/controls/public/types.ts b/src/plugins/controls/public/types.ts index dbe83abf2bf97..d7766eb8d478b 100644 --- a/src/plugins/controls/public/types.ts +++ b/src/plugins/controls/public/types.ts @@ -17,6 +17,7 @@ import { } from '@kbn/embeddable-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { DataView, DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { ControlInput } from '../common/types'; import { ControlsService } from './services/controls'; @@ -70,6 +71,7 @@ export interface ControlsPluginSetupDeps { } export interface ControlsPluginStartDeps { data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; embeddable: EmbeddableStart; dataViews: DataViewsPublicPluginStart; } diff --git a/src/plugins/controls/server/control_types/options_list/options_list_suggestions_route.ts b/src/plugins/controls/server/control_types/options_list/options_list_suggestions_route.ts index 70c1db510c539..7ed1ace5dbde9 100644 --- a/src/plugins/controls/server/control_types/options_list/options_list_suggestions_route.ts +++ b/src/plugins/controls/server/control_types/options_list/options_list_suggestions_route.ts @@ -14,8 +14,8 @@ import { Observable } from 'rxjs'; import { CoreSetup, ElasticsearchClient } from '@kbn/core/server'; import { getKbnServerError, reportServerError } from '@kbn/kibana-utils-plugin/server'; -import { PluginSetup as DataPluginSetup } from '@kbn/data-plugin/server'; import { FieldSpec, getFieldSubtypeNested } from '@kbn/data-views-plugin/common'; +import { PluginSetup as UnifiedSearchPluginSetup } from '@kbn/unified-search-plugin/server'; import { OptionsListRequestBody, OptionsListResponse, @@ -23,7 +23,7 @@ import { export const setupOptionsListSuggestionsRoute = ( { http }: CoreSetup, - getAutocompleteSettings: DataPluginSetup['autocomplete']['getAutocompleteSettings'] + getAutocompleteSettings: UnifiedSearchPluginSetup['autocomplete']['getAutocompleteSettings'] ) => { const router = http.createRouter(); diff --git a/src/plugins/controls/server/plugin.ts b/src/plugins/controls/server/plugin.ts index 8e391e5f1ac87..cbe9d39234361 100644 --- a/src/plugins/controls/server/plugin.ts +++ b/src/plugins/controls/server/plugin.ts @@ -10,6 +10,7 @@ import { CoreSetup, Plugin } from '@kbn/core/server'; import { EmbeddableSetup } from '@kbn/embeddable-plugin/server'; import { PluginSetup as DataSetup } from '@kbn/data-plugin/server'; +import { PluginSetup as UnifiedSearchSetup } from '@kbn/unified-search-plugin/server'; import { setupOptionsListSuggestionsRoute } from './control_types/options_list/options_list_suggestions_route'; import { controlGroupContainerPersistableStateServiceFactory } from './control_group/control_group_container_factory'; import { optionsListPersistableStateServiceFactory } from './control_types/options_list/options_list_embeddable_factory'; @@ -18,10 +19,11 @@ import { timeSliderPersistableStateServiceFactory } from './control_types/time_s interface SetupDeps { embeddable: EmbeddableSetup; data: DataSetup; + unifiedSearch: UnifiedSearchSetup; } export class ControlsPlugin implements Plugin { - public setup(core: CoreSetup, { embeddable, data }: SetupDeps) { + public setup(core: CoreSetup, { embeddable, unifiedSearch }: SetupDeps) { embeddable.registerEmbeddableFactory(optionsListPersistableStateServiceFactory()); embeddable.registerEmbeddableFactory(timeSliderPersistableStateServiceFactory()); @@ -29,7 +31,7 @@ export class ControlsPlugin implements Plugin { controlGroupContainerPersistableStateServiceFactory(embeddable) ); - setupOptionsListSuggestionsRoute(core, data.autocomplete.getAutocompleteSettings); + setupOptionsListSuggestionsRoute(core, unifiedSearch.autocomplete.getAutocompleteSettings); return {}; } diff --git a/src/plugins/controls/tsconfig.json b/src/plugins/controls/tsconfig.json index 10ec84fbd32f6..5a17afc931340 100644 --- a/src/plugins/controls/tsconfig.json +++ b/src/plugins/controls/tsconfig.json @@ -23,6 +23,7 @@ { "path": "../embeddable/tsconfig.json" }, { "path": "../presentation_util/tsconfig.json" }, { "path": "../kibana_react/tsconfig.json" }, - { "path": "../data/tsconfig.json" } + { "path": "../data/tsconfig.json" }, + { "path": "../unified_search/tsconfig.json" } ] } diff --git a/src/plugins/data/config.ts b/src/plugins/data/config.ts index 2512846554106..c419683de9868 100644 --- a/src/plugins/data/config.ts +++ b/src/plugins/data/config.ts @@ -9,28 +9,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; export const configSchema = schema.object({ - autocomplete: schema.object({ - querySuggestions: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), - valueSuggestions: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - tiers: schema.arrayOf( - schema.oneOf([ - schema.literal('data_content'), - schema.literal('data_hot'), - schema.literal('data_warm'), - schema.literal('data_cold'), - schema.literal('data_frozen'), - ]), - { - defaultValue: ['data_hot', 'data_warm', 'data_content', 'data_cold'], - } - ), - terminateAfter: schema.duration({ defaultValue: 100000 }), - timeout: schema.duration({ defaultValue: 1000 }), - }), - }), search: schema.object({ aggs: schema.object({ shardDelay: schema.object({ diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index e3369c2d571a6..fa7453d4c5bda 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -4,7 +4,7 @@ "server": true, "ui": true, "requiredPlugins": ["bfetch", "expressions", "uiActions", "share", "inspector", "fieldFormats", "dataViews"], - "serviceFolders": ["search", "query", "autocomplete", "ui"], + "serviceFolders": ["search", "query", "ui"], "optionalPlugins": ["usageCollection", "taskManager", "security"], "extraPublicDirs": ["common"], "requiredBundles": ["kibanaUtils", "kibanaReact", "inspector"], diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 1f2b00313ddb9..9f1bf02ec2cd4 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -95,20 +95,6 @@ export { DuplicateDataViewError, } from '../common'; -/* - * Autocomplete query suggestions: - */ - -export type { - QuerySuggestion, - QuerySuggestionGetFn, - QuerySuggestionGetFnArgs, - QuerySuggestionBasic, - QuerySuggestionField, - AutocompleteStart, -} from './autocomplete'; - -export { QuerySuggestionTypes } from './autocomplete'; /* * Search: */ @@ -273,8 +259,12 @@ export { TimeHistory, getQueryLog, mapAndFlattenFilters, + QueryService, } from './query'; +export { NowProvider } from './now_provider'; +export type { NowProviderInternalContract } from './now_provider'; + export type { QueryState, SavedQuery, @@ -288,6 +278,7 @@ export type { PersistedLog, QueryStringContract, QuerySetup, + TimefilterSetup, } from './query'; export type { AggsStart } from './search/aggs'; diff --git a/src/plugins/data/public/mocks.ts b/src/plugins/data/public/mocks.ts index af6fdedc3ed9f..27e365ce0cb37 100644 --- a/src/plugins/data/public/mocks.ts +++ b/src/plugins/data/public/mocks.ts @@ -11,27 +11,14 @@ import { createDatatableUtilitiesMock } from '../common/mocks'; import { DataPlugin, DataViewsContract } from '.'; import { searchServiceMock } from './search/mocks'; import { queryServiceMock } from './query/mocks'; -import { AutocompleteStart, AutocompleteSetup } from './autocomplete'; import { createNowProviderMock } from './now_provider/mocks'; export type Setup = jest.Mocked>; export type Start = jest.Mocked>; -const autocompleteSetupMock: jest.Mocked = { - getQuerySuggestions: jest.fn(), - getAutocompleteSettings: jest.fn(), -}; - -const autocompleteStartMock: jest.Mocked = { - getValueSuggestions: jest.fn(), - getQuerySuggestions: jest.fn(), - hasQuerySuggestions: jest.fn(), -}; - const createSetupContract = (): Setup => { const querySetupMock = queryServiceMock.createSetupContract(); return { - autocomplete: autocompleteSetupMock, search: searchServiceMock.createSetupContract(), query: querySetupMock, }; @@ -58,7 +45,6 @@ const createStartContract = (): Start => { createFiltersFromValueClickAction: jest.fn().mockResolvedValue(['yes']), createFiltersFromRangeSelectAction: jest.fn(), }, - autocomplete: autocompleteStartMock, datatableUtilities: createDatatableUtilitiesMock(), search: searchServiceMock.createStartContract(), fieldFormats: fieldFormatsServiceMock.createStartContract(), diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts index ed9ba5c00e493..175d05870b0c6 100644 --- a/src/plugins/data/public/plugin.ts +++ b/src/plugins/data/public/plugin.ts @@ -21,7 +21,6 @@ import type { DataSetupDependencies, DataStartDependencies, } from './types'; -import { AutocompleteService } from './autocomplete'; import { SearchService } from './search/search_service'; import { QueryService } from './query'; import { @@ -52,7 +51,6 @@ export class DataPublicPlugin DataStartDependencies > { - private readonly autocomplete: AutocompleteService; private readonly searchService: SearchService; private readonly queryService: QueryService; private readonly storage: IStorageWrapper; @@ -62,7 +60,6 @@ export class DataPublicPlugin this.searchService = new SearchService(initializerContext); this.queryService = new QueryService(); - this.autocomplete = new AutocompleteService(initializerContext); this.storage = new Storage(window.localStorage); this.nowProvider = new NowProvider(); } @@ -113,10 +110,6 @@ export class DataPublicPlugin ); return { - autocomplete: this.autocomplete.setup(core, { - timefilter: queryService.timefilter, - usageCollection, - }), search: searchService, query: queryService, }; @@ -161,7 +154,6 @@ export class DataPublicPlugin createFiltersFromValueClickAction, createFiltersFromRangeSelectAction, }, - autocomplete: this.autocomplete.start(), datatableUtilities, fieldFormats, indexPatterns: dataViews, @@ -175,7 +167,6 @@ export class DataPublicPlugin } public stop() { - this.autocomplete.clearProviders(); this.queryService.stop(); this.searchService.stop(); } diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index 4f571559df8de..b596e02e7f2ac 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -16,7 +16,6 @@ import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/ import { UsageCollectionSetup, UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; import { Setup as InspectorSetup } from '@kbn/inspector-plugin/public'; import { DatatableUtilitiesService } from '../common'; -import { AutocompleteSetup, AutocompleteStart } from './autocomplete'; import { createFiltersFromRangeSelectAction, createFiltersFromValueClickAction } from './actions'; import type { ISearchSetup, ISearchStart } from './search'; import { QuerySetup, QueryStart } from './query'; @@ -42,7 +41,6 @@ export interface DataStartDependencies { * Data plugin public Setup contract */ export interface DataPublicPluginSetup { - autocomplete: AutocompleteSetup; search: ISearchSetup; query: QuerySetup; } @@ -64,11 +62,6 @@ export interface DataPublicPluginStart { * {@link DataPublicPluginStartActions} */ actions: DataPublicPluginStartActions; - /** - * autocomplete service - * {@link AutocompleteStart} - */ - autocomplete: AutocompleteStart; /** * data views service * {@link DataViewsContract} diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 83fcd58ba9a45..b970221c43391 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -16,6 +16,8 @@ import { DataServerPlugin, DataPluginSetup, DataPluginStart } from './plugin'; export * from './deprecated'; export { getEsQueryConfig, DEFAULT_QUERY_LANGUAGE } from '../common'; +export { getRequestAbortedSignal } from './lib'; + /** * Exporters (CSV) */ @@ -68,7 +70,6 @@ import { // tabify calcAutoIntervalLessThan, } from '../common'; -import { autocompleteConfigDeprecationProvider } from './config_deprecations'; export type { ParsedInterval, @@ -121,9 +122,7 @@ export type { DataPluginSetup as PluginSetup, DataPluginStart as PluginStart }; export { DataServerPlugin as Plugin }; export const config: PluginConfigDescriptor = { - deprecations: autocompleteConfigDeprecationProvider, exposeToBrowser: { - autocomplete: true, search: true, }, schema: configSchema, diff --git a/src/plugins/data/server/mocks.ts b/src/plugins/data/server/mocks.ts index 477ccf3120323..62e1798c714a1 100644 --- a/src/plugins/data/server/mocks.ts +++ b/src/plugins/data/server/mocks.ts @@ -18,16 +18,10 @@ import { import { createIndexPatternsStartMock } from './data_views/mocks'; import { createDatatableUtilitiesMock } from './datatable_utilities/mock'; import { DataRequestHandlerContext } from './search'; -import { AutocompleteSetup } from './autocomplete'; - -const autocompleteSetupMock: jest.Mocked = { - getAutocompleteSettings: jest.fn(), -}; function createSetupContract() { return { search: createSearchSetupMock(), - autocomplete: autocompleteSetupMock, /** * @deprecated - use directly from "fieldFormats" plugin instead */ diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index dcf0baa188eaa..d1beb335dd35c 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -19,17 +19,14 @@ import { SearchService } from './search/search_service'; import { QueryService } from './query/query_service'; import { ScriptsService } from './scripts'; import { KqlTelemetryService } from './kql_telemetry'; -import { AutocompleteService } from './autocomplete'; import { getUiSettings } from './ui_settings'; import { QuerySetup } from './query'; -import { AutocompleteSetup } from './autocomplete/autocomplete_service'; interface DataEnhancements { search: SearchEnhancements; } export interface DataPluginSetup { - autocomplete: AutocompleteSetup; search: ISearchSetup; query: QuerySetup; /** @@ -81,7 +78,6 @@ export class DataServerPlugin private readonly searchService: SearchService; private readonly scriptsService: ScriptsService; private readonly kqlTelemetryService: KqlTelemetryService; - private readonly autocompleteService: AutocompleteService; private readonly queryService = new QueryService(); private readonly logger: Logger; @@ -90,7 +86,6 @@ export class DataServerPlugin this.searchService = new SearchService(initializerContext, this.logger); this.scriptsService = new ScriptsService(); this.kqlTelemetryService = new KqlTelemetryService(initializerContext); - this.autocompleteService = new AutocompleteService(initializerContext); } public setup( @@ -110,7 +105,6 @@ export class DataServerPlugin }); return { - autocomplete: this.autocompleteService.setup(core), __enhance: (enhancements: DataEnhancements) => { searchSetup.__enhance(enhancements.search); }, diff --git a/src/plugins/input_control_vis/public/plugin.ts b/src/plugins/input_control_vis/public/plugin.ts index 73158e17882f6..f1f3cf609d728 100644 --- a/src/plugins/input_control_vis/public/plugin.ts +++ b/src/plugins/input_control_vis/public/plugin.ts @@ -9,7 +9,10 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '@kbn/core/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import { + UnifiedSearchPublicPluginStart, + UnifiedSearchPluginSetup, +} from '@kbn/unified-search-plugin/public'; import { Plugin as ExpressionsPublicPlugin } from '@kbn/expressions-plugin/public'; import { VisualizationsSetup, VisualizationsStart } from '@kbn/visualizations-plugin/public'; import { createInputControlVisFn } from './input_control_fn'; @@ -26,6 +29,7 @@ export interface InputControlSettings { export interface InputControlVisDependencies { core: InputControlVisCoreSetup; data: DataPublicPluginSetup; + unifiedSearch: UnifiedSearchPluginSetup; getSettings: () => Promise; } @@ -34,6 +38,7 @@ export interface InputControlVisPluginSetupDependencies { expressions: ReturnType; visualizations: VisualizationsSetup; data: DataPublicPluginSetup; + unifiedSearch: UnifiedSearchPluginSetup; } /** @internal */ @@ -50,15 +55,16 @@ export class InputControlVisPlugin implements Plugin { public setup( core: InputControlVisCoreSetup, - { expressions, visualizations, data }: InputControlVisPluginSetupDependencies + { expressions, visualizations, unifiedSearch, data }: InputControlVisPluginSetupDependencies ) { const visualizationDependencies: Readonly = { core, - data, + unifiedSearch, getSettings: async () => { - const { timeout, terminateAfter } = data.autocomplete.getAutocompleteSettings(); + const { timeout, terminateAfter } = unifiedSearch.autocomplete.getAutocompleteSettings(); return { autocompleteTimeout: timeout, autocompleteTerminateAfter: terminateAfter }; }, + data, }; expressions.registerFunction(createInputControlVisFn); diff --git a/src/plugins/unified_search/config.ts b/src/plugins/unified_search/config.ts index c0067771b6803..4814dddea4052 100644 --- a/src/plugins/unified_search/config.ts +++ b/src/plugins/unified_search/config.ts @@ -8,6 +8,29 @@ import { schema, TypeOf } from '@kbn/config-schema'; -export const configSchema = schema.object({}); +export const configSchema = schema.object({ + autocomplete: schema.object({ + querySuggestions: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + valueSuggestions: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + tiers: schema.arrayOf( + schema.oneOf([ + schema.literal('data_content'), + schema.literal('data_hot'), + schema.literal('data_warm'), + schema.literal('data_cold'), + schema.literal('data_frozen'), + ]), + { + defaultValue: ['data_hot', 'data_warm', 'data_content', 'data_cold'], + } + ), + terminateAfter: schema.duration({ defaultValue: 100000 }), + timeout: schema.duration({ defaultValue: 1000 }), + }), + }), +}); export type ConfigSchema = TypeOf; diff --git a/src/plugins/unified_search/kibana.json b/src/plugins/unified_search/kibana.json index 8673c6ec783bb..b947141a0c68a 100755 --- a/src/plugins/unified_search/kibana.json +++ b/src/plugins/unified_search/kibana.json @@ -7,8 +7,10 @@ "name": "Unified Search", "githubTeam": "kibana-app-services" }, - "server": false, + "server": true, "ui": true, "requiredPlugins": ["dataViews", "data", "uiActions"], - "requiredBundles": ["kibanaUtils", "kibanaReact", "data"] + "requiredBundles": ["kibanaUtils", "kibanaReact", "data"], + "serviceFolders": ["autocomplete"], + "configPath": ["unifiedSearch"] } diff --git a/src/plugins/data/public/autocomplete/autocomplete_service.ts b/src/plugins/unified_search/public/autocomplete/autocomplete_service.ts similarity index 93% rename from src/plugins/data/public/autocomplete/autocomplete_service.ts rename to src/plugins/unified_search/public/autocomplete/autocomplete_service.ts index 95db8e31eb4d2..97d128df5a782 100644 --- a/src/plugins/data/public/autocomplete/autocomplete_service.ts +++ b/src/plugins/unified_search/public/autocomplete/autocomplete_service.ts @@ -8,8 +8,8 @@ import { CoreSetup, PluginInitializerContext } from '@kbn/core/public'; import moment from 'moment'; +import type { TimefilterSetup } from '@kbn/data-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; -import type { TimefilterSetup } from '../query'; import { QuerySuggestionGetFn } from './providers/query_suggestion_provider'; import { getEmptyValueSuggestions, @@ -23,7 +23,7 @@ import { KUERY_LANGUAGE_NAME, setupKqlQuerySuggestionProvider, } from './providers/kql_query_suggestion'; -import { DataPublicPluginStart, DataStartDependencies } from '../types'; +import { UnifiedSearchPublicPluginStart, UnifiedSearchStartDependencies } from '../types'; export class AutocompleteService { autocompleteConfig: ConfigSchema['autocomplete']; @@ -50,7 +50,7 @@ export class AutocompleteService { /** @public **/ public setup( - core: CoreSetup, + core: CoreSetup, { timefilter, usageCollection, diff --git a/src/plugins/data/public/autocomplete/collectors/create_usage_collector.ts b/src/plugins/unified_search/public/autocomplete/collectors/create_usage_collector.ts similarity index 100% rename from src/plugins/data/public/autocomplete/collectors/create_usage_collector.ts rename to src/plugins/unified_search/public/autocomplete/collectors/create_usage_collector.ts diff --git a/src/plugins/data/public/autocomplete/collectors/index.ts b/src/plugins/unified_search/public/autocomplete/collectors/index.ts similarity index 100% rename from src/plugins/data/public/autocomplete/collectors/index.ts rename to src/plugins/unified_search/public/autocomplete/collectors/index.ts diff --git a/src/plugins/data/public/autocomplete/collectors/types.ts b/src/plugins/unified_search/public/autocomplete/collectors/types.ts similarity index 100% rename from src/plugins/data/public/autocomplete/collectors/types.ts rename to src/plugins/unified_search/public/autocomplete/collectors/types.ts diff --git a/src/plugins/data/public/autocomplete/index.ts b/src/plugins/unified_search/public/autocomplete/index.ts similarity index 100% rename from src/plugins/data/public/autocomplete/index.ts rename to src/plugins/unified_search/public/autocomplete/index.ts diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/README.md b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/README.md similarity index 100% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/README.md rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/README.md diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json similarity index 100% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/__fixtures__/index_pattern_response.json diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts similarity index 95% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts index 68b0d123f0a92..24a27bcb99fbe 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/conjunction.test.ts @@ -6,9 +6,10 @@ * Side Public License, v 1. */ -import { setupGetConjunctionSuggestions } from './conjunction'; -import { QuerySuggestionGetFnArgs, KueryNode } from '../../..'; import { coreMock } from '@kbn/core/public/mocks'; +import { KueryNode } from '@kbn/data-plugin/public'; +import { setupGetConjunctionSuggestions } from './conjunction'; +import { QuerySuggestionGetFnArgs } from '../query_suggestion_provider'; const mockKueryNode = (kueryNode: Partial) => kueryNode as unknown as KueryNode; diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx similarity index 69% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx index c11c54c2a6f38..ad757f5afbf9c 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/conjunction.tsx @@ -10,21 +10,21 @@ import React from 'react'; import { $Keys } from 'utility-types'; import { FormattedMessage } from '@kbn/i18n-react'; import { KqlQuerySuggestionProvider } from './types'; -import { QuerySuggestion, QuerySuggestionTypes } from '../../..'; +import { QuerySuggestion, QuerySuggestionTypes } from '../query_suggestion_provider'; const bothArgumentsText = ( ); const oneOrMoreArgumentsText = ( ); @@ -32,20 +32,20 @@ const conjunctions: Record = { and: (

{bothArgumentsText}, }} description="Full text: ' Requires both arguments to be true'. See - 'data.kueryAutocomplete.andOperatorDescription.bothArgumentsText' for 'both arguments' part." + 'unifiedSearch.kueryAutocomplete.andOperatorDescription.bothArgumentsText' for 'both arguments' part." />

), or: (

= { ), }} description="Full text: 'Requires one or more arguments to be true'. See - 'data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText' for 'one or more arguments' part." + 'unifiedSearch.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText' for 'one or more arguments' part." />

), diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/field.test.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.test.ts similarity index 97% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/field.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.test.ts index 7e1633a2cd5e0..4446fcf685bde 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/field.test.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.test.ts @@ -8,8 +8,9 @@ import indexPatternResponse from './__fixtures__/index_pattern_response.json'; +import { indexPatterns as indexPatternsUtils, KueryNode } from '@kbn/data-plugin/public'; import { setupGetFieldSuggestions } from './field'; -import { indexPatterns as indexPatternsUtils, QuerySuggestionGetFnArgs, KueryNode } from '../../..'; +import { QuerySuggestionGetFnArgs } from '../query_suggestion_provider'; import { coreMock } from '@kbn/core/public/mocks'; const mockKueryNode = (kueryNode: Partial) => kueryNode as unknown as KueryNode; diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/field.tsx b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx similarity index 93% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/field.tsx rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx index 9664353515c6b..139405f6af9f4 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/field.tsx +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx @@ -6,15 +6,11 @@ * Side Public License, v 1. */ +import { IFieldType, indexPatterns as indexPatternsUtils } from '@kbn/data-plugin/public'; import { flatten } from 'lodash'; import { escapeKuery } from './lib/escape_kuery'; import { sortPrefixFirst } from './sort_prefix_first'; -import { - IFieldType, - indexPatterns as indexPatternsUtils, - QuerySuggestionField, - QuerySuggestionTypes, -} from '../../..'; +import { QuerySuggestionField, QuerySuggestionTypes } from '../query_suggestion_provider'; import { KqlQuerySuggestionProvider } from './types'; const keywordComparator = (first: IFieldType, second: IFieldType) => { diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/index.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts similarity index 93% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/index.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts index 6ddf518933af9..1002863fec7f4 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/index.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts @@ -14,12 +14,12 @@ import { setupGetFieldSuggestions } from './field'; import { setupGetValueSuggestions } from './value'; import { setupGetOperatorSuggestions } from './operator'; import { setupGetConjunctionSuggestions } from './conjunction'; +import { UnifiedSearchPublicPluginStart } from '../../../types'; import { QuerySuggestion, QuerySuggestionGetFnArgs, QuerySuggestionGetFn, - DataPublicPluginStart, -} from '../../..'; +} from '../query_suggestion_provider'; const cursorSymbol = '@kuery-cursor@'; @@ -29,7 +29,7 @@ const dedup = (suggestions: QuerySuggestion[]): QuerySuggestion[] => export const KUERY_LANGUAGE_NAME = 'kuery'; export const setupKqlQuerySuggestionProvider = ( - core: CoreSetup + core: CoreSetup ): QuerySuggestionGetFn => { const providers = { field: setupGetFieldSuggestions(core), diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts similarity index 100% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.test.ts diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts similarity index 100% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/operator.test.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/operator.test.ts similarity index 97% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/operator.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/operator.test.ts index 6a2411cc5ccbe..a40678ad4ac16 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/operator.test.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/operator.test.ts @@ -9,7 +9,8 @@ import indexPatternResponse from './__fixtures__/index_pattern_response.json'; import { setupGetOperatorSuggestions } from './operator'; -import { QuerySuggestionGetFnArgs, KueryNode } from '../../..'; +import { KueryNode } from '@kbn/data-plugin/public'; +import { QuerySuggestionGetFnArgs } from '../query_suggestion_provider'; import { coreMock } from '@kbn/core/public/mocks'; const mockKueryNode = (kueryNode: Partial) => kueryNode as unknown as KueryNode; diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/operator.tsx b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/operator.tsx similarity index 65% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/operator.tsx rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/operator.tsx index f6517f67218d7..ee53d5cb3d391 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/operator.tsx +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/operator.tsx @@ -12,48 +12,48 @@ import { $Keys } from 'utility-types'; import { flatten } from 'lodash'; import { KqlQuerySuggestionProvider } from './types'; -import { QuerySuggestionTypes } from '../../..'; +import { QuerySuggestionTypes } from '../query_suggestion_provider'; const equalsText = ( ); const lessThanOrEqualToText = ( ); const greaterThanOrEqualToText = ( ); const lessThanText = ( ); const greaterThanText = ( ); const existsText = ( ); @@ -61,11 +61,11 @@ const operators = { ':': { description: ( {equalsText} }} description="Full text: 'equals some value'. See - 'data.kueryAutocomplete.equalOperatorDescription.equalsText' for 'equals' part." + 'unifiedSearch.kueryAutocomplete.equalOperatorDescription.equalsText' for 'equals' part." /> ), fieldTypes: [ @@ -84,7 +84,7 @@ const operators = { '<=': { description: ( ), fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'], @@ -100,7 +100,7 @@ const operators = { '>=': { description: ( ), fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'], @@ -116,11 +116,11 @@ const operators = { '<': { description: ( {lessThanText} }} description="Full text: 'is less than some value'. See - 'data.kueryAutocomplete.lessThanOperatorDescription.lessThanText' for 'less than' part." + 'unifiedSearch.kueryAutocomplete.lessThanOperatorDescription.lessThanText' for 'less than' part." /> ), fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'], @@ -128,13 +128,13 @@ const operators = { '>': { description: ( {greaterThanText}, }} description="Full text: 'is greater than some value'. See - 'data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText' for 'greater than' part." + 'unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText' for 'greater than' part." /> ), fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'], @@ -142,11 +142,11 @@ const operators = { ': *': { description: ( {existsText} }} description="Full text: 'exists in any form'. See - 'data.kueryAutocomplete.existOperatorDescription.existsText' for 'exists' part." + 'unifiedSearch.kueryAutocomplete.existOperatorDescription.existsText' for 'exists' part." /> ), fieldTypes: undefined, diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts similarity index 100% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.test.ts diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts similarity index 100% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/sort_prefix_first.ts diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts similarity index 73% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts index b39f942b1f76c..e9ca34e546f0b 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts @@ -6,10 +6,11 @@ * Side Public License, v 1. */ -import { KueryNode } from '@kbn/es-query'; import { CoreSetup } from '@kbn/core/public'; -import { DataPublicPluginStart, QuerySuggestionBasic, QuerySuggestionGetFnArgs } from '../../..'; +import { KueryNode } from '@kbn/es-query'; +import type { UnifiedSearchPublicPluginStart } from '../../../types'; +import { QuerySuggestionBasic, QuerySuggestionGetFnArgs } from '../query_suggestion_provider'; export type KqlQuerySuggestionProvider = ( - core: CoreSetup + core: CoreSetup ) => (querySuggestionsGetFnArgs: QuerySuggestionGetFnArgs, kueryNode: KueryNode) => Promise; diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/value.test.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/value.test.ts similarity index 97% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/value.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/value.test.ts index 224865449a5a6..3405d26824a26 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/value.test.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/value.test.ts @@ -8,8 +8,10 @@ import { setupGetValueSuggestions } from './value'; import indexPatternResponse from './__fixtures__/index_pattern_response.json'; + import { coreMock } from '@kbn/core/public/mocks'; -import { QuerySuggestionGetFnArgs, KueryNode } from '../../..'; +import { KueryNode } from '@kbn/data-plugin/public'; +import { QuerySuggestionGetFnArgs } from '../query_suggestion_provider'; const mockKueryNode = (kueryNode: Partial) => kueryNode as unknown as KueryNode; diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/value.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/value.ts similarity index 89% rename from src/plugins/data/public/autocomplete/providers/kql_query_suggestion/value.ts rename to src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/value.ts index b75cf9d09d27b..06b0fc9639a3c 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/value.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/value.ts @@ -8,15 +8,11 @@ import { flatten } from 'lodash'; import { CoreSetup } from '@kbn/core/public'; +import { IFieldType, IIndexPattern } from '@kbn/data-plugin/public'; import { escapeQuotes } from './lib/escape_kuery'; import { KqlQuerySuggestionProvider } from './types'; -import { - DataPublicPluginStart, - IFieldType, - IIndexPattern, - QuerySuggestion, - QuerySuggestionTypes, -} from '../../..'; +import type { UnifiedSearchPublicPluginStart } from '../../../types'; +import { QuerySuggestion, QuerySuggestionTypes } from '../query_suggestion_provider'; const wrapAsSuggestions = (start: number, end: number, query: string, values: string[]) => values @@ -29,7 +25,7 @@ const wrapAsSuggestions = (start: number, end: number, query: string, values: st })); export const setupGetValueSuggestions: KqlQuerySuggestionProvider = ( - core: CoreSetup + core: CoreSetup ) => { const autoCompleteServicePromise = core .getStartServices() diff --git a/src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts b/src/plugins/unified_search/public/autocomplete/providers/query_suggestion_provider.ts similarity index 90% rename from src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts rename to src/plugins/unified_search/public/autocomplete/providers/query_suggestion_provider.ts index 0cb229c9b41bc..056fcb716054a 100644 --- a/src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/query_suggestion_provider.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { ValueSuggestionsMethod } from '../../../common'; -import { IFieldType, IIndexPattern } from '../../../common'; +import { ValueSuggestionsMethod } from '@kbn/data-plugin/common'; +import { IFieldType, IIndexPattern } from '@kbn/data-plugin/common'; export enum QuerySuggestionTypes { Field = 'field', diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts b/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts similarity index 97% rename from src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts rename to src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts index bf80438da08a5..a17172a2b6072 100644 --- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import { stubIndexPattern, stubFields } from '../../stubs'; -import type { TimefilterSetup } from '../../query'; +import { IUiSettingsClient, CoreSetup } from '@kbn/core/public'; +import { stubIndexPattern, stubFields } from '@kbn/data-plugin/public/stubs'; +import type { TimefilterSetup } from '@kbn/data-plugin/public'; +import { UI_SETTINGS } from '@kbn/data-plugin/common'; import { setupValueSuggestionProvider } from './value_suggestion_provider'; import type { ValueSuggestionsGetFn } from './value_suggestion_provider'; -import { IUiSettingsClient, CoreSetup } from '@kbn/core/public'; -import { UI_SETTINGS } from '../../../common'; describe('FieldSuggestions', () => { let getValueSuggestions: ValueSuggestionsGetFn; diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts b/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.ts similarity index 95% rename from src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts rename to src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.ts index 422c4e02d8e49..054a243064329 100644 --- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.ts @@ -6,12 +6,17 @@ * Side Public License, v 1. */ +import { CoreSetup } from '@kbn/core/public'; import dateMath from '@kbn/datemath'; import { buildQueryFromFilters } from '@kbn/es-query'; import { memoize } from 'lodash'; -import { CoreSetup } from '@kbn/core/public'; -import { IIndexPattern, IFieldType, UI_SETTINGS, ValueSuggestionsMethod } from '../../../common'; -import type { TimefilterSetup } from '../../query'; +import { + IIndexPattern, + IFieldType, + UI_SETTINGS, + ValueSuggestionsMethod, +} from '@kbn/data-plugin/common'; +import type { TimefilterSetup } from '@kbn/data-plugin/public'; import { AutocompleteUsageCollector } from '../collectors'; export type ValueSuggestionsGetFn = (args: ValueSuggestionsGetFnArgs) => Promise; diff --git a/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx index 057a730e5cc40..50acadea2a990 100644 --- a/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx @@ -7,12 +7,13 @@ */ import React from 'react'; -import { debounce } from 'lodash'; - import { withKibana, KibanaReactContextValue } from '@kbn/kibana-react-plugin/public'; import { IFieldType, UI_SETTINGS } from '@kbn/data-plugin/common'; import { DataView } from '@kbn/data-views-plugin/common'; import { IDataPluginServices } from '@kbn/data-plugin/public'; +import { debounce } from 'lodash'; + +import { getAutocomplete } from '../../services'; export interface PhraseSuggestorProps { kibana: KibanaReactContextValue; @@ -79,8 +80,7 @@ export class PhraseSuggestorUI extends React.Com return; } this.setState({ isLoading: true }); - - const suggestions = await this.services.data.autocomplete.getValueSuggestions({ + const suggestions = await getAutocomplete().getValueSuggestions({ indexPattern, field, query, diff --git a/src/plugins/unified_search/public/index.ts b/src/plugins/unified_search/public/index.ts index ff020ef1e8f94..1200234a793a4 100755 --- a/src/plugins/unified_search/public/index.ts +++ b/src/plugins/unified_search/public/index.ts @@ -7,19 +7,31 @@ */ import { PluginInitializerContext } from '@kbn/core/public'; import { ConfigSchema } from '../config'; -import { UnifiedSearchPublicPlugin } from './plugin'; - export type { IndexPatternSelectProps } from './index_pattern_select'; export type { QueryStringInputProps } from './query_string_input'; export { QueryStringInput } from './query_string_input'; export type { StatefulSearchBarProps, SearchBarProps } from './search_bar'; -export type { UnifiedSearchPublicPluginStart } from './types'; +export type { UnifiedSearchPublicPluginStart, UnifiedSearchPluginSetup } from './types'; export { SearchBar } from './search_bar'; export { FilterLabel, FilterItem } from './filter_bar'; export type { ApplyGlobalFilterActionContext } from './actions'; export { ACTION_GLOBAL_APPLY_FILTER } from './actions'; +/* + * Autocomplete query suggestions: + */ +export type { + QuerySuggestion, + QuerySuggestionGetFn, + QuerySuggestionGetFnArgs, + AutocompleteStart, +} from './autocomplete'; + +export { QuerySuggestionTypes } from './autocomplete'; + +import { UnifiedSearchPublicPlugin } from './plugin'; + // This exports static code and TypeScript types, // as well as, Kibana Platform `plugin()` initializer. export function plugin(initializerContext: PluginInitializerContext) { diff --git a/src/plugins/unified_search/public/mocks.ts b/src/plugins/unified_search/public/mocks.ts index eacbb72cc55ac..e119c58e89f3f 100644 --- a/src/plugins/unified_search/public/mocks.ts +++ b/src/plugins/unified_search/public/mocks.ts @@ -7,12 +7,31 @@ */ import { UnifiedSearchPublicPlugin } from './plugin'; +import { AutocompleteStart, AutocompleteSetup } from './autocomplete'; export type Setup = jest.Mocked>; export type Start = jest.Mocked>; +const autocompleteSetupMock: jest.Mocked = { + getQuerySuggestions: jest.fn(), + getAutocompleteSettings: jest.fn(), +}; + +const autocompleteStartMock: jest.Mocked = { + getValueSuggestions: jest.fn(), + getQuerySuggestions: jest.fn(), + hasQuerySuggestions: jest.fn(), +}; + +const createSetupContract = (): Setup => { + return { + autocomplete: autocompleteSetupMock, + }; +}; + const createStartContract = (): Start => { return { + autocomplete: autocompleteStartMock, ui: { IndexPatternSelect: jest.fn(), SearchBar: jest.fn().mockReturnValue(null), @@ -22,4 +41,5 @@ const createStartContract = (): Start => { export const unifiedSearchPluginMock = { createStartContract, + createSetupContract, }; diff --git a/src/plugins/unified_search/public/plugin.ts b/src/plugins/unified_search/public/plugin.ts index 6064d98ba554d..93f1aaf19fae8 100755 --- a/src/plugins/unified_search/public/plugin.ts +++ b/src/plugins/unified_search/public/plugin.ts @@ -13,11 +13,16 @@ import { Storage, IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { APPLY_FILTER_TRIGGER } from '@kbn/data-plugin/public'; import { ConfigSchema } from '../config'; -import { setIndexPatterns, setTheme, setOverlays } from './services'; +import { setIndexPatterns, setTheme, setOverlays, setAutocomplete } from './services'; +import { AutocompleteService } from './autocomplete'; import { createSearchBar } from './search_bar'; import { createIndexPatternSelect } from './index_pattern_select'; -import { UnifiedSearchPluginSetup, UnifiedSearchPublicPluginStart } from './types'; -import type { UnifiedSearchStartDependencies, UnifiedSearchSetupDependencies } from './types'; +import type { + UnifiedSearchStartDependencies, + UnifiedSearchSetupDependencies, + UnifiedSearchPluginSetup, + UnifiedSearchPublicPluginStart, +} from './types'; import { createFilterAction } from './actions/apply_filter_action'; import { ACTION_GLOBAL_APPLY_FILTER } from './actions'; @@ -25,22 +30,30 @@ export class UnifiedSearchPublicPlugin implements Plugin { private readonly storage: IStorageWrapper; + private readonly autocomplete: AutocompleteService; private usageCollection: UsageCollectionSetup | undefined; constructor(initializerContext: PluginInitializerContext) { this.storage = new Storage(window.localStorage); + + this.autocomplete = new AutocompleteService(initializerContext); } public setup( - core: CoreSetup, - { uiActions, data }: UnifiedSearchSetupDependencies + core: CoreSetup, + { uiActions, data, usageCollection }: UnifiedSearchSetupDependencies ): UnifiedSearchPluginSetup { const { query } = data; uiActions.registerAction( createFilterAction(query.filterManager, query.timefilter.timefilter, core.theme) ); - return {}; + return { + autocomplete: this.autocomplete.setup(core, { + timefilter: query.timefilter, + usageCollection, + }), + }; } public start( @@ -50,6 +63,8 @@ export class UnifiedSearchPublicPlugin setTheme(core.theme); setOverlays(core.overlays); setIndexPatterns(dataViews); + const autocompleteStart = this.autocomplete.start(); + setAutocomplete(autocompleteStart); const SearchBar = createSearchBar({ core, @@ -68,8 +83,11 @@ export class UnifiedSearchPublicPlugin IndexPatternSelect: createIndexPatternSelect(dataViews), SearchBar, }, + autocomplete: autocompleteStart, }; } - public stop() {} + public stop() { + this.autocomplete.clearProviders(); + } } diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx index 373c8a55b9b6b..189f12765ad15 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx @@ -20,6 +20,9 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { I18nProvider } from '@kbn/i18n-react'; import { stubIndexPattern } from '@kbn/data-plugin/public/stubs'; import { UI_SETTINGS } from '@kbn/data-plugin/common'; +import { setAutocomplete } from '../services'; +import { unifiedSearchPluginMock } from '../mocks'; + const startMock = coreMock.createStart(); const mockTimeHistory = { @@ -112,6 +115,11 @@ describe('QueryBarTopRowTopRow', () => { jest.clearAllMocks(); }); + beforeEach(() => { + const autocompleteStart = unifiedSearchPluginMock.createStartContract(); + setAutocomplete(autocompleteStart.autocomplete); + }); + it('Should render query and time picker', () => { const { getByText, getByTestId } = render( wrapQueryBarTopRowInContext({ diff --git a/src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx b/src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx index 39d63a5c888cd..b4eed13da7f58 100644 --- a/src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx @@ -28,6 +28,9 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { stubIndexPattern } from '@kbn/data-plugin/public/stubs'; import { KibanaContextProvider, withKibana } from '@kbn/kibana-react-plugin/public'; +import { setAutocomplete } from '../services'; +import { unifiedSearchPluginMock } from '../mocks'; + jest.useFakeTimers(); const startMock = coreMock.createStart(); @@ -92,6 +95,11 @@ describe('QueryStringInput', () => { jest.clearAllMocks(); }); + beforeEach(() => { + const autocompleteStart = unifiedSearchPluginMock.createStartContract(); + setAutocomplete(autocompleteStart.autocomplete); + }); + it('Should render the given query', async () => { const { getByText } = render( wrapQueryStringInputInContext({ diff --git a/src/plugins/unified_search/public/query_string_input/query_string_input.tsx b/src/plugins/unified_search/public/query_string_input/query_string_input.tsx index f4b99b8e86fb2..a9f4127809ab7 100644 --- a/src/plugins/unified_search/public/query_string_input/query_string_input.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_string_input.tsx @@ -28,13 +28,7 @@ import { import { FormattedMessage } from '@kbn/i18n-react'; import { compact, debounce, isEqual, isFunction } from 'lodash'; import { Toast } from '@kbn/core/public'; -import { - IDataPluginServices, - Query, - QuerySuggestion, - QuerySuggestionTypes, - getQueryLog, -} from '@kbn/data-plugin/public'; +import { IDataPluginServices, Query, getQueryLog } from '@kbn/data-plugin/public'; import { DataView } from '@kbn/data-views-plugin/public'; import type { PersistedLog } from '@kbn/data-plugin/public'; import { getFieldSubtypeNested, KIBANA_USER_QUERY_LANGUAGE_KEY } from '@kbn/data-plugin/common'; @@ -47,7 +41,8 @@ import { QueryLanguageSwitcher } from './language_switcher'; import type { SuggestionsListSize } from '../typeahead/suggestions_component'; import { SuggestionsComponent } from '../typeahead'; import { onRaf } from '../utils'; -import { getTheme } from '../services'; +import { QuerySuggestion, QuerySuggestionTypes } from '../autocomplete'; +import { getTheme, getAutocomplete } from '../services'; export interface QueryStringInputProps { indexPatterns: Array; @@ -201,7 +196,7 @@ export default class QueryStringInputUI extends PureComponent { const queryString = this.getQueryString(); const recentSearchSuggestions = this.getRecentSearchSuggestions(queryString); - const hasQuerySuggestions = this.services.data.autocomplete.hasQuerySuggestions(language); + const hasQuerySuggestions = getAutocomplete().hasQuerySuggestions(language); if ( !hasQuerySuggestions || @@ -222,7 +217,7 @@ export default class QueryStringInputUI extends PureComponent { if (this.abortController) this.abortController.abort(); this.abortController = new AbortController(); const suggestions = - (await this.services.data.autocomplete.getQuerySuggestions({ + (await getAutocomplete().getQuerySuggestions({ language, indexPatterns, query: queryString, diff --git a/src/plugins/unified_search/public/services.ts b/src/plugins/unified_search/public/services.ts index 4f8937baf8fdf..f67801dd37730 100644 --- a/src/plugins/unified_search/public/services.ts +++ b/src/plugins/unified_search/public/services.ts @@ -9,6 +9,7 @@ import { ThemeServiceStart, OverlayStart } from '@kbn/core/public'; import { createGetterSetter } from '@kbn/kibana-utils-plugin/public'; import { DataViewsContract } from '@kbn/data-views-plugin/public'; +import { AutocompleteStart } from '.'; export const [getIndexPatterns, setIndexPatterns] = createGetterSetter('IndexPatterns'); @@ -16,3 +17,6 @@ export const [getIndexPatterns, setIndexPatterns] = export const [getTheme, setTheme] = createGetterSetter('Theme'); export const [getOverlays, setOverlays] = createGetterSetter('Overlays'); + +export const [getAutocomplete, setAutocomplete] = + createGetterSetter('Autocomplete'); diff --git a/src/plugins/unified_search/public/typeahead/suggestion_component.test.tsx b/src/plugins/unified_search/public/typeahead/suggestion_component.test.tsx index d32ce1db3bdf6..31c38ad94815a 100644 --- a/src/plugins/unified_search/public/typeahead/suggestion_component.test.tsx +++ b/src/plugins/unified_search/public/typeahead/suggestion_component.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; -import { QuerySuggestion, QuerySuggestionTypes } from '@kbn/data-plugin/public'; +import { QuerySuggestion, QuerySuggestionTypes } from '../autocomplete'; import { SuggestionComponent } from './suggestion_component'; const noop = () => { diff --git a/src/plugins/unified_search/public/typeahead/suggestion_component.tsx b/src/plugins/unified_search/public/typeahead/suggestion_component.tsx index 9fd4f0ddb9652..b8b3f2640c31a 100644 --- a/src/plugins/unified_search/public/typeahead/suggestion_component.tsx +++ b/src/plugins/unified_search/public/typeahead/suggestion_component.tsx @@ -9,7 +9,7 @@ import { EuiIcon } from '@elastic/eui'; import classNames from 'classnames'; import React, { useCallback } from 'react'; -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '../autocomplete'; import { SuggestionOnClick, SuggestionOnMouseEnter } from './types'; function getEuiIconType(type: string) { diff --git a/src/plugins/unified_search/public/typeahead/suggestions_component.test.tsx b/src/plugins/unified_search/public/typeahead/suggestions_component.test.tsx index 7f1715ed2d706..6a21041f69530 100644 --- a/src/plugins/unified_search/public/typeahead/suggestions_component.test.tsx +++ b/src/plugins/unified_search/public/typeahead/suggestions_component.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; -import { QuerySuggestion, QuerySuggestionTypes } from '@kbn/data-plugin/public'; +import { QuerySuggestion, QuerySuggestionTypes } from '../autocomplete'; import { SuggestionComponent } from './suggestion_component'; import SuggestionsComponent from './suggestions_component'; diff --git a/src/plugins/unified_search/public/typeahead/suggestions_component.tsx b/src/plugins/unified_search/public/typeahead/suggestions_component.tsx index e9d5d51050f9d..75e446cf2d6e8 100644 --- a/src/plugins/unified_search/public/typeahead/suggestions_component.tsx +++ b/src/plugins/unified_search/public/typeahead/suggestions_component.tsx @@ -13,7 +13,7 @@ import classNames from 'classnames'; import styled from 'styled-components'; import useRafState from 'react-use/lib/useRafState'; -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '../autocomplete'; import { SuggestionComponent } from './suggestion_component'; import { SUGGESTIONS_LIST_REQUIRED_BOTTOM_SPACE, diff --git a/src/plugins/unified_search/public/typeahead/types.ts b/src/plugins/unified_search/public/typeahead/types.ts index 0da396ae56d73..1a58c29d028e1 100644 --- a/src/plugins/unified_search/public/typeahead/types.ts +++ b/src/plugins/unified_search/public/typeahead/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '../autocomplete'; export type SuggestionOnClick = (suggestion: QuerySuggestion, index: number) => void; diff --git a/src/plugins/unified_search/public/types.ts b/src/plugins/unified_search/public/types.ts index e113fd32f54ed..29cf59f41a871 100755 --- a/src/plugins/unified_search/public/types.ts +++ b/src/plugins/unified_search/public/types.ts @@ -5,19 +5,24 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ + import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public'; -import { IndexPatternSelectProps, StatefulSearchBarProps } from '.'; +import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; +import { AutocompleteSetup, AutocompleteStart } from './autocomplete'; +import type { IndexPatternSelectProps, StatefulSearchBarProps } from '.'; export interface UnifiedSearchSetupDependencies { uiActions: UiActionsSetup; data: DataPublicPluginStart; + usageCollection?: UsageCollectionSetup; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface UnifiedSearchPluginSetup {} +export interface UnifiedSearchPluginSetup { + autocomplete: AutocompleteSetup; +} export interface UnifiedSearchStartDependencies { dataViews: DataViewsPublicPluginStart; @@ -38,6 +43,11 @@ export interface UnifiedSearchPublicPluginStartUi { * Unified search plugin public Start contract */ export interface UnifiedSearchPublicPluginStart { + /** + * autocomplete service + * {@link AutocompleteStart} + */ + autocomplete: AutocompleteStart; /** * prewired UI components * {@link DataPublicPluginStartUi} diff --git a/src/plugins/data/server/autocomplete/autocomplete_service.ts b/src/plugins/unified_search/server/autocomplete/autocomplete_service.ts similarity index 100% rename from src/plugins/data/server/autocomplete/autocomplete_service.ts rename to src/plugins/unified_search/server/autocomplete/autocomplete_service.ts diff --git a/src/plugins/data/server/autocomplete/index.ts b/src/plugins/unified_search/server/autocomplete/index.ts similarity index 100% rename from src/plugins/data/server/autocomplete/index.ts rename to src/plugins/unified_search/server/autocomplete/index.ts diff --git a/src/plugins/data/server/autocomplete/routes.ts b/src/plugins/unified_search/server/autocomplete/routes.ts similarity index 100% rename from src/plugins/data/server/autocomplete/routes.ts rename to src/plugins/unified_search/server/autocomplete/routes.ts diff --git a/src/plugins/data/server/autocomplete/terms_agg.test.ts b/src/plugins/unified_search/server/autocomplete/terms_agg.test.ts similarity index 100% rename from src/plugins/data/server/autocomplete/terms_agg.test.ts rename to src/plugins/unified_search/server/autocomplete/terms_agg.test.ts diff --git a/src/plugins/data/server/autocomplete/terms_agg.ts b/src/plugins/unified_search/server/autocomplete/terms_agg.ts similarity index 97% rename from src/plugins/data/server/autocomplete/terms_agg.ts rename to src/plugins/unified_search/server/autocomplete/terms_agg.ts index 7e48bc6ee21c3..ffdaca8caad4b 100644 --- a/src/plugins/data/server/autocomplete/terms_agg.ts +++ b/src/plugins/unified_search/server/autocomplete/terms_agg.ts @@ -9,8 +9,8 @@ import { get, map } from 'lodash'; import { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/server'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IFieldType, getFieldSubtypeNested } from '@kbn/data-plugin/common'; import { ConfigSchema } from '../../config'; -import { IFieldType, getFieldSubtypeNested } from '../../common'; import { findIndexPatternById, getFieldByName } from '../data_views'; export async function termsAggSuggestions( diff --git a/src/plugins/data/server/autocomplete/terms_enum.test.ts b/src/plugins/unified_search/server/autocomplete/terms_enum.test.ts similarity index 100% rename from src/plugins/data/server/autocomplete/terms_enum.test.ts rename to src/plugins/unified_search/server/autocomplete/terms_enum.test.ts diff --git a/src/plugins/data/server/autocomplete/terms_enum.ts b/src/plugins/unified_search/server/autocomplete/terms_enum.ts similarity index 95% rename from src/plugins/data/server/autocomplete/terms_enum.ts rename to src/plugins/unified_search/server/autocomplete/terms_enum.ts index 77e8887f3fcb5..924b5b3a1671e 100644 --- a/src/plugins/data/server/autocomplete/terms_enum.ts +++ b/src/plugins/unified_search/server/autocomplete/terms_enum.ts @@ -8,7 +8,7 @@ import { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/server'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { FieldSpec } from '../../common'; +import { IFieldType } from '@kbn/data-plugin/common'; import { findIndexPatternById, getFieldByName } from '../data_views'; import { ConfigSchema } from '../../config'; @@ -20,7 +20,7 @@ export async function termsEnumSuggestions( fieldName: string, query: string, filters?: estypes.QueryDslQueryContainer[], - field?: FieldSpec, + field?: IFieldType, abortSignal?: AbortSignal ) { const { tiers } = config.autocomplete.valueSuggestions; diff --git a/src/plugins/data/server/autocomplete/value_suggestions_route.ts b/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts similarity index 97% rename from src/plugins/data/server/autocomplete/value_suggestions_route.ts rename to src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts index 9c6c037a86a82..013401ee6d0d7 100644 --- a/src/plugins/data/server/autocomplete/value_suggestions_route.ts +++ b/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts @@ -9,8 +9,8 @@ import { schema } from '@kbn/config-schema'; import { IRouter } from '@kbn/core/server'; import { firstValueFrom, Observable } from 'rxjs'; +import { getRequestAbortedSignal } from '@kbn/data-plugin/server'; import { getKbnServerError, reportServerError } from '@kbn/kibana-utils-plugin/server'; -import { getRequestAbortedSignal } from '../lib'; import type { ConfigSchema } from '../../config'; import { termsEnumSuggestions } from './terms_enum'; import { termsAggSuggestions } from './terms_agg'; diff --git a/src/plugins/unified_search/server/config_deprecations.test.ts b/src/plugins/unified_search/server/config_deprecations.test.ts new file mode 100644 index 0000000000000..8c65acfae6291 --- /dev/null +++ b/src/plugins/unified_search/server/config_deprecations.test.ts @@ -0,0 +1,137 @@ +/* + * 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 { cloneDeep } from 'lodash'; + +import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; +import { configDeprecationsMock } from '@kbn/core/server/mocks'; + +import { autocompleteConfigDeprecationProvider } from './config_deprecations'; + +const deprecationContext = configDeprecationsMock.createContext(); + +const applyConfigDeprecations = (settings: Record = {}) => { + const deprecations = autocompleteConfigDeprecationProvider(configDeprecationFactory); + const deprecationMessages: string[] = []; + const migrated = applyDeprecations( + settings, + deprecations.map((deprecation) => ({ + deprecation, + path: '', + context: deprecationContext, + })), + () => + ({ message }) => + deprecationMessages.push(message) + ); + return { + messages: deprecationMessages, + migrated: migrated.config, + }; +}; + +describe('Config Deprecations', () => { + it('does not report deprecations for default configurationc', () => { + const configFirstStep = { data: { autocomplete: { valueSuggestions: {} } } }; + const { messages, migrated } = applyConfigDeprecations(cloneDeep(configFirstStep)); + expect(migrated).toEqual(configFirstStep); + expect(messages).toHaveLength(0); + }); + + it('renames kibana.autocompleteTerminateAfter to unifiedSearch.autocomplete.valueSuggestions.terminateAfter', () => { + const config = { + kibana: { + autocompleteTerminateAfter: 123, + }, + }; + const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); + expect(migrated.kibana?.autocompleteTerminateAfter).not.toBeDefined(); + expect(migrated.unifiedSearch.autocomplete.valueSuggestions.terminateAfter).toEqual(123); + expect(messages).toMatchInlineSnapshot(` + Array [ + "Setting \\"kibana.autocompleteTerminateAfter\\" has been replaced by \\"unifiedSearch.autocomplete.valueSuggestions.terminateAfter\\"", + ] + `); + }); + + it('renames kibana.autocompleteTimeout to unifiedSearch.autocomplete.valueSuggestions.timeout', () => { + const config = { + kibana: { + autocompleteTimeout: 123, + }, + }; + const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); + expect(migrated.kibana?.autocompleteTimeout).not.toBeDefined(); + expect(migrated.unifiedSearch.autocomplete.valueSuggestions.timeout).toEqual(123); + expect(messages).toMatchInlineSnapshot(` + Array [ + "Setting \\"kibana.autocompleteTimeout\\" has been replaced by \\"unifiedSearch.autocomplete.valueSuggestions.timeout\\"", + ] + `); + }); + + it('renames data.autocomplete.querySuggestions.enabled to unifiedSearch.autocomplete.querySuggestions.enabled', () => { + const config = { + data: { + autocomplete: { + querySuggestions: { + enabled: false, + }, + }, + }, + }; + const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); + expect(migrated.data?.autocomplete.querySuggestions.enabled).not.toBeDefined(); + expect(migrated.unifiedSearch.autocomplete.querySuggestions.enabled).toEqual(false); + expect(messages).toMatchInlineSnapshot(` + Array [ + "Setting \\"data.autocomplete.querySuggestions.enabled\\" has been replaced by \\"unifiedSearch.autocomplete.querySuggestions.enabled\\"", + ] + `); + }); + + it('renames data.autocomplete.valueSuggestions.enabled to unifiedSearch.autocomplete.valueSuggestions.enabled', () => { + const config = { + data: { + autocomplete: { + valueSuggestions: { + enabled: false, + }, + }, + }, + }; + const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); + expect(migrated.data?.autocomplete.valueSuggestions.enabled).not.toBeDefined(); + expect(migrated.unifiedSearch.autocomplete.valueSuggestions.enabled).toEqual(false); + expect(messages).toMatchInlineSnapshot(` + Array [ + "Setting \\"data.autocomplete.valueSuggestions.enabled\\" has been replaced by \\"unifiedSearch.autocomplete.valueSuggestions.enabled\\"", + ] + `); + }); + + it('renames data.autocomplete.valueSuggestions.tiers to unifiedSearch.autocomplete.valueSuggestions.tiers', () => { + const config = { + data: { + autocomplete: { + valueSuggestions: { + tiers: [], + }, + }, + }, + }; + const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); + expect(migrated.data?.autocomplete.valueSuggestions.tiers).not.toBeDefined(); + expect(migrated.unifiedSearch.autocomplete.valueSuggestions.tiers).toEqual([]); + expect(messages).toMatchInlineSnapshot(` + Array [ + "Setting \\"data.autocomplete.valueSuggestions.tiers\\" has been replaced by \\"unifiedSearch.autocomplete.valueSuggestions.tiers\\"", + ] + `); + }); +}); diff --git a/src/plugins/unified_search/server/config_deprecations.ts b/src/plugins/unified_search/server/config_deprecations.ts new file mode 100644 index 0000000000000..de083caffad09 --- /dev/null +++ b/src/plugins/unified_search/server/config_deprecations.ts @@ -0,0 +1,59 @@ +/* + * 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 { ConfigDeprecationProvider } from '@kbn/core/server'; + +export const autocompleteConfigDeprecationProvider: ConfigDeprecationProvider = ({ + renameFromRoot, +}) => [ + renameFromRoot( + 'data.autocomplete.valueSuggestions.terminateAfter', + 'unifiedSearch.autocomplete.valueSuggestions.terminateAfter', + { level: 'warning' } + ), + renameFromRoot( + 'kibana.autocompleteTerminateAfter', + 'unifiedSearch.autocomplete.valueSuggestions.terminateAfter', + { level: 'warning' } + ), + renameFromRoot( + 'data.autocomplete.valueSuggestions.timeout', + 'unifiedSearch.autocomplete.valueSuggestions.timeout', + { + level: 'warning', + } + ), + renameFromRoot( + 'kibana.autocompleteTimeout', + 'unifiedSearch.autocomplete.valueSuggestions.timeout', + { + level: 'warning', + } + ), + renameFromRoot( + 'data.autocomplete.querySuggestions.enabled', + 'unifiedSearch.autocomplete.querySuggestions.enabled', + { + level: 'warning', + } + ), + renameFromRoot( + 'data.autocomplete.valueSuggestions.enabled', + 'unifiedSearch.autocomplete.valueSuggestions.enabled', + { + level: 'warning', + } + ), + renameFromRoot( + 'data.autocomplete.valueSuggestions.tiers', + 'unifiedSearch.autocomplete.valueSuggestions.tiers', + { + level: 'warning', + } + ), +]; diff --git a/src/plugins/unified_search/server/data_views/index.ts b/src/plugins/unified_search/server/data_views/index.ts new file mode 100644 index 0000000000000..dfe03378f0278 --- /dev/null +++ b/src/plugins/unified_search/server/data_views/index.ts @@ -0,0 +1,9 @@ +/* + * 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 * from '@kbn/data-views-plugin/server'; diff --git a/src/plugins/unified_search/server/index.ts b/src/plugins/unified_search/server/index.ts new file mode 100644 index 0000000000000..d1948f32e2fe9 --- /dev/null +++ b/src/plugins/unified_search/server/index.ts @@ -0,0 +1,40 @@ +/* + * 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 { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server'; +import { ConfigSchema, configSchema } from '../config'; +import { + UnifiedSearchServerPlugin, + UnifiedSearchServerPluginSetup, + UnifiedSearchServerPluginStart, +} from './plugin'; + +import { autocompleteConfigDeprecationProvider } from './config_deprecations'; + +/** + * Static code to be shared externally + * @public + */ + +export function plugin(initializerContext: PluginInitializerContext) { + return new UnifiedSearchServerPlugin(initializerContext); +} + +export type { + UnifiedSearchServerPluginSetup as PluginSetup, + UnifiedSearchServerPluginStart as PluginStart, +}; +export { UnifiedSearchServerPlugin as Plugin }; + +export const config: PluginConfigDescriptor = { + deprecations: autocompleteConfigDeprecationProvider, + exposeToBrowser: { + autocomplete: true, + }, + schema: configSchema, +}; diff --git a/src/plugins/unified_search/server/mocks.ts b/src/plugins/unified_search/server/mocks.ts new file mode 100644 index 0000000000000..7f63abcdaae0c --- /dev/null +++ b/src/plugins/unified_search/server/mocks.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 { AutocompleteSetup } from './autocomplete'; + +const autocompleteSetupMock: jest.Mocked = { + getAutocompleteSettings: jest.fn(), +}; + +function createSetupContract() { + return { + autocomplete: autocompleteSetupMock, + }; +} + +export const dataPluginMock = { + createSetupContract, +}; diff --git a/src/plugins/unified_search/server/plugin.ts b/src/plugins/unified_search/server/plugin.ts new file mode 100644 index 0000000000000..6328eeba2f416 --- /dev/null +++ b/src/plugins/unified_search/server/plugin.ts @@ -0,0 +1,50 @@ +/* + * 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 { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/server'; +import { ConfigSchema } from '../config'; +import { AutocompleteService } from './autocomplete'; +import { AutocompleteSetup } from './autocomplete/autocomplete_service'; + +export interface UnifiedSearchServerPluginSetup { + autocomplete: AutocompleteSetup; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface UnifiedSearchServerPluginStart {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface UnifiedSearchServerPluginSetupDependencies {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface UnifiedSearchServerPluginStartDependencies {} + +export class UnifiedSearchServerPlugin implements Plugin { + private readonly autocompleteService: AutocompleteService; + + constructor(initializerContext: PluginInitializerContext) { + this.autocompleteService = new AutocompleteService(initializerContext); + } + + public setup( + core: CoreSetup, + {}: UnifiedSearchServerPluginSetupDependencies + ) { + return { + autocomplete: this.autocompleteService.setup(core), + }; + } + + public start(core: CoreStart, {}: UnifiedSearchServerPluginStartDependencies) { + return {}; + } + + public stop() {} +} + +export { UnifiedSearchServerPlugin as Plugin }; diff --git a/src/plugins/unified_search/tsconfig.json b/src/plugins/unified_search/tsconfig.json index 3ff1ba630ac27..41dc76f1305be 100644 --- a/src/plugins/unified_search/tsconfig.json +++ b/src/plugins/unified_search/tsconfig.json @@ -9,7 +9,9 @@ "include": [ "public/**/*", "config.ts", - "public/**/*.json" + "public/**/*.json", + "server/**/*", + "config.ts", ], "references": [ { "path": "../../core/tsconfig.json" }, diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index c75724f294905..5f124adc92960 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -85,11 +85,11 @@ export default function ({ getService }: PluginFunctionalProviderContext) { // Ensure that your change does not unintentionally expose any sensitive values! 'console.ui.enabled (boolean)', 'dashboard.allowByValueEmbeddables (boolean)', - 'data.autocomplete.querySuggestions.enabled (boolean)', - 'data.autocomplete.valueSuggestions.enabled (boolean)', - 'data.autocomplete.valueSuggestions.terminateAfter (duration)', - 'data.autocomplete.valueSuggestions.tiers (array)', - 'data.autocomplete.valueSuggestions.timeout (duration)', + 'unifiedSearch.autocomplete.querySuggestions.enabled (boolean)', + 'unifiedSearch.autocomplete.valueSuggestions.enabled (boolean)', + 'unifiedSearch.autocomplete.valueSuggestions.terminateAfter (duration)', + 'unifiedSearch.autocomplete.valueSuggestions.tiers (array)', + 'unifiedSearch.autocomplete.valueSuggestions.timeout (duration)', 'data.search.aggs.shardDelay.enabled (boolean)', 'enterpriseSearch.host (string)', 'home.disableWelcomeScreen (boolean)', diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json index 3917fd601d75e..9bb1c52b52d7c 100644 --- a/x-pack/plugins/apm/kibana.json +++ b/x-pack/plugins/apm/kibana.json @@ -16,7 +16,8 @@ "licensing", "observability", "ruleRegistry", - "triggersActionsUi" + "triggersActionsUi", + "unifiedSearch" ], "optionalPlugins": [ "actions", diff --git a/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx b/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx index 93fee4bf06865..753d3b6460ea3 100644 --- a/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx @@ -10,8 +10,9 @@ import { i18n } from '@kbn/i18n'; import { uniqueId } from 'lodash'; import React, { useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; +import { QuerySuggestion } from '@kbn/unified-search-plugin/public'; import { DataView } from '@kbn/data-plugin/common'; -import { esKuery, QuerySuggestion } from '@kbn/data-plugin/public'; +import { esKuery } from '@kbn/data-plugin/public'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; @@ -55,7 +56,7 @@ export function KueryBar(props: { }); const { urlParams } = useLegacyUrlParams(); const location = useLocation(); - const { data } = useApmPluginContext().plugins; + const { unifiedSearch } = useApmPluginContext().plugins; let currentRequestCheck; @@ -103,7 +104,7 @@ export function KueryBar(props: { try { const suggestions = ( - (await data.autocomplete.getQuerySuggestions({ + (await unifiedSearch.autocomplete.getQuerySuggestions({ language: 'kuery', indexPatterns: [dataView], boolFilter: diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index 591b2322af0d5..627196a9a4bdc 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ + import { i18n } from '@kbn/i18n'; import { from } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -17,9 +18,10 @@ import { PluginInitializerContext, } from '@kbn/core/public'; import type { - DataPublicPluginSetup, DataPublicPluginStart, + DataPublicPluginSetup, } from '@kbn/data-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; import type { HomePublicPluginSetup } from '@kbn/home-plugin/public'; import { Start as InspectorPluginStart } from '@kbn/inspector-plugin/public'; @@ -63,6 +65,7 @@ export type ApmPluginStart = void; export interface ApmPluginSetupDeps { alerting?: AlertingPluginPublicSetup; data: DataPublicPluginSetup; + unifiedSearch: UnifiedSearchPublicPluginStart; features: FeaturesPluginSetup; home?: HomePublicPluginSetup; licensing: LicensingPluginSetup; diff --git a/x-pack/plugins/fleet/.storybook/context/stubs.tsx b/x-pack/plugins/fleet/.storybook/context/stubs.tsx index 0f4f81b58f95d..092ab680b819f 100644 --- a/x-pack/plugins/fleet/.storybook/context/stubs.tsx +++ b/x-pack/plugins/fleet/.storybook/context/stubs.tsx @@ -11,6 +11,7 @@ type Stubs = | 'licensing' | 'storage' | 'data' + | 'unifiedSearch' | 'deprecations' | 'fatalErrors' | 'navigation' @@ -23,6 +24,7 @@ export const stubbedStartServices: StubbedStartServices = { licensing: {} as FleetStartServices['licensing'], storage: {} as FleetStartServices['storage'], data: {} as FleetStartServices['data'], + unifiedSearch: {} as FleetStartServices['unifiedSearch'], deprecations: {} as FleetStartServices['deprecations'], fatalErrors: {} as FleetStartServices['fatalErrors'], navigation: {} as FleetStartServices['navigation'], diff --git a/x-pack/plugins/fleet/kibana.json b/x-pack/plugins/fleet/kibana.json index 66301f6b6fb9c..0a45b03803fc3 100644 --- a/x-pack/plugins/fleet/kibana.json +++ b/x-pack/plugins/fleet/kibana.json @@ -8,7 +8,7 @@ "server": true, "ui": true, "configPath": ["xpack", "fleet"], - "requiredPlugins": ["licensing", "data", "encryptedSavedObjects", "navigation", "customIntegrations", "share", "spaces", "security"], + "requiredPlugins": ["licensing", "data", "encryptedSavedObjects", "navigation", "customIntegrations", "share", "spaces", "security", "unifiedSearch"], "optionalPlugins": ["features", "cloud", "usageCollection", "home", "globalSearch", "telemetry"], "extraPublicDirs": ["common"], "requiredBundles": ["kibanaReact", "cloud", "esUiShared", "infra", "kibanaUtils", "usageCollection", "unifiedSearch"] diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/filter_dataset.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/filter_dataset.tsx index 865c360a47bd9..f49d4910ab9f9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/filter_dataset.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/filter_dataset.tsx @@ -17,7 +17,7 @@ export const DatasetFilter: React.FunctionComponent<{ selectedDatasets: string[]; onToggleDataset: (dataset: string) => void; }> = memo(({ selectedDatasets, onToggleDataset }) => { - const { data } = useStartServices(); + const { unifiedSearch } = useStartServices(); const [isOpen, setIsOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); const [datasetValues, setDatasetValues] = useState([AGENT_DATASET]); @@ -29,7 +29,7 @@ export const DatasetFilter: React.FunctionComponent<{ const fetchValues = async () => { setIsLoading(true); try { - const values = await data.autocomplete.getValueSuggestions({ + const values = await unifiedSearch.autocomplete.getValueSuggestions({ indexPattern: { title: AGENT_LOG_INDEX_PATTERN, fields: [DATASET_FIELD], @@ -44,7 +44,7 @@ export const DatasetFilter: React.FunctionComponent<{ setIsLoading(false); }; fetchValues(); - }, [data.autocomplete]); + }, [unifiedSearch.autocomplete]); return ( void; }> = memo(({ selectedLevels, onToggleLevel }) => { - const { data } = useStartServices(); + const { unifiedSearch } = useStartServices(); const [isOpen, setIsOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); const [levelValues, setLevelValues] = useState([]); @@ -40,7 +40,7 @@ export const LogLevelFilter: React.FunctionComponent<{ const fetchValues = async () => { setIsLoading(true); try { - const values: string[] = await data.autocomplete.getValueSuggestions({ + const values: string[] = await unifiedSearch.autocomplete.getValueSuggestions({ indexPattern: { title: AGENT_LOG_INDEX_PATTERN, fields: [LOG_LEVEL_FIELD], @@ -55,7 +55,7 @@ export const LogLevelFilter: React.FunctionComponent<{ setIsLoading(false); }; fetchValues(); - }, [data.autocomplete]); + }, [unifiedSearch.autocomplete]); const noLogsFound = (
diff --git a/x-pack/plugins/fleet/public/mock/plugin_dependencies.ts b/x-pack/plugins/fleet/public/mock/plugin_dependencies.ts index e86503e0216db..3f5ce4a53d1f8 100644 --- a/x-pack/plugins/fleet/public/mock/plugin_dependencies.ts +++ b/x-pack/plugins/fleet/public/mock/plugin_dependencies.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; import { cloudMock } from '@kbn/cloud-plugin/public/mocks'; @@ -27,6 +28,7 @@ export const createStartDepsMock = () => { return { licensing: licensingMock.createStart(), data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), navigation: navigationPluginMock.createStartContract(), customIntegrations: customIntegrationsMock.createStart(), share: sharePluginMock.createStartContract(), diff --git a/x-pack/plugins/fleet/public/plugin.ts b/x-pack/plugins/fleet/public/plugin.ts index b84562098fc76..c94f2ce139ab6 100644 --- a/x-pack/plugins/fleet/public/plugin.ts +++ b/x-pack/plugins/fleet/public/plugin.ts @@ -41,6 +41,8 @@ import type { LicensingPluginStart } from '@kbn/licensing-plugin/public'; import type { CloudSetup } from '@kbn/cloud-plugin/public'; import type { GlobalSearchPluginSetup } from '@kbn/global-search-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; + import { PLUGIN_ID, INTEGRATIONS_PLUGIN_ID, @@ -92,6 +94,7 @@ export interface FleetSetupDeps { export interface FleetStartDeps { licensing: LicensingPluginStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; navigation: NavigationPublicPluginStart; customIntegrations: CustomIntegrationsStart; share: SharePluginStart; diff --git a/x-pack/plugins/graph/public/components/search_bar.test.tsx b/x-pack/plugins/graph/public/components/search_bar.test.tsx index 3589c6c25b29a..cbb7896647712 100644 --- a/x-pack/plugins/graph/public/components/search_bar.test.tsx +++ b/x-pack/plugins/graph/public/components/search_bar.test.tsx @@ -59,6 +59,8 @@ function getServiceMocks() { query: { savedQueries: {}, }, + }, + unifiedSearch: { autocomplete: { hasQuerySuggestions: () => false, }, diff --git a/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx b/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx index 82f5516f0831e..d54b12511a05c 100644 --- a/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx +++ b/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx @@ -7,7 +7,7 @@ import { EuiFieldSearch, EuiOutsideClickDetector, EuiPanel } from '@elastic/eui'; import React from 'react'; -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '@kbn/unified-search-plugin/public'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { composeStateUpdaters } from '../../utils/typed_react'; import { SuggestionItem } from './suggestion_item'; diff --git a/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx b/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx index 47a5114f79173..a317ad3ecff5e 100644 --- a/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx +++ b/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx @@ -5,11 +5,11 @@ * 2.0. */ -import { EuiIcon } from '@elastic/eui'; -import { transparentize } from 'polished'; import React from 'react'; +import { EuiIcon } from '@elastic/eui'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; -import { QuerySuggestion, QuerySuggestionTypes } from '@kbn/data-plugin/public'; +import { QuerySuggestion, QuerySuggestionTypes } from '@kbn/unified-search-plugin/public'; +import { transparentize } from 'polished'; interface Props { isSelected?: boolean; diff --git a/x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx b/x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx index 5da13a4fed711..96410973f8c0e 100644 --- a/x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx +++ b/x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx @@ -7,16 +7,18 @@ import React from 'react'; import { DataViewBase } from '@kbn/es-query'; -import { QuerySuggestion, DataPublicPluginStart } from '@kbn/data-plugin/public'; import { withKibana, KibanaReactContextValue, KibanaServices, } from '@kbn/kibana-react-plugin/public'; +import { QuerySuggestion, UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { RendererFunction } from '../utils/typed_react'; interface WithKueryAutocompletionLifecycleProps { - kibana: KibanaReactContextValue<{ data: DataPublicPluginStart } & KibanaServices>; + kibana: KibanaReactContextValue< + { unifiedSearch: UnifiedSearchPublicPluginStart } & KibanaServices + >; children: RendererFunction<{ isLoadingSuggestions: boolean; loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void; @@ -63,7 +65,7 @@ class WithKueryAutocompletionComponent extends React.Component< const { indexPattern } = this.props; const language = 'kuery'; const hasQuerySuggestions = - this.props.kibana.services.data?.autocomplete.hasQuerySuggestions(language); + this.props.kibana.services.unifiedSearch?.autocomplete.hasQuerySuggestions(language); if (!hasQuerySuggestions) { return; @@ -78,7 +80,7 @@ class WithKueryAutocompletionComponent extends React.Component< }); const suggestions = - (await this.props.kibana.services.data.autocomplete.getQuerySuggestions({ + (await this.props.kibana.services.unifiedSearch.autocomplete.getQuerySuggestions({ language, query: expression, selectionStart: cursorPosition, diff --git a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/kuery_bar.tsx b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/kuery_bar.tsx index ff3cbdceefb3f..0e7d4e6d41e1b 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/kuery_bar.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/kuery_bar.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { fromKueryExpression } from '@kbn/es-query'; import React, { useEffect, useState } from 'react'; import { DataViewBase } from '@kbn/es-query'; -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '@kbn/unified-search-plugin/public'; import { WithKueryAutocompletion } from '../../../../containers/with_kuery_autocompletion'; import { AutocompleteField } from '../../../../components/autocomplete_field'; diff --git a/x-pack/plugins/lens/kibana.json b/x-pack/plugins/lens/kibana.json index 237a25ce78a9a..8ed33fb304525 100644 --- a/x-pack/plugins/lens/kibana.json +++ b/x-pack/plugins/lens/kibana.json @@ -22,7 +22,8 @@ "dataViewFieldEditor", "expressionGauge", "expressionHeatmap", - "eventAnnotation" + "eventAnnotation", + "unifiedSearch" ], "optionalPlugins": [ "expressionXY", diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx index a9e37e2d53d70..2c03ad902ce81 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx @@ -93,6 +93,7 @@ export function DimensionEditor(props: DimensionEditorProps) { savedObjectsClient: props.savedObjectsClient, http: props.http, storage: props.storage, + unifiedSearch: props.unifiedSearch, }; const { fieldByOperation, operationWithoutField } = operationSupportMatrix; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx index f4d27a16f19f0..3ab3633725678 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx @@ -16,6 +16,7 @@ import { EuiSelect, EuiButtonIcon, } from '@elastic/eui'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { IndexPatternDimensionEditorComponent, @@ -208,6 +209,7 @@ describe('IndexPatternDimensionEditorPanel', () => { uiSettings: {} as IUiSettingsClient, savedObjectsClient: {} as SavedObjectsClientContract, http: {} as HttpSetup, + unifiedSearch: unifiedSearchPluginMock.createStartContract(), data: { fieldFormats: { getType: jest.fn().mockReturnValue({ diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx index cdccdb65e70db..4f20db3004e8b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx @@ -9,6 +9,7 @@ import React, { memo, useMemo } from 'react'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { DatasourceDimensionTriggerProps, DatasourceDimensionEditorProps } from '../../types'; import { GenericIndexPatternColumn } from '../indexpattern'; import { isColumnInvalid } from '../utils'; @@ -31,6 +32,7 @@ export type IndexPatternDimensionEditorProps = layerId: string; http: HttpSetup; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; uniqueLabel: string; dateRange: DateRange; }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/droppable.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/droppable.test.ts index c5da32f3a7baa..412f8211844b2 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/droppable.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/droppable.test.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { IndexPatternDimensionEditorProps } from '../dimension_panel'; import { onDrop } from './on_drop_handler'; @@ -322,6 +323,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }), } as unknown as DataPublicPluginStart['fieldFormats'], } as unknown as DataPublicPluginStart, + unifiedSearch: {} as UnifiedSearchPublicPluginStart, core: {} as CoreSetup, dimensionGroups: [], isFullscreen: false, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx index 1cfea4b6c32e0..804cbde3d170f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx @@ -10,6 +10,7 @@ import { ReactWrapper, ShallowWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { EuiComboBox } from '@elastic/eui'; import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; @@ -54,6 +55,7 @@ describe('reference editor', () => { savedObjectsClient: {} as SavedObjectsClientContract, http: {} as HttpSetup, data: {} as DataPublicPluginStart, + unifiedSearch: {} as UnifiedSearchPublicPluginStart, dimensionGroups: [], isFullscreen: false, toggleFullscreen: jest.fn(), diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.tsx index 4e373859d6258..3c16d271401ad 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.tsx @@ -15,6 +15,7 @@ import { EuiComboBox, EuiComboBoxOptionOption, } from '@elastic/eui'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; @@ -65,6 +66,7 @@ export interface ReferenceEditorProps { savedObjectsClient: SavedObjectsClientContract; http: HttpSetup; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; paramEditorCustomProps?: ParamEditorCustomProps; } diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/index.ts index d5ac84568ff1d..41f2a4df9bcda 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/index.ts @@ -7,11 +7,12 @@ import type { CoreSetup } from '@kbn/core/public'; import { createStartServicesGetter, Storage } from '@kbn/kibana-utils-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { ExpressionsSetup } from '@kbn/expressions-plugin/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import type { IndexPatternFieldEditorStart } from '@kbn/data-view-field-editor-plugin/public'; import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; -import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { FieldFormatsStart, FieldFormatsSetup } from '@kbn/field-formats-plugin/public'; import type { EditorFrameSetup } from '../types'; @@ -28,6 +29,7 @@ export interface IndexPatternDatasourceSetupPlugins { export interface IndexPatternDatasourceStartPlugins { data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; fieldFormats: FieldFormatsStart; dataViewFieldEditor: IndexPatternFieldEditorStart; dataViews: DataViewsPublicPluginStart; @@ -58,14 +60,17 @@ export class IndexPatternDatasource { fieldFormatsSetup.register([suffixFormatter]); } - const [coreStart, { dataViewFieldEditor, uiActions, data, fieldFormats, dataViews }] = - await core.getStartServices(); + const [ + coreStart, + { dataViewFieldEditor, uiActions, data, fieldFormats, dataViews, unifiedSearch }, + ] = await core.getStartServices(); return getIndexPatternDatasource({ core: coreStart, fieldFormats, storage: new Storage(localStorage), data, + unifiedSearch, dataViews, charts, dataViewFieldEditor, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts index 6ae1f0b6f7f4a..db10c420b90de 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts @@ -6,16 +6,22 @@ */ import React, { ReactElement } from 'react'; +import { SavedObjectReference } from '@kbn/core/public'; import { isFragment } from 'react-is'; -import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import { getIndexPatternDatasource, GenericIndexPatternColumn } from './indexpattern'; -import { DatasourcePublicAPI, Datasource, FramePublicAPI, OperationDescriptor } from '../types'; import { coreMock } from '@kbn/core/public/mocks'; +import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { IndexPatternPersistedState, IndexPatternPrivateState } from './types'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { Ast } from '@kbn/interpreter'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; +import { indexPatternFieldEditorPluginMock } from '@kbn/data-view-field-editor-plugin/public/mocks'; +import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; +import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; +import { TinymathAST } from '@kbn/tinymath'; +import { getIndexPatternDatasource, GenericIndexPatternColumn } from './indexpattern'; +import { DatasourcePublicAPI, Datasource, FramePublicAPI, OperationDescriptor } from '../types'; import { getFieldByNameFactory } from './pure_helpers'; import { operationDefinitionMap, @@ -29,11 +35,6 @@ import { FiltersIndexPatternColumn, } from './operations'; import { createMockedFullReference } from './operations/mocks'; -import { indexPatternFieldEditorPluginMock } from '@kbn/data-view-field-editor-plugin/public/mocks'; -import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; -import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; -import { TinymathAST } from '@kbn/tinymath'; -import { SavedObjectReference } from '@kbn/core/public'; import { cloneDeep } from 'lodash'; import { DatatableColumn } from '@kbn/expressions-plugin'; @@ -186,6 +187,7 @@ describe('IndexPattern Data Source', () => { beforeEach(() => { indexPatternDatasource = getIndexPatternDatasource({ + unifiedSearch: unifiedSearchPluginMock.createStartContract(), storage: {} as IStorageWrapper, core: coreMock.createStart(), data: dataPluginMock.createStartContract(), diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx index b5fc2d012c2ec..b72519c2191be 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx @@ -20,6 +20,7 @@ import { DataPublicPluginStart, ES_FIELD_TYPES } from '@kbn/data-plugin/public'; import { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; import { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import { UiActionsStart } from '@kbn/ui-actions-plugin/public'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { DatasourceDimensionEditorProps, DatasourceDimensionTriggerProps, @@ -115,6 +116,7 @@ export function getIndexPatternDatasource({ core, storage, data, + unifiedSearch, dataViews, fieldFormats, charts, @@ -124,6 +126,7 @@ export function getIndexPatternDatasource({ core: CoreStart; storage: IStorageWrapper; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; dataViews: DataViewsPublicPluginStart; fieldFormats: FieldFormatsStart; charts: ChartsPluginSetup; @@ -370,6 +373,7 @@ export function getIndexPatternDatasource({ savedObjectsClient={core.savedObjects.client} http={core.http} data={data} + unifiedSearch={unifiedSearch} uniqueLabel={columnLabelMap[props.columnId]} {...props} /> diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx index cc1303a2a4f62..d4491fbba00cf 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx @@ -10,6 +10,7 @@ import type { DateHistogramIndexPatternColumn } from './date_histogram'; import { dateHistogramOperation } from '.'; import { shallow } from 'enzyme'; import { EuiSwitch } from '@elastic/eui'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { UI_SETTINGS } from '@kbn/data-plugin/public'; @@ -19,6 +20,7 @@ import type { IndexPatternLayer, IndexPattern } from '../../types'; import { getFieldByNameFactory } from '../../pure_helpers'; const dataStart = dataPluginMock.createStartContract(); +const unifiedSearchStart = unifiedSearchPluginMock.createStartContract(); dataStart.search.aggs.calculateAutoTimeExpression = getCalculateAutoTimeExpression( (path: string) => { if (path === UI_SETTINGS.HISTOGRAM_MAX_BARS) { @@ -93,6 +95,7 @@ const defaultOptions = { toDate: 'now', }, data: dataStart, + unifiedSearch: unifiedSearchStart, http: {} as HttpSetup, indexPattern: indexPattern1, operationDefinitionMap: {}, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx index 0e35a7e96cd7d..7208965ec080c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { act } from 'react-dom/test-utils'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; @@ -25,6 +26,7 @@ const defaultProps = { savedObjectsClient: {} as SavedObjectsClientContract, dateRange: { fromDate: 'now-1d', toDate: 'now' }, data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), http: {} as HttpSetup, indexPattern: createMockedIndexPattern(), operationDefinitionMap: {}, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_editor.tsx index fe579e2e5a5f5..ecc46babcfe71 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_editor.tsx @@ -89,7 +89,7 @@ export function FormulaEditor({ columnId, indexPattern, operationDefinitionMap, - data, + unifiedSearch, toggleFullscreen, isFullscreen, setIsCloseable, @@ -416,7 +416,7 @@ export function FormulaEditor({ context, indexPattern, operationDefinitionMap: visibleOperationsMap, - data, + unifiedSearch, dateHistogramInterval: baseIntervalRef.current, }); } @@ -427,7 +427,7 @@ export function FormulaEditor({ context, indexPattern, operationDefinitionMap: visibleOperationsMap, - data, + unifiedSearch, dateHistogramInterval: baseIntervalRef.current, }); } @@ -444,7 +444,7 @@ export function FormulaEditor({ ), }; }, - [indexPattern, visibleOperationsMap, data, baseIntervalRef] + [indexPattern, visibleOperationsMap, unifiedSearch, baseIntervalRef] ); const provideSignatureHelp = useCallback( diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.test.ts index 92014b340e412..0039f486933b9 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.test.ts @@ -7,11 +7,11 @@ import { parse } from '@kbn/tinymath'; import { monaco } from '@kbn/monaco'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { createMockedIndexPattern } from '../../../../mocks'; import { GenericOperationDefinition } from '../..'; import type { IndexPatternField } from '../../../../types'; import type { OperationMetadata } from '../../../../../types'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { tinymathFunctions } from '../util'; import { getSignatureHelp, @@ -217,7 +217,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toHaveLength(4 + Object.keys(tinymathFunctions).length); ['sum', 'moving_average', 'cumulative_sum', 'last_value'].forEach((key) => { @@ -238,7 +238,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toHaveLength(2); ['sum', 'last_value'].forEach((key) => { @@ -256,7 +256,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toEqual(['window']); }); @@ -271,7 +271,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toEqual([]); }); @@ -286,7 +286,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toHaveLength(4 + Object.keys(tinymathFunctions).length); ['sum', 'moving_average', 'cumulative_sum', 'last_value'].forEach((key) => { @@ -307,7 +307,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toHaveLength(4 + Object.keys(tinymathFunctions).length); ['sum', 'moving_average', 'cumulative_sum', 'last_value'].forEach((key) => { @@ -328,7 +328,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toHaveLength(0); }); @@ -343,7 +343,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toEqual(['bytes', 'memory']); }); @@ -358,7 +358,7 @@ describe('math completion', () => { }, indexPattern: createMockedIndexPattern(), operationDefinitionMap, - data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), }); expect(results.list).toEqual(['bytes', 'memory']); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.ts index 33dc7a343be4d..a1b629be9c134 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.ts @@ -16,7 +16,10 @@ import { TinymathVariable, TinymathNamedArgument, } from '@kbn/tinymath'; -import type { DataPublicPluginStart, QuerySuggestion } from '@kbn/data-plugin/public'; +import type { + UnifiedSearchPublicPluginStart, + QuerySuggestion, +} from '@kbn/unified-search-plugin/public'; import { parseTimeShift } from '@kbn/data-plugin/common'; import { IndexPattern } from '../../../../types'; import { memoizedGetAvailableOperationsByMetadata } from '../../../operations'; @@ -117,7 +120,7 @@ export async function suggest({ context, indexPattern, operationDefinitionMap, - data, + unifiedSearch, dateHistogramInterval, }: { expression: string; @@ -125,7 +128,7 @@ export async function suggest({ context: monaco.languages.CompletionContext; indexPattern: IndexPattern; operationDefinitionMap: Record; - data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; dateHistogramInterval?: number; }): Promise { const text = @@ -145,7 +148,7 @@ export async function suggest({ if (tokenInfo?.parent && (context.triggerCharacter === '=' || isNamedArgument)) { return await getNamedArgumentSuggestions({ ast: tokenAst as TinymathNamedArgument, - data, + unifiedSearch, indexPattern, dateHistogramInterval, }); @@ -328,13 +331,13 @@ function getArgumentSuggestions( export async function getNamedArgumentSuggestions({ ast, - data, + unifiedSearch, indexPattern, dateHistogramInterval, }: { ast: TinymathNamedArgument; indexPattern: IndexPattern; - data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; dateHistogramInterval?: number; }) { if (ast.name === 'shift') { @@ -356,14 +359,14 @@ export async function getNamedArgumentSuggestions({ if (ast.name !== 'kql' && ast.name !== 'lucene') { return { list: [], type: SUGGESTION_TYPE.KQL }; } - if (!data.autocomplete.hasQuerySuggestions(ast.name === 'kql' ? 'kuery' : 'lucene')) { + if (!unifiedSearch.autocomplete.hasQuerySuggestions(ast.name === 'kql' ? 'kuery' : 'lucene')) { return { list: [], type: SUGGESTION_TYPE.KQL }; } const query = ast.value.split(MARKER)[0]; const position = ast.value.indexOf(MARKER) + 1; - const suggestions = await data.autocomplete.getQuerySuggestions({ + const suggestions = await unifiedSearch.autocomplete.getQuerySuggestions({ language: ast.name === 'kql' ? 'kuery' : 'lucene', query, selectionStart: position, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts index 9ac5d683b74ad..e62bab6bd808b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts @@ -14,6 +14,7 @@ import { import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { ExpressionAstFunction } from '@kbn/expressions-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { termsOperation } from './terms'; import { filtersOperation } from './filters'; import { cardinalityOperation } from './cardinality'; @@ -163,6 +164,7 @@ export interface ParamEditorProps { http: HttpSetup; dateRange: DateRange; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; activeData?: IndexPatternDimensionEditorProps['activeData']; operationDefinitionMap: Record; paramEditorCustomProps?: ParamEditorCustomProps; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx index 556c91d3fa46d..5e3f1f0043664 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; import { EuiComboBox, EuiFormRow } from '@elastic/eui'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; @@ -25,6 +26,7 @@ const defaultProps = { uiSettings: uiSettingsMock, savedObjectsClient: {} as SavedObjectsClientContract, dateRange: { fromDate: 'now-1d', toDate: 'now' }, + unifiedSearch: unifiedSearchPluginMock.createStartContract(), data: dataPluginMock.createStartContract(), http: {} as HttpSetup, indexPattern: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx index a900e4cc29ae7..831bb03c89abd 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx @@ -6,17 +6,18 @@ */ import React, { ChangeEvent } from 'react'; -import { shallow, mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; +import { EuiRange } from '@elastic/eui'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; +import { EuiFormRow } from '@elastic/eui'; +import { shallow, mount } from 'enzyme'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { percentileOperation } from '.'; import { IndexPattern, IndexPatternLayer } from '../../types'; import { PercentileIndexPatternColumn } from './percentile'; -import { EuiRange } from '@elastic/eui'; -import { act } from 'react-dom/test-utils'; -import { EuiFormRow } from '@elastic/eui'; import { TermsIndexPatternColumn } from './terms'; jest.mock('lodash', () => { @@ -36,6 +37,7 @@ const defaultProps = { savedObjectsClient: {} as SavedObjectsClientContract, dateRange: { fromDate: 'now-1d', toDate: 'now' }, data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), http: {} as HttpSetup, indexPattern: { ...createMockedIndexPattern(), diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx index 534fcdbaf2d02..5f882a3ec2112 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx @@ -11,8 +11,9 @@ import { act } from 'react-dom/test-utils'; import { EuiFieldNumber, EuiRange, EuiButtonEmpty, EuiLink, EuiText } from '@elastic/eui'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import type { IndexPatternLayer, IndexPattern } from '../../../types'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; +import type { IndexPatternLayer, IndexPattern } from '../../../types'; import { rangeOperation } from '..'; import { RangeIndexPatternColumn } from './ranges'; import { @@ -51,6 +52,7 @@ jest.mock('lodash', () => { }); const dataPluginMockValue = dataPluginMock.createStartContract(); +const unifiedSearchPluginMockValue = unifiedSearchPluginMock.createStartContract(); // need to overwrite the formatter field first dataPluginMockValue.fieldFormats.deserialize = jest.fn().mockImplementation(({ id, params }) => { return { @@ -84,6 +86,7 @@ const defaultOptions = { toDate: 'now', }, data: dataPluginMockValue, + unifiedSearch: unifiedSearchPluginMockValue, http: {} as HttpSetup, indexPattern: { id: '1', diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx index 546e25308346a..60a871efd85cf 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx @@ -6,16 +6,17 @@ */ import React from 'react'; -import { shallow, mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; +import { EuiFieldNumber } from '@elastic/eui'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; +import { shallow, mount } from 'enzyme'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { staticValueOperation } from '.'; import { IndexPattern, IndexPatternLayer } from '../../types'; import { StaticValueIndexPatternColumn } from './static_value'; -import { EuiFieldNumber } from '@elastic/eui'; -import { act } from 'react-dom/test-utils'; import { TermsIndexPatternColumn } from './terms'; jest.mock('lodash', () => { @@ -35,6 +36,7 @@ const defaultProps = { savedObjectsClient: {} as SavedObjectsClientContract, dateRange: { fromDate: 'now-1d', toDate: 'now' }, data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), http: {} as HttpSetup, indexPattern: { ...createMockedIndexPattern(), diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/terms.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/terms.test.tsx index e028d81ad4549..8cfeb1b68e5b9 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/terms.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/terms.test.tsx @@ -15,6 +15,7 @@ import type { HttpSetup, CoreStart, } from '@kbn/core/public'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { createMockedIndexPattern } from '../../../mocks'; @@ -58,6 +59,7 @@ const defaultProps = { savedObjectsClient: {} as SavedObjectsClientContract, dateRange: { fromDate: 'now-1d', toDate: 'now' }, data: dataPluginMock.createStartContract(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), http: {} as HttpSetup, indexPattern: createMockedIndexPattern(), // need to provide the terms operation as some helpers use operation specific features diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index f2d82e96b98cd..b39c14cd82454 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -13,11 +13,8 @@ import type { UsageCollectionStart, } from '@kbn/usage-collection-plugin/public'; import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { - CONTEXT_MENU_TRIGGER, - EmbeddableSetup, - EmbeddableStart, -} from '@kbn/embeddable-plugin/public'; +import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { DashboardStart } from '@kbn/dashboard-plugin/public'; import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; @@ -45,6 +42,7 @@ import { import { VISUALIZE_EDITOR_TRIGGER } from '@kbn/visualizations-plugin/public'; import { createStartServicesGetter } from '@kbn/kibana-utils-plugin/public'; import type { DiscoverSetup, DiscoverStart } from '@kbn/discover-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { EditorFrameService as EditorFrameServiceType } from './editor_frame_service'; import type { IndexPatternDatasource as IndexPatternDatasourceType, @@ -111,6 +109,7 @@ export interface LensPluginSetupDependencies { export interface LensPluginStartDependencies { data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; dataViews: DataViewsPublicPluginStart; fieldFormats: FieldFormatsStart; expressions: ExpressionsStart; diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/builder.stories.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/builder.stories.tsx index ff2efccee90a6..bb345f481112a 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/builder.stories.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/builder.stories.tsx @@ -8,7 +8,7 @@ import { Story, addDecorator } from '@storybook/react'; import React from 'react'; import { HttpStart } from '@kbn/core/public'; -import type { AutocompleteStart } from '@kbn/data-plugin/public'; +import type { AutocompleteStart } from '@kbn/unified-search-plugin/public'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { fields, getField } from '@kbn/data-plugin/common/mocks'; diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.stories.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.stories.tsx index 6388a9e5b7053..2fbc89e719eb1 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.stories.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.stories.tsx @@ -13,7 +13,7 @@ import { ListOperatorEnum as OperatorEnum, ListOperatorTypeEnum as OperatorTypeEnum, } from '@kbn/securitysolution-io-ts-list-types'; -import type { AutocompleteStart } from '@kbn/data-plugin/public'; +import type { AutocompleteStart } from '@kbn/unified-search-plugin/public'; import { fields } from '@kbn/data-plugin/common/mocks'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx index 4409bd0448ec8..d0d931387f0e4 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx @@ -5,10 +5,9 @@ * 2.0. */ -import { ReactWrapper, mount } from 'enzyme'; import React from 'react'; import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; -import { waitFor } from '@testing-library/dom'; +import { coreMock } from '@kbn/core/public/mocks'; import { doesNotExistOperator, existsOperator, @@ -24,8 +23,9 @@ import { validateFilePathInput } from '@kbn/securitysolution-utils'; import { useFindLists } from '@kbn/securitysolution-list-hooks'; import type { FieldSpec } from '@kbn/data-plugin/common'; import { fields, getField } from '@kbn/data-plugin/common/mocks'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { coreMock } from '@kbn/core/public/mocks'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; +import { waitFor } from '@testing-library/dom'; +import { ReactWrapper, mount } from 'enzyme'; import { getFoundListSchemaMock } from '../../../../common/schemas/response/found_list_schema.mock'; @@ -35,7 +35,7 @@ jest.mock('@kbn/securitysolution-list-hooks'); jest.mock('@kbn/securitysolution-utils'); const mockKibanaHttpService = coreMock.createStart().http; -const { autocomplete: autocompleteStartMock } = dataPluginMock.createStartContract(); +const { autocomplete: autocompleteStartMock } = unifiedSearchPluginMock.createStartContract(); describe('BuilderEntryItem', () => { let wrapper: ReactWrapper; diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx index 3b65042866c55..a28686595053b 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx @@ -44,7 +44,7 @@ import { validateFilePathInput, } from '@kbn/securitysolution-utils'; import { DataViewBase, DataViewFieldBase } from '@kbn/es-query'; -import type { AutocompleteStart } from '@kbn/data-plugin/public'; +import type { AutocompleteStart } from '@kbn/unified-search-plugin/public'; import { HttpStart } from '@kbn/core/public'; import { getEmptyValue } from '../../../common/empty_value'; diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.test.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.test.tsx index 65c1e38215984..4041c8516ee27 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.test.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { fields } from '@kbn/data-plugin/common/mocks'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { coreMock } from '@kbn/core/public/mocks'; @@ -19,7 +19,7 @@ import { getEntryMatchAnyMock } from '../../../../common/schemas/types/entry_mat import { BuilderExceptionListItemComponent } from './exception_item_renderer'; const mockKibanaHttpService = coreMock.createStart().http; -const { autocomplete: autocompleteStartMock } = dataPluginMock.createStartContract(); +const { autocomplete: autocompleteStartMock } = unifiedSearchPluginMock.createStartContract(); describe('BuilderExceptionListItemComponent', () => { const getValueSuggestionsMock = jest.fn().mockResolvedValue(['value 1', 'value 2']); diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.tsx index a8b6850239757..d55289d016883 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/exception_item_renderer.tsx @@ -8,8 +8,8 @@ import React, { useCallback, useMemo } from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import styled from 'styled-components'; +import type { AutocompleteStart } from '@kbn/unified-search-plugin/public'; import { HttpStart } from '@kbn/core/public'; -import type { AutocompleteStart } from '@kbn/data-plugin/public'; import { ExceptionListType, OsTypeArray } from '@kbn/securitysolution-io-ts-list-types'; import { BuilderEntry, diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.test.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.test.tsx index 5e86979432f60..e30c5e5cd5519 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.test.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { ReactWrapper, mount } from 'enzyme'; import { waitFor } from '@testing-library/react'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { coreMock } from '@kbn/core/public/mocks'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { fields, getField } from '@kbn/data-plugin/common/mocks'; @@ -20,7 +20,7 @@ import { getEmptyValue } from '../../../common/empty_value'; import { ExceptionBuilderComponent } from './exception_items_renderer'; const mockKibanaHttpService = coreMock.createStart().http; -const { autocomplete: autocompleteStartMock } = dataPluginMock.createStartContract(); +const { autocomplete: autocompleteStartMock } = unifiedSearchPluginMock.createStartContract(); describe('ExceptionBuilderComponent', () => { let wrapper: ReactWrapper; diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx index 8a04ebed888dd..69467d7ecea8b 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx @@ -32,7 +32,7 @@ import { getNewExceptionItem, } from '@kbn/securitysolution-list-utils'; import { DataViewBase } from '@kbn/es-query'; -import type { AutocompleteStart } from '@kbn/data-plugin/public'; +import type { AutocompleteStart } from '@kbn/unified-search-plugin/public'; import { AndOrBadge } from '../and_or_badge'; diff --git a/x-pack/plugins/lists/tsconfig.json b/x-pack/plugins/lists/tsconfig.json index 691c5243d9db8..6cfffbbaa7421 100644 --- a/x-pack/plugins/lists/tsconfig.json +++ b/x-pack/plugins/lists/tsconfig.json @@ -18,5 +18,6 @@ { "path": "../../../src/core/tsconfig.json" }, { "path": "../spaces/tsconfig.json" }, { "path": "../security/tsconfig.json"}, + { "path": "../../../src/plugins/unified_search/tsconfig.json" } ] } diff --git a/x-pack/plugins/maps/public/kibana_services.ts b/x-pack/plugins/maps/public/kibana_services.ts index ebebf4b3ba7fc..22857c623c18a 100644 --- a/x-pack/plugins/maps/public/kibana_services.ts +++ b/x-pack/plugins/maps/public/kibana_services.ts @@ -32,7 +32,7 @@ export const getIsCloud = () => isCloudEnabled; export const getIndexNameFormComponent = () => pluginsStart.fileUpload.IndexNameFormComponent; export const getFileUploadComponent = () => pluginsStart.fileUpload.FileUploadComponent; export const getIndexPatternService = () => pluginsStart.data.indexPatterns; -export const getAutocompleteService = () => pluginsStart.data.autocomplete; +export const getAutocompleteService = () => pluginsStart.unifiedSearch.autocomplete; export const getInspector = () => pluginsStart.inspector; export const getFileUpload = () => pluginsStart.fileUpload; export const getUiSettings = () => coreStart.uiSettings; diff --git a/x-pack/plugins/ml/kibana.json b/x-pack/plugins/ml/kibana.json index 4218eea4ca72f..eb00ca117f01a 100644 --- a/x-pack/plugins/ml/kibana.json +++ b/x-pack/plugins/ml/kibana.json @@ -19,7 +19,8 @@ "share", "taskManager", "triggersActionsUi", - "uiActions" + "uiActions", + "unifiedSearch" ], "optionalPlugins": [ "alerting", diff --git a/x-pack/plugins/ml/public/application/app.tsx b/x-pack/plugins/ml/public/application/app.tsx index c4ec667e43592..833a4fade128b 100644 --- a/x-pack/plugins/ml/public/application/app.tsx +++ b/x-pack/plugins/ml/public/application/app.tsx @@ -119,7 +119,7 @@ export const renderApp = ( setDependencyCache({ timefilter: deps.data.query.timefilter, fieldFormats: deps.fieldFormats, - autocomplete: deps.data.autocomplete, + autocomplete: deps.unifiedSearch.autocomplete, config: coreStart.uiSettings!, chrome: coreStart.chrome!, docLinks: coreStart.docLinks!, diff --git a/x-pack/plugins/ml/public/application/util/dependency_cache.ts b/x-pack/plugins/ml/public/application/util/dependency_cache.ts index e2269524fe6e5..3680f8b63b0c9 100644 --- a/x-pack/plugins/ml/public/application/util/dependency_cache.ts +++ b/x-pack/plugins/ml/public/application/util/dependency_cache.ts @@ -20,7 +20,7 @@ import type { ChromeRecentlyAccessed, IBasePath, } from '@kbn/core/public'; -import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { DashboardStart } from '@kbn/dashboard-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import type { DataViewsContract } from '@kbn/data-views-plugin/public'; @@ -38,7 +38,7 @@ export interface DependencyCache { theme: ThemeServiceStart | null; recentlyAccessed: ChromeRecentlyAccessed | null; fieldFormats: FieldFormatsStart | null; - autocomplete: DataPublicPluginStart['autocomplete'] | null; + autocomplete: UnifiedSearchPublicPluginStart['autocomplete'] | null; basePath: IBasePath | null; savedObjectsClient: SavedObjectsClientContract | null; application: ApplicationStart | null; diff --git a/x-pack/plugins/ml/public/plugin.ts b/x-pack/plugins/ml/public/plugin.ts index b45ee5f5d3956..1ef7c73d2189a 100644 --- a/x-pack/plugins/ml/public/plugin.ts +++ b/x-pack/plugins/ml/public/plugin.ts @@ -16,6 +16,7 @@ import type { import { BehaviorSubject } from 'rxjs'; import { take } from 'rxjs/operators'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { ManagementSetup } from '@kbn/management-plugin/public'; import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; @@ -50,6 +51,7 @@ import { PLUGIN_ICON_SOLUTION, PLUGIN_ID } from '../common/constants/app'; export interface MlStartDependencies { data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; share: SharePluginStart; uiActions: UiActionsStart; spaces?: SpacesPluginStart; @@ -109,6 +111,7 @@ export class MlPlugin implements Plugin { { charts: pluginsStart.charts, data: pluginsStart.data, + unifiedSearch: pluginsStart.unifiedSearch, dashboard: pluginsStart.dashboard, share: pluginsStart.share, security: pluginsSetup.security, diff --git a/x-pack/plugins/monitoring/kibana.json b/x-pack/plugins/monitoring/kibana.json index 808d052546bf1..bbb6eb374e91d 100644 --- a/x-pack/plugins/monitoring/kibana.json +++ b/x-pack/plugins/monitoring/kibana.json @@ -7,7 +7,7 @@ "githubTeam": "stack-monitoring-ui" }, "configPath": ["monitoring"], - "requiredPlugins": ["licensing", "features", "data", "navigation", "observability", "dataViews"], + "requiredPlugins": ["licensing", "features", "data", "navigation", "observability", "dataViews", "unifiedSearch"], "optionalPlugins": [ "infra", "usageCollection", diff --git a/x-pack/plugins/monitoring/public/components/kuery_bar/autocomplete_field.tsx b/x-pack/plugins/monitoring/public/components/kuery_bar/autocomplete_field.tsx index f241bdb798f88..ae7129f561148 100644 --- a/x-pack/plugins/monitoring/public/components/kuery_bar/autocomplete_field.tsx +++ b/x-pack/plugins/monitoring/public/components/kuery_bar/autocomplete_field.tsx @@ -7,7 +7,7 @@ import { EuiFieldSearch, EuiOutsideClickDetector, EuiPanel } from '@elastic/eui'; import React from 'react'; -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '@kbn/unified-search-plugin/public'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { composeStateUpdaters } from '../../lib/typed_react'; import { SuggestionItem } from './suggestion_item'; diff --git a/x-pack/plugins/monitoring/public/components/kuery_bar/index.tsx b/x-pack/plugins/monitoring/public/components/kuery_bar/index.tsx index 9e5588c94a954..6810f2b2b73b9 100644 --- a/x-pack/plugins/monitoring/public/components/kuery_bar/index.tsx +++ b/x-pack/plugins/monitoring/public/components/kuery_bar/index.tsx @@ -9,7 +9,7 @@ import { fromKueryExpression } from '@kbn/es-query'; import { i18n } from '@kbn/i18n'; import React, { useEffect, useState } from 'react'; import type { DataView } from '@kbn/data-views-plugin/public'; -import { QuerySuggestion } from '@kbn/data-plugin/public'; +import { QuerySuggestion } from '@kbn/unified-search-plugin/public'; import { AutocompleteField } from './autocomplete_field'; import { WithKueryAutocompletion } from './with_kuery_autocompletion'; diff --git a/x-pack/plugins/monitoring/public/components/kuery_bar/suggestion_item.tsx b/x-pack/plugins/monitoring/public/components/kuery_bar/suggestion_item.tsx index 47a5114f79173..687ba1ebc5e63 100644 --- a/x-pack/plugins/monitoring/public/components/kuery_bar/suggestion_item.tsx +++ b/x-pack/plugins/monitoring/public/components/kuery_bar/suggestion_item.tsx @@ -8,8 +8,8 @@ import { EuiIcon } from '@elastic/eui'; import { transparentize } from 'polished'; import React from 'react'; +import { QuerySuggestion, QuerySuggestionTypes } from '@kbn/unified-search-plugin/public'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; -import { QuerySuggestion, QuerySuggestionTypes } from '@kbn/data-plugin/public'; interface Props { isSelected?: boolean; diff --git a/x-pack/plugins/monitoring/public/components/kuery_bar/with_kuery_autocompletion.tsx b/x-pack/plugins/monitoring/public/components/kuery_bar/with_kuery_autocompletion.tsx index 6284b5b60e0e2..bef933d1431a0 100644 --- a/x-pack/plugins/monitoring/public/components/kuery_bar/with_kuery_autocompletion.tsx +++ b/x-pack/plugins/monitoring/public/components/kuery_bar/with_kuery_autocompletion.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import { QuerySuggestion, DataPublicPluginStart } from '@kbn/data-plugin/public'; import { DataView } from '@kbn/data-views-plugin/public'; +import { UnifiedSearchPublicPluginStart, QuerySuggestion } from '@kbn/unified-search-plugin/public'; import { withKibana, KibanaReactContextValue, @@ -16,7 +16,9 @@ import { import { RendererFunction } from '../../lib/typed_react'; interface WithKueryAutocompletionLifecycleProps { - kibana: KibanaReactContextValue<{ data: DataPublicPluginStart } & KibanaServices>; + kibana: KibanaReactContextValue< + { unifiedSearch: UnifiedSearchPublicPluginStart } & KibanaServices + >; children: RendererFunction<{ isLoadingSuggestions: boolean; loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void; @@ -63,7 +65,7 @@ class WithKueryAutocompletionComponent extends React.Component< const { indexPattern } = this.props; const language = 'kuery'; const hasQuerySuggestions = - this.props.kibana.services.data?.autocomplete.hasQuerySuggestions(language); + this.props.kibana.services.unifiedSearch?.autocomplete.hasQuerySuggestions(language); if (!hasQuerySuggestions) { return; @@ -78,7 +80,7 @@ class WithKueryAutocompletionComponent extends React.Component< }); const suggestions = - (await this.props.kibana.services.data.autocomplete.getQuerySuggestions({ + (await this.props.kibana.services.unifiedSearch.autocomplete.getQuerySuggestions({ language, query: expression, selectionStart: cursorPosition, diff --git a/x-pack/plugins/security_solution/kibana.json b/x-pack/plugins/security_solution/kibana.json index faece05732b7e..af0bd12303119 100644 --- a/x-pack/plugins/security_solution/kibana.json +++ b/x-pack/plugins/security_solution/kibana.json @@ -54,6 +54,7 @@ "kibanaReact", "usageCollection", "lists", - "ml" + "ml", + "unifiedSearch" ] } diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_flyout/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_flyout/index.tsx index ebe77ccfce554..0e063a05bab0c 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_flyout/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_flyout/index.tsx @@ -135,7 +135,7 @@ export const AddExceptionFlyout = memo(function AddExceptionFlyout({ onRuleChange, alertStatus, }: AddExceptionFlyoutProps) { - const { http, data } = useKibana().services; + const { http, unifiedSearch } = useKibana().services; const [errorsExist, setErrorExists] = useState(false); const [comment, setComment] = useState(''); const { rule: maybeRule, loading: isRuleLoading } = useRuleAsync(ruleId); @@ -505,7 +505,7 @@ export const AddExceptionFlyout = memo(function AddExceptionFlyout({ allowLargeValueLists: !isEqlRule(maybeRule?.type) && !isThresholdRule(maybeRule?.type), httpService: http, - autocompleteService: data.autocomplete, + autocompleteService: unifiedSearch.autocomplete, exceptionListItems: initialExceptionItems, listType: exceptionListType, osTypes: osTypesSelection, diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_flyout/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_flyout/index.tsx index cfa8b08b901d5..0097f2d02cb3e 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_flyout/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_flyout/index.tsx @@ -112,7 +112,7 @@ export const EditExceptionFlyout = memo(function EditExceptionFlyout({ onConfirm, onRuleChange, }: EditExceptionFlyoutProps) { - const { http, data } = useKibana().services; + const { http, unifiedSearch } = useKibana().services; const [comment, setComment] = useState(''); const [errorsExist, setErrorExists] = useState(false); const { rule: maybeRule, loading: isRuleLoading } = useRuleAsync(ruleId); @@ -360,7 +360,7 @@ export const EditExceptionFlyout = memo(function EditExceptionFlyout({ allowLargeValueLists: !isEqlRule(maybeRule?.type) && !isThresholdRule(maybeRule?.type), httpService: http, - autocompleteService: data.autocomplete, + autocompleteService: unifiedSearch.autocomplete, exceptionListItems: [exceptionItem], listType: exceptionListType, listId: exceptionItem.list_id, diff --git a/x-pack/plugins/security_solution/public/common/components/query_bar/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/query_bar/index.test.tsx index f3f9d8dde9c57..2d38f72b338ee 100644 --- a/x-pack/plugins/security_solution/public/common/components/query_bar/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/query_bar/index.test.tsx @@ -14,6 +14,8 @@ import { TestProviders, mockIndexPattern } from '../../mock'; import { FilterManager } from '@kbn/data-plugin/public'; import { SearchBar } from '@kbn/unified-search-plugin/public'; import { QueryBar, QueryBarComponentProps } from '.'; +import { setAutocomplete } from '@kbn/unified-search-plugin/public/services'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; const mockUiSettingsForFilterManager = coreMock.createStart().uiSettings; @@ -267,6 +269,11 @@ describe('QueryBar ', () => { }); describe('#onSavedQueryUpdated', () => { + beforeEach(() => { + const autocompleteStart = unifiedSearchPluginMock.createStartContract(); + setAutocomplete(autocompleteStart.autocomplete); + }); + test('is only reference that changed when dataProviders props get updated', async () => { const wrapper = await getWrapper( { beforeEach(() => { (useKibana as jest.Mock).mockReturnValue({ services: { - data: { + unifiedSearch: { autocomplete: { getValueSuggestions: getValueSuggestionsMock, }, diff --git a/x-pack/plugins/security_solution/public/common/components/threat_match/list_item.test.tsx b/x-pack/plugins/security_solution/public/common/components/threat_match/list_item.test.tsx index b49bb1a7fb893..571207918c44c 100644 --- a/x-pack/plugins/security_solution/public/common/components/threat_match/list_item.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/threat_match/list_item.test.tsx @@ -56,7 +56,7 @@ describe('ListItemComponent', () => { beforeAll(() => { (useKibana as jest.Mock).mockReturnValue({ services: { - data: { + unifiedSearch: { autocomplete: { getValueSuggestions: getValueSuggestionsMock, }, diff --git a/x-pack/plugins/security_solution/public/common/lib/kibana/kibana_react.mock.ts b/x-pack/plugins/security_solution/public/common/lib/kibana/kibana_react.mock.ts index 4cab4e2722ee2..0097e31cfee8a 100644 --- a/x-pack/plugins/security_solution/public/common/lib/kibana/kibana_react.mock.ts +++ b/x-pack/plugins/security_solution/public/common/lib/kibana/kibana_react.mock.ts @@ -10,6 +10,7 @@ import React from 'react'; import { RecursivePartial } from '@elastic/eui/src/components/common'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { coreMock, themeServiceMock } from '@kbn/core/public/mocks'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; @@ -95,6 +96,7 @@ export const createStartServicesMock = ( const urlService = new MockUrlService(); const locator = urlService.locators.create(new MlLocatorDefinition()); const fleet = fleetMock.createStartMock(); + const unifiedSearch = unifiedSearchPluginMock.createStartContract(); return { ...core, @@ -105,6 +107,7 @@ export const createStartServicesMock = ( getCreateCase: jest.fn(), getRecentCases: jest.fn(), }, + unifiedSearch, data: { ...data, query: { diff --git a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx index 6fdbffe83efcb..2e533230e0a0f 100644 --- a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx @@ -46,7 +46,7 @@ export interface AppContextTestRender { store: Store; history: ReturnType; coreStart: ReturnType; - depsStart: Pick; + depsStart: Pick; startServices: StartServices; middlewareSpy: MiddlewareActionSpyHelper; /** diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx index 4ea2ece016680..bcb368ba288ac 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx @@ -256,7 +256,7 @@ export const SeverityField = ({ { services: { http: {}, data: {}, + unifiedSearch: {}, notifications: {}, }, }); diff --git a/x-pack/plugins/security_solution/public/management/pages/event_filters/view/components/form/index.tsx b/x-pack/plugins/security_solution/public/management/pages/event_filters/view/components/form/index.tsx index 0bd785a28eff0..11d1af0a5a2e9 100644 --- a/x-pack/plugins/security_solution/public/management/pages/event_filters/view/components/form/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/event_filters/view/components/form/index.tsx @@ -88,7 +88,7 @@ interface EventFiltersFormProps { } export const EventFiltersForm: React.FC = memo( ({ allowSelectOs = false, policies, arePoliciesLoading }) => { - const { http, data } = useKibana().services; + const { http, unifiedSearch } = useKibana().services; const dispatch = useDispatch>(); const exception = useEventFiltersSelector(getFormEntryStateMutable); @@ -225,7 +225,7 @@ export const EventFiltersForm: React.FC = memo( getExceptionBuilderComponentLazy({ allowLargeValueLists: false, httpService: http, - autocompleteService: data.autocomplete, + autocompleteService: unifiedSearch.autocomplete, exceptionListItems: [exception as ExceptionListItemSchema], listType: EVENT_FILTER_LIST_TYPE, listId: ENDPOINT_EVENT_FILTERS_LIST_ID, @@ -243,7 +243,7 @@ export const EventFiltersForm: React.FC = memo( operatorsList: EVENT_FILTERS_OPERATORS, osTypes: exception?.os_types, }), - [data, handleOnBuilderChange, http, indexPatterns, exception] + [unifiedSearch, handleOnBuilderChange, http, indexPatterns, exception] ); const nameInputMemo = useMemo( diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx index cae0dda0b4bc3..b301703f3cae2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx @@ -18,6 +18,8 @@ import { FilterStateStore } from '@kbn/es-query'; import { FilterManager } from '@kbn/data-plugin/public'; import { mockDataProviders } from '../data_providers/mock/mock_data_providers'; import { buildGlobalQuery } from '../helpers'; +import { setAutocomplete } from '@kbn/unified-search-plugin/public/services'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { QueryBarTimeline, @@ -184,6 +186,11 @@ describe('Timeline QueryBar ', () => { }); describe('#onSavedQuery', () => { + beforeEach(() => { + const autocompleteStart = unifiedSearchPluginMock.createStartContract(); + setAutocomplete(autocompleteStart.autocomplete); + }); + test('is only reference that changed when dataProviders props get updated', async () => { const Proxy = (props: QueryBarTimelineComponentProps) => ( diff --git a/x-pack/plugins/synthetics/kibana.json b/x-pack/plugins/synthetics/kibana.json index 7eaccbbb0817f..d65a89a16161f 100644 --- a/x-pack/plugins/synthetics/kibana.json +++ b/x-pack/plugins/synthetics/kibana.json @@ -18,7 +18,8 @@ "share", "taskManager", "triggersActionsUi", - "usageCollection" + "usageCollection", + "unifiedSearch" ], "server": true, "ui": true, diff --git a/x-pack/plugins/synthetics/public/apps/plugin.ts b/x-pack/plugins/synthetics/public/apps/plugin.ts index ab2ae07e1c454..e413d52d18865 100644 --- a/x-pack/plugins/synthetics/public/apps/plugin.ts +++ b/x-pack/plugins/synthetics/public/apps/plugin.ts @@ -25,6 +25,7 @@ import { TriggersAndActionsUIPublicPluginSetup, TriggersAndActionsUIPublicPluginStart, } from '@kbn/triggers-actions-ui-plugin/public'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import { FleetStart } from '@kbn/fleet-plugin/public'; @@ -58,6 +59,7 @@ export interface ClientPluginsSetup { export interface ClientPluginsStart { fleet?: FleetStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; discover: DiscoverStart; inspector: InspectorPluginStart; embeddable: EmbeddableStart; diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx index 3c8c8946fa06d..362263fa006ab 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx +++ b/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx @@ -28,7 +28,7 @@ export default function MonitorStatusAlert({ core, plugins, params }: Props) { - + diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 43b888dc0378b..b92c77300e9d0 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -1975,22 +1975,6 @@ "data.inspector.table.tableLabel": "Tableau {index}", "data.inspector.table.tablesDescription": "Il y a {tablesCount, plural, one {# tableau} other {# tableaux} } au total.", "data.inspector.table.tableSelectorLabel": "Sélectionné :", - "data.kueryAutocomplete.andOperatorDescription": "Nécessite que {bothArguments} soient ''vrai''.", - "data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "les deux arguments", - "data.kueryAutocomplete.equalOperatorDescription": "{equals} une certaine valeur", - "data.kueryAutocomplete.equalOperatorDescription.equalsText": "égale", - "data.kueryAutocomplete.existOperatorDescription": "{exists} sous un certain format", - "data.kueryAutocomplete.existOperatorDescription.existsText": "existe", - "data.kueryAutocomplete.greaterThanOperatorDescription": "est {greaterThan} une certaine valeur", - "data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "supérieur à", - "data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "est {greaterThanOrEqualTo} une certaine valeur", - "data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "supérieur ou égal à", - "data.kueryAutocomplete.lessThanOperatorDescription": "est {lessThan} une certaine valeur", - "data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "inférieur à", - "data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "est {lessThanOrEqualTo} une certaine valeur", - "data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "inférieur ou égal à", - "data.kueryAutocomplete.orOperatorDescription": "Nécessite qu’{oneOrMoreArguments} soit ''vrai''.", - "data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "au moins un argument", "data.painlessError.buttonTxt": "Modifier le script", "data.painlessError.painlessScriptedFieldErrorMessage": "Erreur d'exécution du champ d'exécution ou du champ scripté sur le modèle d'indexation {indexPatternName}", "data.parseEsInterval.invalidEsCalendarIntervalErrorMessage": "Intervalle de calendrier non valide : {interval} ; la valeur doit être 1.", @@ -31048,6 +31032,137 @@ "xpack.watcher.watchActions.webhook.portIsRequiredValidationMessage": "Le port webhook est requis.", "xpack.watcher.watchActions.webhook.usernameIsRequiredIfPasswordValidationMessage": "Le nom d'utilisateur est requis.", "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Ce champ est requis.", - "xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes." + "xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes.", + "unifiedSearch.noDataPopover.content": "Cette plage temporelle ne contient pas de données. Étendez ou ajustez la plage temporelle pour obtenir plus de champs et pouvoir créer des graphiques.", + "unifiedSearch.noDataPopover.dismissAction": "Ne plus afficher", + "unifiedSearch.noDataPopover.subtitle": "Conseil", + "unifiedSearch.noDataPopover.title": "Ensemble de données vide", + "unifiedSearch.query.queryBar.clearInputLabel": "Effacer l'entrée", + "unifiedSearch.query.queryBar.comboboxAriaLabel": "Rechercher et filtrer la page {pageType}", + "unifiedSearch.query.queryBar.kqlFullLanguageName": "Langage de requête Kibana", + "unifiedSearch.query.queryBar.kqlLanguageName": "KQL", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoDocLinkText": "documents", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoOptOutText": "Ne plus afficher", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoText": "Il semblerait que votre requête porte sur un champ imbriqué. Selon le résultat visé, il existe plusieurs façons de construire une syntaxe KQL pour des requêtes imbriquées. Apprenez-en plus avec notre {link}.", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoTitle": "Syntaxe de requête imbriquée KQL", + "unifiedSearch.query.queryBar.kqlOffLabel": "Désactivé", + "unifiedSearch.query.queryBar.kqlOnLabel": "Activé", + "unifiedSearch.query.queryBar.languageSwitcher.toText": "Passer au langage de requête Kibana pour la recherche", + "unifiedSearch.query.queryBar.luceneLanguageName": "Lucene", + "unifiedSearch.query.queryBar.searchInputAriaLabel": "Commencer à taper pour rechercher et filtrer la page {pageType}", + "unifiedSearch.query.queryBar.searchInputPlaceholder": "Recherche", + "unifiedSearch.query.queryBar.syntaxOptionsDescription": "{docsLink} (KQL) offre une syntaxe de requête simplifiée et la prise en charge des champs scriptés. KQL offre également une fonctionnalité de saisie semi-automatique. Si vous désactivez KQL, {nonKqlModeHelpText}.", + "unifiedSearch.query.queryBar.syntaxOptionsDescription.nonKqlModeHelpText": "Kibana utilise Lucene.", + "unifiedSearch.search.searchBar.savedQueryDescriptionLabelText": "Description", + "unifiedSearch.search.searchBar.savedQueryDescriptionText": "Enregistrez le texte et les filtres de la requête que vous souhaitez réutiliser.", + "unifiedSearch.search.searchBar.savedQueryForm.titleConflictText": "Ce nom est en conflit avec une requête enregistrée existante.", + "unifiedSearch.search.searchBar.savedQueryFormCancelButtonText": "Annuler", + "unifiedSearch.search.searchBar.savedQueryFormSaveButtonText": "Enregistrer", + "unifiedSearch.search.searchBar.savedQueryFormTitle": "Enregistrer la requête", + "unifiedSearch.search.searchBar.savedQueryIncludeFiltersLabelText": "Inclure les filtres", + "unifiedSearch.search.searchBar.savedQueryIncludeTimeFilterLabelText": "Inclure le filtre temporel", + "unifiedSearch.search.searchBar.savedQueryNameHelpText": "Un nom est requis. Le nom ne peut pas contenir d'espace vide au début ou à la fin. Le nom doit être unique.", + "unifiedSearch.search.searchBar.savedQueryNameLabelText": "Nom", + "unifiedSearch.search.searchBar.savedQueryNoSavedQueriesText": "Aucune requête enregistrée.", + "unifiedSearch.search.searchBar.savedQueryPopoverButtonText": "Voir les requêtes enregistrées", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonAriaLabel": "Effacer la requête enregistrée en cours", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonText": "Effacer", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionCancelButtonText": "Annuler", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionConfirmButtonText": "Supprimer", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionTitle": "Supprimer \"{savedQueryName}\" ?", + "unifiedSearch.search.searchBar.savedQueryPopoverDeleteButtonAriaLabel": "Supprimer la requête enregistrée {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonAriaLabel": "Enregistrer en tant que nouvelle requête enregistrée", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonText": "Enregistrer en tant que nouvelle", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonAriaLabel": "Enregistrer une nouvelle requête enregistrée", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonText": "Enregistrer la requête en cours", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonAriaLabel": "Enregistrer les modifications apportées à {title}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonText": "Enregistrer les modifications", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemButtonAriaLabel": "Bouton de requête enregistrée {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemDescriptionAriaLabel": "Description de {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemSelectedButtonAriaLabel": "Bouton de requête enregistrée {savedQueryName} sélectionné. Appuyez pour effacer les modifications.", + "unifiedSearch.search.searchBar.savedQueryPopoverTitleText": "Requêtes enregistrées", + "unifiedSearch.search.unableToGetSavedQueryToastTitle": "Impossible de charger la requête enregistrée {savedQueryId}", + "unifiedSearch.query.queryBar.syntaxOptionsTitle": "Options de syntaxe", + "unifiedSearch.filter.applyFilterActionTitle": "Appliquer le filtre à la vue en cours", + "unifiedSearch.filter.applyFilters.popupHeader": "Sélectionner les filtres à appliquer", + "unifiedSearch.filter.applyFiltersPopup.cancelButtonLabel": "Annuler", + "unifiedSearch.filter.applyFiltersPopup.saveButtonLabel": "Appliquer", + "unifiedSearch.filter.filterBar.addFilterButtonLabel": "Ajouter un filtre", + "unifiedSearch.filter.filterBar.deleteFilterButtonLabel": "Supprimer", + "unifiedSearch.filter.filterBar.disabledFilterPrefix": "Désactivé", + "unifiedSearch.filter.filterBar.disableFilterButtonLabel": "Désactiver temporairement", + "unifiedSearch.filter.filterBar.editFilterButtonLabel": "Modifier le filtre", + "unifiedSearch.filter.filterBar.enableFilterButtonLabel": "Réactiver", + "unifiedSearch.filter.filterBar.excludeFilterButtonLabel": "Exclure les résultats", + "unifiedSearch.filter.filterBar.filterItemBadgeAriaLabel": "Actions de filtrage", + "unifiedSearch.filter.filterBar.filterItemBadgeIconAriaLabel": "Supprimer {filter}", + "unifiedSearch.filter.filterBar.includeFilterButtonLabel": "Inclure les résultats", + "unifiedSearch.filter.filterBar.indexPatternSelectPlaceholder": "Sélectionner un modèle d'indexation", + "unifiedSearch.filter.filterBar.labelErrorInfo": "Modèle d'indexation {indexPattern} introuvable", + "unifiedSearch.filter.filterBar.labelErrorText": "Erreur", + "unifiedSearch.filter.filterBar.labelWarningInfo": "Le champ {fieldName} n'existe pas dans la vue en cours.", + "unifiedSearch.filter.filterBar.labelWarningText": "Avertissement", + "unifiedSearch.filter.filterBar.moreFilterActionsMessage": "Filtre : {innerText}. Sélectionner pour plus d’actions de filtrage.", + "unifiedSearch.filter.filterBar.negatedFilterPrefix": "NON ", + "unifiedSearch.filter.filterBar.pinFilterButtonLabel": "Épingler dans toutes les applications", + "unifiedSearch.filter.filterBar.pinnedFilterPrefix": "Épinglé", + "unifiedSearch.filter.filterBar.unpinFilterButtonLabel": "Désépingler", + "unifiedSearch.filter.filterEditor.cancelButtonLabel": "Annuler", + "unifiedSearch.filter.filterEditor.createCustomLabelInputLabel": "Étiquette personnalisée", + "unifiedSearch.filter.filterEditor.createCustomLabelSwitchLabel": "Créer une étiquette personnalisée ?", + "unifiedSearch.filter.filterEditor.doesNotExistOperatorOptionLabel": "n'existe pas", + "unifiedSearch.filter.filterEditor.editFilterPopupTitle": "Modifier le filtre", + "unifiedSearch.filter.filterEditor.editFilterValuesButtonLabel": "Modifier les valeurs du filtre", + "unifiedSearch.filter.filterEditor.editQueryDslButtonLabel": "Modifier en tant que Query DSL", + "unifiedSearch.filter.filterEditor.existsOperatorOptionLabel": "existe", + "unifiedSearch.filter.filterEditor.falseOptionLabel": "false", + "unifiedSearch.filter.filterEditor.fieldSelectLabel": "Champ", + "unifiedSearch.filter.filterEditor.fieldSelectPlaceholder": "Sélectionner d'abord un champ", + "unifiedSearch.filter.filterEditor.indexPatternSelectLabel": "Modèle d'indexation", + "unifiedSearch.filter.filterEditor.isBetweenOperatorOptionLabel": "est entre", + "unifiedSearch.filter.filterEditor.isNotBetweenOperatorOptionLabel": "n'est pas entre", + "unifiedSearch.filter.filterEditor.isNotOneOfOperatorOptionLabel": "n'est pas l'une des options suivantes", + "unifiedSearch.filter.filterEditor.isNotOperatorOptionLabel": "n'est pas", + "unifiedSearch.filter.filterEditor.isOneOfOperatorOptionLabel": "est l'une des options suivantes", + "unifiedSearch.filter.filterEditor.isOperatorOptionLabel": "est", + "unifiedSearch.filter.filterEditor.operatorSelectLabel": "Opérateur", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderSelect": "Sélectionner", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderWaiting": "En attente", + "unifiedSearch.filter.filterEditor.queryDslLabel": "Query DSL d'Elasticsearch", + "unifiedSearch.filter.filterEditor.rangeEndInputPlaceholder": "Fin de la plage", + "unifiedSearch.filter.filterEditor.rangeInputLabel": "Plage", + "unifiedSearch.filter.filterEditor.rangeStartInputPlaceholder": "Début de la plage", + "unifiedSearch.filter.filterEditor.saveButtonLabel": "Enregistrer", + "unifiedSearch.filter.filterEditor.trueOptionLabel": "vrai", + "unifiedSearch.filter.filterEditor.valueInputLabel": "Valeur", + "unifiedSearch.filter.filterEditor.valueInputPlaceholder": "Saisir une valeur", + "unifiedSearch.filter.filterEditor.valueSelectPlaceholder": "Sélectionner une valeur", + "unifiedSearch.filter.filterEditor.valuesSelectLabel": "Valeurs", + "unifiedSearch.filter.filterEditor.valuesSelectPlaceholder": "Sélectionner des valeurs", + "unifiedSearch.filter.options.changeAllFiltersButtonLabel": "Changer tous les filtres", + "unifiedSearch.filter.options.deleteAllFiltersButtonLabel": "Tout supprimer", + "unifiedSearch.filter.options.disableAllFiltersButtonLabel": "Tout désactiver", + "unifiedSearch.filter.options.enableAllFiltersButtonLabel": "Tout activer", + "unifiedSearch.filter.options.invertDisabledFiltersButtonLabel": "Inverser l’activation/désactivation", + "unifiedSearch.filter.options.invertNegatedFiltersButtonLabel": "Inverser l'inclusion", + "unifiedSearch.filter.options.pinAllFiltersButtonLabel": "Tout épingler", + "unifiedSearch.filter.options.unpinAllFiltersButtonLabel": "Tout désépingler", + "unifiedSearch.filter.searchBar.changeAllFiltersTitle": "Changer tous les filtres", + "unifiedSearch.kueryAutocomplete.andOperatorDescription": "Nécessite que {bothArguments} soient ''vrai''.", + "unifiedSearch.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "les deux arguments", + "unifiedSearch.kueryAutocomplete.equalOperatorDescription": "{equals} une certaine valeur", + "unifiedSearch.kueryAutocomplete.equalOperatorDescription.equalsText": "égale", + "unifiedSearch.kueryAutocomplete.existOperatorDescription": "{exists} sous un certain format", + "unifiedSearch.kueryAutocomplete.existOperatorDescription.existsText": "existe", + "unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription": "est {greaterThan} une certaine valeur", + "unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "supérieur à", + "unifiedSearch.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "est {greaterThanOrEqualTo} une certaine valeur", + "unifiedSearch.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "supérieur ou égal à", + "unifiedSearch.kueryAutocomplete.lessThanOperatorDescription": "est {lessThan} une certaine valeur", + "unifiedSearch.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "inférieur à", + "unifiedSearch.kueryAutocomplete.lessThanOrEqualOperatorDescription": "est {lessThanOrEqualTo} une certaine valeur", + "unifiedSearch.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "inférieur ou égal à", + "unifiedSearch.kueryAutocomplete.orOperatorDescription": "Nécessite qu’{oneOrMoreArguments} soit ''vrai''.", + "unifiedSearch.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "au moins un argument" } } diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 2b33d03617c24..361ed7985a276 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2069,22 +2069,6 @@ "data.inspector.table.tableLabel": "テーブル{index}", "data.inspector.table.tablesDescription": "合計で{tablesCount, plural, other {# 個のテーブル} }があります", "data.inspector.table.tableSelectorLabel": "選択済み:", - "data.kueryAutocomplete.andOperatorDescription": "{bothArguments} が true であることを条件とする", - "data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "両方の引数", - "data.kueryAutocomplete.equalOperatorDescription": "一部の値に{equals}", - "data.kueryAutocomplete.equalOperatorDescription.equalsText": "一致する", - "data.kueryAutocomplete.existOperatorDescription": "いずれかの形式中に{exists}", - "data.kueryAutocomplete.existOperatorDescription.existsText": "存在する", - "data.kueryAutocomplete.greaterThanOperatorDescription": "が一部の値{greaterThan}", - "data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "より大きい", - "data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "が一部の値{greaterThanOrEqualTo}", - "data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "よりも大きいまたは等しい", - "data.kueryAutocomplete.lessThanOperatorDescription": "が一部の値{lessThan}", - "data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "より小さい", - "data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "が一部の値{lessThanOrEqualTo}", - "data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "より小さいまたは等しい", - "data.kueryAutocomplete.orOperatorDescription": "{oneOrMoreArguments} が true であることを条件とする", - "data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数", "data.painlessError.buttonTxt": "スクリプトを編集", "data.painlessError.painlessScriptedFieldErrorMessage": "インデックスパターン{indexPatternName}でのランタイムフィールドまたはスクリプトフィールドの実行エラー", "data.parseEsInterval.invalidEsCalendarIntervalErrorMessage": "無効なカレンダー間隔:{interval}、1よりも大きな値が必要です", @@ -31264,6 +31248,138 @@ "xpack.watcher.watchActions.webhook.portIsRequiredValidationMessage": "Webフックポートが必要です。", "xpack.watcher.watchActions.webhook.usernameIsRequiredIfPasswordValidationMessage": "ユーザー名が必要です。", "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", - "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" + "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。", + "unifiedSearch.search.searchBar.savedQueryDescriptionLabelText": "説明", + "unifiedSearch.search.searchBar.savedQueryDescriptionText": "再度使用するクエリテキストとフィルターを保存します。", + "unifiedSearch.search.searchBar.savedQueryForm.titleConflictText": "タイトルがすでに保存されているクエリに使用されています", + "unifiedSearch.search.searchBar.savedQueryFormCancelButtonText": "キャンセル", + "unifiedSearch.search.searchBar.savedQueryFormSaveButtonText": "保存", + "unifiedSearch.search.searchBar.savedQueryFormTitle": "クエリを保存", + "unifiedSearch.search.searchBar.savedQueryIncludeFiltersLabelText": "フィルターを含める", + "unifiedSearch.search.searchBar.savedQueryIncludeTimeFilterLabelText": "時間フィルターを含める", + "unifiedSearch.search.searchBar.savedQueryNameHelpText": "名前は必須です。名前の始めと終わりにはスペースを使用できません。名前は一意でなければなりません。", + "unifiedSearch.search.searchBar.savedQueryNameLabelText": "名前", + "unifiedSearch.search.searchBar.savedQueryNoSavedQueriesText": "保存されたクエリがありません。", + "unifiedSearch.search.searchBar.savedQueryPopoverButtonText": "保存されたクエリを表示", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonAriaLabel": "現在保存されているクエリを消去", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonText": "クリア", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionCancelButtonText": "キャンセル", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionConfirmButtonText": "削除", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionTitle": "「{savedQueryName}」を削除しますか?", + "unifiedSearch.search.searchBar.savedQueryPopoverDeleteButtonAriaLabel": "保存されたクエリ {savedQueryName} を削除", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonAriaLabel": "新規保存クエリを保存", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonText": "新規保存", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonAriaLabel": "新規保存クエリを保存", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonText": "現在のクエリを保存", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonAriaLabel": "{title} への変更を保存", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonText": "変更を保存", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemButtonAriaLabel": "保存クエリボタン {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemDescriptionAriaLabel": "{savedQueryName}の説明", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemSelectedButtonAriaLabel": "選択されたクエリボタン {savedQueryName} を保存しました。変更を破棄するには押してください。", + "unifiedSearch.search.searchBar.savedQueryPopoverTitleText": "保存されたクエリ", + "unifiedSearch.noDataPopover.content": "この時間範囲にはデータが含まれていません。表示するフィールドを増やし、グラフを作成するには、時間範囲を広げるか、調整してください。", + "unifiedSearch.noDataPopover.dismissAction": "今後表示しない", + "unifiedSearch.noDataPopover.subtitle": "ヒント", + "unifiedSearch.noDataPopover.title": "空のデータセット", + "unifiedSearch.query.queryBar.clearInputLabel": "インプットを消去", + "unifiedSearch.query.queryBar.comboboxAriaLabel": "{pageType} ページの検索とフィルタリング", + "unifiedSearch.query.queryBar.kqlFullLanguageName": "Kibana クエリ言語", + "unifiedSearch.query.queryBar.kqlLanguageName": "KQL", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoDocLinkText": "ドキュメント", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoOptOutText": "今後表示しない", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoText": "ネストされたフィールドをクエリされているようです。ネストされたクエリに対しては、ご希望の結果により異なる方法で KQL 構文を構築することができます。詳細については、{link}をご覧ください。", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoTitle": "KQL ネストされたクエリ構文", + "unifiedSearch.query.queryBar.kqlOffLabel": "オフ", + "unifiedSearch.query.queryBar.kqlOnLabel": "オン", + "unifiedSearch.query.queryBar.languageSwitcher.toText": "検索用にKibana Query Languageに切り替える", + "unifiedSearch.query.queryBar.luceneLanguageName": "Lucene", + "unifiedSearch.query.queryBar.searchInputAriaLabel": "{pageType} ページの検索とフィルタリングを行うには入力を開始してください", + "unifiedSearch.query.queryBar.searchInputPlaceholder": "検索", + "unifiedSearch.query.queryBar.syntaxOptionsDescription": "{docsLink}(KQL)は、シンプルなクエリ構文とスクリプトフィールドのサポートを提供します。KQLにはオートコンプリート機能もあります。KQLをオフにする場合は、{nonKqlModeHelpText}", + "unifiedSearch.query.queryBar.syntaxOptionsDescription.nonKqlModeHelpText": "KibanaはLuceneを使用します。", + "unifiedSearch.search.unableToGetSavedQueryToastTitle": "保存したクエリ {savedQueryId} を読み込めません", + "unifiedSearch.query.queryBar.syntaxOptionsTitle": "構文オプション", + "unifiedSearch.filter.applyFilterActionTitle": "現在のビューにフィルターを適用", + "unifiedSearch.filter.applyFilters.popupHeader": "適用するフィルターの選択", + "unifiedSearch.filter.applyFiltersPopup.cancelButtonLabel": "キャンセル", + "unifiedSearch.filter.applyFiltersPopup.saveButtonLabel": "適用", + "unifiedSearch.filter.filterBar.addFilterButtonLabel": "フィルターを追加します", + "unifiedSearch.filter.filterBar.deleteFilterButtonLabel": "削除", + "unifiedSearch.filter.filterBar.disabledFilterPrefix": "無効", + "unifiedSearch.filter.filterBar.disableFilterButtonLabel": "一時的に無効にする", + "unifiedSearch.filter.filterBar.editFilterButtonLabel": "フィルターを編集", + "unifiedSearch.filter.filterBar.enableFilterButtonLabel": "再度有効にする", + "unifiedSearch.filter.filterBar.excludeFilterButtonLabel": "結果を除外", + "unifiedSearch.filter.filterBar.filterItemBadgeAriaLabel": "フィルターアクション", + "unifiedSearch.filter.filterBar.filterItemBadgeIconAriaLabel": "{filter}を削除", + "unifiedSearch.filter.filterBar.includeFilterButtonLabel": "結果を含める", + "unifiedSearch.filter.filterBar.indexPatternSelectPlaceholder": "インデックスパターンの選択", + "unifiedSearch.filter.filterBar.labelErrorInfo": "インデックスパターン{indexPattern}が見つかりません", + "unifiedSearch.filter.filterBar.labelErrorText": "エラー", + "unifiedSearch.filter.filterBar.labelWarningInfo": "フィールド{fieldName}は現在のビューに存在しません", + "unifiedSearch.filter.filterBar.labelWarningText": "警告", + "unifiedSearch.filter.filterBar.moreFilterActionsMessage": "フィルター:{innerText}。他のフィルターアクションを使用するには選択してください。", + "unifiedSearch.filter.filterBar.negatedFilterPrefix": "NOT ", + "unifiedSearch.filter.filterBar.pinFilterButtonLabel": "すべてのアプリにピン付け", + "unifiedSearch.filter.filterBar.pinnedFilterPrefix": "ピン付け済み", + "unifiedSearch.filter.filterBar.unpinFilterButtonLabel": "ピンを外す", + "unifiedSearch.filter.filterEditor.cancelButtonLabel": "キャンセル", + "unifiedSearch.filter.filterEditor.createCustomLabelInputLabel": "カスタムラベル", + "unifiedSearch.filter.filterEditor.createCustomLabelSwitchLabel": "カスタムラベルを作成しますか?", + "unifiedSearch.filter.filterEditor.doesNotExistOperatorOptionLabel": "存在しない", + "unifiedSearch.filter.filterEditor.editFilterPopupTitle": "フィルターを編集", + "unifiedSearch.filter.filterEditor.editFilterValuesButtonLabel": "フィルター値を編集", + "unifiedSearch.filter.filterEditor.editQueryDslButtonLabel": "クエリ DSL として編集", + "unifiedSearch.filter.filterEditor.existsOperatorOptionLabel": "存在する", + "unifiedSearch.filter.filterEditor.falseOptionLabel": "false", + "unifiedSearch.filter.filterEditor.fieldSelectLabel": "フィールド", + "unifiedSearch.filter.filterEditor.fieldSelectPlaceholder": "フィールドを選択", + "unifiedSearch.filter.filterEditor.indexPatternSelectLabel": "インデックスパターン", + "unifiedSearch.filter.filterEditor.isBetweenOperatorOptionLabel": "is between", + "unifiedSearch.filter.filterEditor.isNotBetweenOperatorOptionLabel": "is not between", + "unifiedSearch.filter.filterEditor.isNotOneOfOperatorOptionLabel": "is not one of", + "unifiedSearch.filter.filterEditor.isNotOperatorOptionLabel": "is not", + "unifiedSearch.filter.filterEditor.isOneOfOperatorOptionLabel": "is one of", + "unifiedSearch.filter.filterEditor.isOperatorOptionLabel": "is", + "unifiedSearch.filter.filterEditor.operatorSelectLabel": "演算子", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderSelect": "選択してください", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderWaiting": "待機中", + "unifiedSearch.filter.filterEditor.queryDslAriaLabel": "ElasticsearchクエリDSLエディター", + "unifiedSearch.filter.filterEditor.queryDslLabel": "Elasticsearch クエリ DSL", + "unifiedSearch.filter.filterEditor.rangeEndInputPlaceholder": "範囲の終了値", + "unifiedSearch.filter.filterEditor.rangeInputLabel": "範囲", + "unifiedSearch.filter.filterEditor.rangeStartInputPlaceholder": "範囲の開始値", + "unifiedSearch.filter.filterEditor.saveButtonLabel": "保存", + "unifiedSearch.filter.filterEditor.trueOptionLabel": "true", + "unifiedSearch.filter.filterEditor.valueInputLabel": "値", + "unifiedSearch.filter.filterEditor.valueInputPlaceholder": "値を入力", + "unifiedSearch.filter.filterEditor.valueSelectPlaceholder": "値を選択", + "unifiedSearch.filter.filterEditor.valuesSelectLabel": "値", + "unifiedSearch.filter.filterEditor.valuesSelectPlaceholder": "値を選択", + "unifiedSearch.filter.options.changeAllFiltersButtonLabel": "すべてのフィルターの変更", + "unifiedSearch.filter.options.deleteAllFiltersButtonLabel": "すべて削除", + "unifiedSearch.filter.options.disableAllFiltersButtonLabel": "すべて無効にする", + "unifiedSearch.filter.options.enableAllFiltersButtonLabel": "すべて有効にする", + "unifiedSearch.filter.options.invertDisabledFiltersButtonLabel": "有効・無効を反転", + "unifiedSearch.filter.options.invertNegatedFiltersButtonLabel": "含める・除外を反転", + "unifiedSearch.filter.options.pinAllFiltersButtonLabel": "すべてピン付け", + "unifiedSearch.filter.options.unpinAllFiltersButtonLabel": "すべてのピンを外す", + "unifiedSearch.filter.searchBar.changeAllFiltersTitle": "すべてのフィルターの変更", + "unifiedSearch.kueryAutocomplete.andOperatorDescription": "{bothArguments} が true であることを条件とする", + "unifiedSearch.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "両方の引数", + "unifiedSearch.kueryAutocomplete.equalOperatorDescription": "一部の値に{equals}", + "unifiedSearch.kueryAutocomplete.equalOperatorDescription.equalsText": "一致する", + "unifiedSearch.kueryAutocomplete.existOperatorDescription": "いずれかの形式中に{exists}", + "unifiedSearch.kueryAutocomplete.existOperatorDescription.existsText": "存在する", + "unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription": "が一部の値{greaterThan}", + "unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "より大きい", + "unifiedSearch.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "が一部の値{greaterThanOrEqualTo}", + "unifiedSearch.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "よりも大きいまたは等しい", + "unifiedSearch.kueryAutocomplete.lessThanOperatorDescription": "が一部の値{lessThan}", + "unifiedSearch.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "より小さい", + "unifiedSearch.kueryAutocomplete.lessThanOrEqualOperatorDescription": "が一部の値{lessThanOrEqualTo}", + "unifiedSearch.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "より小さいまたは等しい", + "unifiedSearch.kueryAutocomplete.orOperatorDescription": "{oneOrMoreArguments} が true であることを条件とする", + "unifiedSearch.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数" } } diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 670c4e375647b..2226836cd7669 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2076,22 +2076,6 @@ "data.inspector.table.tableLabel": "表 {index}", "data.inspector.table.tablesDescription": "总共有 {tablesCount, plural, other {# 个表} }", "data.inspector.table.tableSelectorLabel": "已选定:", - "data.kueryAutocomplete.andOperatorDescription": "需要{bothArguments}为 true", - "data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "两个参数都", - "data.kueryAutocomplete.equalOperatorDescription": "{equals}某一值", - "data.kueryAutocomplete.equalOperatorDescription.equalsText": "等于", - "data.kueryAutocomplete.existOperatorDescription": "以任意形式{exists}", - "data.kueryAutocomplete.existOperatorDescription.existsText": "存在", - "data.kueryAutocomplete.greaterThanOperatorDescription": "{greaterThan}某一值", - "data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "大于", - "data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "{greaterThanOrEqualTo}某一值", - "data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "大于或等于", - "data.kueryAutocomplete.lessThanOperatorDescription": "{lessThan}某一值", - "data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "小于", - "data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "{lessThanOrEqualTo}某一值", - "data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "小于或等于", - "data.kueryAutocomplete.orOperatorDescription": "需要{oneOrMoreArguments}为 true", - "data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数", "data.painlessError.buttonTxt": "编辑脚本", "data.painlessError.painlessScriptedFieldErrorMessage": "在索引模式 {indexPatternName} 上执行运行时字段或脚本字段时出错", "data.parseEsInterval.invalidEsCalendarIntervalErrorMessage": "无效的日历时间间隔:{interval},值必须为 1", @@ -31299,6 +31283,138 @@ "xpack.watcher.watchActions.webhook.portIsRequiredValidationMessage": "Webhook 端口必填。", "xpack.watcher.watchActions.webhook.usernameIsRequiredIfPasswordValidationMessage": "“用户名”必填。", "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", - "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" + "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。", + "unifiedSearch.search.searchBar.savedQueryDescriptionLabelText": "描述", + "unifiedSearch.search.searchBar.savedQueryDescriptionText": "保存想要再次使用的查询文本和筛选。", + "unifiedSearch.search.searchBar.savedQueryForm.titleConflictText": "标题与现有已保存查询有冲突", + "unifiedSearch.search.searchBar.savedQueryFormCancelButtonText": "取消", + "unifiedSearch.search.searchBar.savedQueryFormSaveButtonText": "保存", + "unifiedSearch.search.searchBar.savedQueryFormTitle": "保存查询", + "unifiedSearch.search.searchBar.savedQueryIncludeFiltersLabelText": "包括筛选", + "unifiedSearch.search.searchBar.savedQueryIncludeTimeFilterLabelText": "包括时间筛选", + "unifiedSearch.search.searchBar.savedQueryNameHelpText": "名称必填,其中不能包含前导或尾随空格,并且必须唯一。", + "unifiedSearch.search.searchBar.savedQueryNameLabelText": "名称", + "unifiedSearch.search.searchBar.savedQueryNoSavedQueriesText": "没有已保存查询。", + "unifiedSearch.search.searchBar.savedQueryPopoverButtonText": "查看已保存查询", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonAriaLabel": "清除当前已保存查询", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonText": "清除", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionCancelButtonText": "取消", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionConfirmButtonText": "删除", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionTitle": "删除“{savedQueryName}”?", + "unifiedSearch.search.searchBar.savedQueryPopoverDeleteButtonAriaLabel": "删除已保存查询 {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonAriaLabel": "另存为新的已保存查询", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonText": "另存为新的", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonAriaLabel": "保存新的已保存查询", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonText": "保存当前查询", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonAriaLabel": "将更改保存到 {title}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonText": "保存更改", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemButtonAriaLabel": "已保存查询按钮 {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemDescriptionAriaLabel": "{savedQueryName} 描述", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemSelectedButtonAriaLabel": "已保存查询按钮已选择 {savedQueryName}。按下可清除任何更改。", + "unifiedSearch.search.searchBar.savedQueryPopoverTitleText": "已保存查询", + "unifiedSearch.noDataPopover.content": "此时间范围不包含任何数据。增大或调整时间范围,以查看更多的字段并创建图表。", + "unifiedSearch.noDataPopover.dismissAction": "不再显示", + "unifiedSearch.noDataPopover.subtitle": "提示", + "unifiedSearch.noDataPopover.title": "空数据集", + "unifiedSearch.query.queryBar.clearInputLabel": "清除输入", + "unifiedSearch.query.queryBar.comboboxAriaLabel": "搜索并筛选 {pageType} 页面", + "unifiedSearch.query.queryBar.kqlFullLanguageName": "Kibana 查询语言", + "unifiedSearch.query.queryBar.kqlLanguageName": "KQL", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoDocLinkText": "文档", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoOptOutText": "不再显示", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoText": "似乎您正在查询嵌套字段。您可以使用不同的方式构造嵌套查询的 KQL 语法,具体取决于您想要的结果。详细了解我们的 {link}。", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoTitle": "KQL 嵌套查询语法", + "unifiedSearch.query.queryBar.kqlOffLabel": "关闭", + "unifiedSearch.query.queryBar.kqlOnLabel": "开启", + "unifiedSearch.query.queryBar.languageSwitcher.toText": "切换到 Kibana 查询语言以进行搜索", + "unifiedSearch.query.queryBar.luceneLanguageName": "Lucene", + "unifiedSearch.query.queryBar.searchInputAriaLabel": "开始键入内容,以搜索并筛选 {pageType} 页面", + "unifiedSearch.query.queryBar.searchInputPlaceholder": "搜索", + "unifiedSearch.query.queryBar.syntaxOptionsDescription": "{docsLink} (KQL) 提供简化查询语法并支持脚本字段。KQL 还提供自动完成功能。如果关闭 KQL,{nonKqlModeHelpText}", + "unifiedSearch.query.queryBar.syntaxOptionsDescription.nonKqlModeHelpText": "Kibana 使用 Lucene。", + "unifiedSearch.search.unableToGetSavedQueryToastTitle": "无法加载已保存查询 {savedQueryId}", + "unifiedSearch.query.queryBar.syntaxOptionsTitle": "语法选项", + "unifiedSearch.filter.applyFilterActionTitle": "将筛选应用于当前视图", + "unifiedSearch.filter.applyFilters.popupHeader": "选择要应用的筛选", + "unifiedSearch.filter.applyFiltersPopup.cancelButtonLabel": "取消", + "unifiedSearch.filter.applyFiltersPopup.saveButtonLabel": "应用", + "unifiedSearch.filter.filterBar.addFilterButtonLabel": "添加筛选", + "unifiedSearch.filter.filterBar.deleteFilterButtonLabel": "删除", + "unifiedSearch.filter.filterBar.disabledFilterPrefix": "已禁用", + "unifiedSearch.filter.filterBar.disableFilterButtonLabel": "暂时禁用", + "unifiedSearch.filter.filterBar.editFilterButtonLabel": "编辑筛选", + "unifiedSearch.filter.filterBar.enableFilterButtonLabel": "重新启用", + "unifiedSearch.filter.filterBar.excludeFilterButtonLabel": "排除结果", + "unifiedSearch.filter.filterBar.filterItemBadgeAriaLabel": "筛选操作", + "unifiedSearch.filter.filterBar.filterItemBadgeIconAriaLabel": "删除 {filter}", + "unifiedSearch.filter.filterBar.includeFilterButtonLabel": "包括结果", + "unifiedSearch.filter.filterBar.indexPatternSelectPlaceholder": "选择索引模式", + "unifiedSearch.filter.filterBar.labelErrorInfo": "找不到索引模式 {indexPattern}", + "unifiedSearch.filter.filterBar.labelErrorText": "错误", + "unifiedSearch.filter.filterBar.labelWarningInfo": "当前视图中不存在字段 {fieldName}", + "unifiedSearch.filter.filterBar.labelWarningText": "警告", + "unifiedSearch.filter.filterBar.moreFilterActionsMessage": "筛选:{innerText}。选择以获取更多筛选操作。", + "unifiedSearch.filter.filterBar.negatedFilterPrefix": "非 ", + "unifiedSearch.filter.filterBar.pinFilterButtonLabel": "在所有应用上固定", + "unifiedSearch.filter.filterBar.pinnedFilterPrefix": "已置顶", + "unifiedSearch.filter.filterBar.unpinFilterButtonLabel": "取消固定", + "unifiedSearch.filter.filterEditor.cancelButtonLabel": "取消", + "unifiedSearch.filter.filterEditor.createCustomLabelInputLabel": "定制标签", + "unifiedSearch.filter.filterEditor.createCustomLabelSwitchLabel": "创建定制标签?", + "unifiedSearch.filter.filterEditor.doesNotExistOperatorOptionLabel": "不存在", + "unifiedSearch.filter.filterEditor.editFilterPopupTitle": "编辑筛选", + "unifiedSearch.filter.filterEditor.editFilterValuesButtonLabel": "编辑筛选值", + "unifiedSearch.filter.filterEditor.editQueryDslButtonLabel": "编辑为查询 DSL", + "unifiedSearch.filter.filterEditor.existsOperatorOptionLabel": "存在", + "unifiedSearch.filter.filterEditor.falseOptionLabel": "false", + "unifiedSearch.filter.filterEditor.fieldSelectLabel": "字段", + "unifiedSearch.filter.filterEditor.fieldSelectPlaceholder": "首先选择字段", + "unifiedSearch.filter.filterEditor.indexPatternSelectLabel": "索引模式", + "unifiedSearch.filter.filterEditor.isBetweenOperatorOptionLabel": "介于", + "unifiedSearch.filter.filterEditor.isNotBetweenOperatorOptionLabel": "不介于", + "unifiedSearch.filter.filterEditor.isNotOneOfOperatorOptionLabel": "不属于", + "unifiedSearch.filter.filterEditor.isNotOperatorOptionLabel": "不是", + "unifiedSearch.filter.filterEditor.isOneOfOperatorOptionLabel": "属于", + "unifiedSearch.filter.filterEditor.isOperatorOptionLabel": "是", + "unifiedSearch.filter.filterEditor.operatorSelectLabel": "运算符", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderSelect": "选择", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderWaiting": "正在等候", + "unifiedSearch.filter.filterEditor.queryDslAriaLabel": "Elasticsearch 查询 DSL 编辑器", + "unifiedSearch.filter.filterEditor.queryDslLabel": "Elasticsearch 查询 DSL", + "unifiedSearch.filter.filterEditor.rangeEndInputPlaceholder": "范围结束", + "unifiedSearch.filter.filterEditor.rangeInputLabel": "范围", + "unifiedSearch.filter.filterEditor.rangeStartInputPlaceholder": "范围开始", + "unifiedSearch.filter.filterEditor.saveButtonLabel": "保存", + "unifiedSearch.filter.filterEditor.trueOptionLabel": "true", + "unifiedSearch.filter.filterEditor.valueInputLabel": "值", + "unifiedSearch.filter.filterEditor.valueInputPlaceholder": "输入值", + "unifiedSearch.filter.filterEditor.valueSelectPlaceholder": "选择值", + "unifiedSearch.filter.filterEditor.valuesSelectLabel": "值", + "unifiedSearch.filter.filterEditor.valuesSelectPlaceholder": "选择值", + "unifiedSearch.filter.options.changeAllFiltersButtonLabel": "更改所有筛选", + "unifiedSearch.filter.options.deleteAllFiltersButtonLabel": "全部删除", + "unifiedSearch.filter.options.disableAllFiltersButtonLabel": "全部禁用", + "unifiedSearch.filter.options.enableAllFiltersButtonLabel": "全部启用", + "unifiedSearch.filter.options.invertDisabledFiltersButtonLabel": "反向已启用/已禁用", + "unifiedSearch.filter.options.invertNegatedFiltersButtonLabel": "反向包括", + "unifiedSearch.filter.options.pinAllFiltersButtonLabel": "全部固定", + "unifiedSearch.filter.options.unpinAllFiltersButtonLabel": "全部取消固定", + "unifiedSearch.filter.searchBar.changeAllFiltersTitle": "更改所有筛选", + "unifiedSearch.kueryAutocomplete.andOperatorDescription": "需要{bothArguments}为 true", + "unifiedSearch.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "两个参数都", + "unifiedSearch.kueryAutocomplete.equalOperatorDescription": "{equals}某一值", + "unifiedSearch.kueryAutocomplete.equalOperatorDescription.equalsText": "等于", + "unifiedSearch.kueryAutocomplete.existOperatorDescription": "以任意形式{exists}", + "unifiedSearch.kueryAutocomplete.existOperatorDescription.existsText": "存在", + "unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription": "{greaterThan}某一值", + "unifiedSearch.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "大于", + "unifiedSearch.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "{greaterThanOrEqualTo}某一值", + "unifiedSearch.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "大于或等于", + "unifiedSearch.kueryAutocomplete.lessThanOperatorDescription": "{lessThan}某一值", + "unifiedSearch.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "小于", + "unifiedSearch.kueryAutocomplete.lessThanOrEqualOperatorDescription": "{lessThanOrEqualTo}某一值", + "unifiedSearch.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "小于或等于", + "unifiedSearch.kueryAutocomplete.orOperatorDescription": "需要{oneOrMoreArguments}为 true", + "unifiedSearch.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数" } }