diff --git a/.eslintrc.js b/.eslintrc.js
index 5c2a2817eae53..561e9bc55bf9d 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -640,6 +640,10 @@ module.exports = {
name: 'lodash/fp/assocPath',
message: 'Please use @elastic/safer-lodash-set instead',
},
+ {
+ name: 'react-use',
+ message: 'Please use react-use/lib/{method} instead.',
+ },
],
},
],
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 84076f4c4fbe9..e58d43e07cff5 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -26,30 +26,17 @@
/src/plugins/vis_type_vislib/ @elastic/kibana-app
/src/plugins/vis_type_xy/ @elastic/kibana-app
/src/plugins/visualize/ @elastic/kibana-app
-/src/plugins/visualizations/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/common/utils @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/migrations @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/public @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/timelion @elastic/kibana-app
-#CC# /src/legacy/core_plugins/vis_type_tagcloud @elastic/kibana-app
-#CC# /src/legacy/core_plugins/vis_type_vega @elastic/kibana-app
-#CC# /src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
-#CC# /src/legacy/server/url_shortening/ @elastic/kibana-app
-#CC# /src/legacy/ui/public/state_management @elastic/kibana-app
+/src/plugins/visualizations/ @elastic/kibana-application
-# App Architecture
+# Application Services
/examples/bfetch_explorer/ @elastic/kibana-app-arch
/examples/dashboard_embeddable_examples/ @elastic/kibana-app-arch
/examples/demo_search/ @elastic/kibana-app-arch
/examples/developer_examples/ @elastic/kibana-app-arch
/examples/embeddable_examples/ @elastic/kibana-app-arch
/examples/embeddable_explorer/ @elastic/kibana-app-arch
-/examples/state_container_examples/ @elastic/kibana-app-arch
-/examples/ui_actions_examples/ @elastic/kibana-app-arch
+/examples/state_containers_examples/ @elastic/kibana-app-arch
+/examples/ui_action_examples/ @elastic/kibana-app-arch
/examples/ui_actions_explorer/ @elastic/kibana-app-arch
/examples/url_generators_examples/ @elastic/kibana-app-arch
/examples/url_generators_explorer/ @elastic/kibana-app-arch
@@ -74,7 +61,6 @@
#CC# /src/plugins/index_pattern_management/ @elastic/kibana-app-arch
#CC# /src/plugins/inspector/ @elastic/kibana-app-arch
#CC# /src/plugins/share/ @elastic/kibana-app-arch
-#CC# /x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch
#CC# /x-pack/plugins/drilldowns/ @elastic/kibana-app-arch
#CC# /packages/kbn-interpreter/ @elastic/kibana-app-arch
@@ -84,9 +70,6 @@
/src/plugins/apm_oss/ @elastic/apm-ui
/src/apm.js @watson @vigneshshanmugam
#CC# /src/plugins/apm_oss/ @elastic/apm-ui
-#CC# /src/legacy/core_plugins/apm_oss/ @elastic/apm-ui
-#CC# /src/legacy/ui/public/apm @elastic/apm-ui
-#CC# /x-pack/legacy/plugins/apm/ @elastic/apm-ui
#CC# /x-pack/plugins/observability/ @elastic/apm-ui
# Client Side Monitoring (lives in APM directories but owned by Uptime)
@@ -97,12 +80,9 @@
/x-pack/plugins/apm/server/lib/rum_client @elastic/uptime
/x-pack/plugins/apm/server/routes/rum_client.ts @elastic/uptime
/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts @elastic/uptime
-/x-pack/plugins/apm/server/projections/rum_overview.ts @elastic/uptime
-#CC# /x-pack/legacy/plugins/uptime @elastic/uptime
# Beats
/x-pack/plugins/beats_management/ @elastic/beats
-/x-pack/legacy/plugins/beats_management/ @elastic/beats
#CC# /x-pack/plugins/beats_management/ @elastic/beats
# Presentation
@@ -112,12 +92,9 @@
/x-pack/plugins/canvas/ @elastic/kibana-presentation
/x-pack/plugins/dashboard_enhanced/ @elastic/kibana-presentation
/x-pack/test/functional/apps/canvas/ @elastic/kibana-presentation
-#CC# /src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-presentation
-#CC# /src/legacy/core_plugins/input_control_vis @elastic/kibana-presentation
#CC# /src/plugins/kibana_react/public/code_editor/ @elastic/kibana-presentation
#CC# /x-pack/legacy/plugins/canvas/ @elastic/kibana-presentation
#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-presentation
-#CC# /x-pack/legacy/plugins/dashboard_mode/ @elastic/kibana-presentation
# Core UI
# Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon
@@ -126,8 +103,6 @@
/src/plugins/home/server/services/ @elastic/kibana-core-ui
/src/plugins/kibana_overview/ @elastic/kibana-core-ui
/x-pack/plugins/global_search_bar/ @elastic/kibana-core-ui
-#CC# /src/legacy/core_plugins/newsfeed @elastic/kibana-core-ui
-#CC# /src/legacy/server/sample_data/ @elastic/kibana-core-ui
#CC# /src/plugins/newsfeed @elastic/kibana-core-ui
#CC# /src/plugins/home/public @elastic/kibana-core-ui
#CC# /src/plugins/home/server/services/ @elastic/kibana-core-ui
@@ -143,14 +118,17 @@
# Machine Learning
/x-pack/plugins/ml/ @elastic/ml-ui
-/x-pack/test/functional/apps/machine_learning/ @elastic/ml-ui
-/x-pack/test/functional/services/machine_learning/ @elastic/ml-ui
-/x-pack/test/functional/services/ml.ts @elastic/ml-ui
+/x-pack/test/functional/apps/ml/ @elastic/ml-ui
+/x-pack/test/functional/services/ml/ @elastic/ml-ui
# ML team owns and maintains the transform plugin despite it living in the Elasticsearch management section.
/x-pack/plugins/transform/ @elastic/ml-ui
/x-pack/test/functional/apps/transform/ @elastic/ml-ui
-/x-pack/test/functional/services/transform_ui/ @elastic/ml-ui
-/x-pack/test/functional/services/transform.ts @elastic/ml-ui
+/x-pack/test/functional/services/transform/ @elastic/ml-ui/
+x-pack/test/api_integration_basic/apis/ml/ @elastic/ml-ui
+/x-pack/test/functional_basic/apps/ml/ @elastic/ml-ui
+
+/x-pack/test/api_integration_basic/apis/transform/ @elastic/ml-ui
+/x-pack/test/functional_basic/apps/transform/ @elastic/ml-ui
# Maps
/x-pack/plugins/maps/ @elastic/kibana-gis
@@ -180,9 +158,6 @@
/packages/kbn-es-archiver/ @elastic/kibana-operations
/packages/kbn-utils/ @elastic/kibana-operations
/src/legacy/server/keystore/ @elastic/kibana-operations
-/src/legacy/server/pid/ @elastic/kibana-operations
-/src/legacy/server/sass/ @elastic/kibana-operations
-/src/legacy/server/utils/ @elastic/kibana-operations
/src/legacy/server/warnings/ @elastic/kibana-operations
/.ci/es-snapshots/ @elastic/kibana-operations
/vars/ @elastic/kibana-operations
@@ -211,37 +186,19 @@
/src/legacy/server/config/ @elastic/kibana-platform
/src/legacy/server/http/ @elastic/kibana-platform
/src/legacy/server/logging/ @elastic/kibana-platform
-/src/legacy/server/saved_objects/ @elastic/kibana-platform
-/src/legacy/server/status/ @elastic/kibana-platform
/src/plugins/status_page/ @elastic/kibana-platform
/src/plugins/saved_objects_management/ @elastic/kibana-platform
/src/dev/run_check_published_api_changes.ts @elastic/kibana-platform
#CC# /src/core/server/csp/ @elastic/kibana-platform
-#CC# /src/legacy/core_plugins/kibana/server/lib @elastic/kibana-platform
-#CC# /src/legacy/core_plugins/kibana/server/lib/management/saved_objects @elastic/kibana-platform
-#CC# /src/legacy/core_plugins/kibana/server/routes/api/import/ @elastic/kibana-platform
-#CC# /src/legacy/core_plugins/kibana/server/routes/api/export/ @elastic/kibana-platform
-#CC# /src/legacy/core_plugins/elasticsearch @elastic/kibana-platform
-#CC# /src/legacy/core_plugins/testbed @elastic/kibana-platform
#CC# /src/legacy/server/config/ @elastic/kibana-platform
#CC# /src/legacy/server/http/ @elastic/kibana-platform
-#CC# /src/legacy/server/status/ @elastic/kibana-platform
-#CC# /src/legacy/ui/public/new_platform @elastic/kibana-platform
-#CC# /src/legacy/ui/public/plugin_discovery @elastic/kibana-platform
-#CC# /src/legacy/ui/public/chrome @elastic/kibana-platform
-#CC# /src/legacy/ui/public/notify @elastic/kibana-platform
#CC# /src/legacy/ui/public/documentation_links @elastic/kibana-platform
-#CC# /src/legacy/ui/public/autoload @elastic/kibana-platform
#CC# /src/plugins/legacy_export/ @elastic/kibana-platform
#CC# /src/plugins/saved_objects/ @elastic/kibana-platform
#CC# /src/plugins/status_page/ @elastic/kibana-platform
-#CC# /src/plugins/testbed/server/ @elastic/kibana-platform
-#CC# /x-pack/legacy/plugins/xpack_main/server/ @elastic/kibana-platform
-#CC# /x-pack/legacy/server/lib/ @elastic/kibana-platform
#CC# /x-pack/plugins/cloud/ @elastic/kibana-platform
#CC# /x-pack/plugins/features/ @elastic/kibana-platform
#CC# /x-pack/plugins/global_search/ @elastic/kibana-platform
-#CC# /src/legacy/plugin_discovery/ @elastic/kibana-platform
# Security
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-platform
@@ -257,19 +214,13 @@
/x-pack/test/security_api_integration/ @elastic/kibana-security
/x-pack/test/security_functional/ @elastic/kibana-security
/x-pack/test/spaces_api_integration/ @elastic/kibana-security
-/x-pack/test/token_api_integration/ @elastic/kibana-security
-#CC# /src/legacy/ui/public/capabilities @elastic/kibana-security
-#CC# /x-pack/legacy/plugins/encrypted_saved_objects/ @elastic/kibana-security
#CC# /x-pack/plugins/security_solution/ @elastic/kibana-security
#CC# /x-pack/plugins/security/ @elastic/kibana-security
-#CC# /x-pack/plugins/audit_trail/ @elastic/kibana-security
# Kibana Localization
/src/dev/i18n/ @elastic/kibana-localization
-/src/legacy/server/i18n/ @elastic/kibana-localization
/src/core/public/i18n/ @elastic/kibana-localization
/packages/kbn-i18n/ @elastic/kibana-localization
-#CC# /src/legacy/server/i18n/ @elastic/kibana-localization
#CC# /x-pack/plugins/translations/ @elastic/kibana-localization
# Kibana Telemetry
@@ -294,15 +245,12 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/event_log/ @elastic/kibana-alerting-services
/x-pack/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/alerting_api_integration/ @elastic/kibana-alerting-services
-/x-pack/test/plugin_api_integration/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/kibana-alerting-services
/x-pack/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services
-#CC# /x-pack/legacy/plugins/actions/ @elastic/kibana-alerting-services
-#CC# /x-pack/legacy/plugins/alerting/ @elastic/kibana-alerting-services
-#CC# /x-pack/legacy/plugins/task_manager @elastic/kibana-alerting-services
-#CC# /x-pack/legacy/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
+/docs/user/alerting/ @elastic/kibana-alerting-services
+/docs/management/alerting/ @elastic/kibana-alerting-services
#CC# /x-pack/plugins/stack_alerts @elastic/kibana-alerting-services
# Enterprise Search
@@ -317,7 +265,6 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/cross_cluster_replication/ @elastic/es-ui
/x-pack/plugins/index_lifecycle_management/ @elastic/es-ui
/x-pack/plugins/console_extensions/ @elastic/es-ui
-/x-pack/plugins/es_ui_shared/ @elastic/es-ui
/x-pack/plugins/grokdebugger/ @elastic/es-ui
/x-pack/plugins/index_management/ @elastic/es-ui
/x-pack/plugins/license_management/ @elastic/es-ui
@@ -331,18 +278,11 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/ingest_pipelines/ @elastic/es-ui
/packages/kbn-ace/ @elastic/es-ui
/packages/kbn-monaco/ @elastic/es-ui
-#CC# /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/es-ui
-#CC# /src/legacy/core_plugins/console_legacy @elastic/es-ui
-#CC# /x-pack/legacy/plugins/rollup/ @elastic/es-ui
-#CC# /x-pack/legacy/server/lib/create_router/ @elastic/es-ui
-#CC# /x-pack/legacy/server/lib/check_license/ @elastic/es-ui
#CC# /x-pack/plugins/console_extensions/ @elastic/es-ui
#CC# /x-pack/plugins/cross_cluster_replication/ @elastic/es-ui
-#CC# /x-pack/plugins/es_ui_shared/ @elastic/es-u
# Endpoint
/x-pack/plugins/endpoint/ @elastic/endpoint-app-team @elastic/siem
-/x-pack/test/api_integration/apis/endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/endpoint_api_integration_no_ingest/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/security_solution_endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/functional/es_archives/endpoint/ @elastic/endpoint-app-team @elastic/siem
@@ -359,6 +299,7 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/test/api_integration/apis/security_solution @elastic/siem @elastic/endpoint-app-team
/x-pack/plugins/case @elastic/siem @elastic/endpoint-app-team
/x-pack/plugins/lists @elastic/siem @elastic/endpoint-app-team
+#CC# /x-pack/plugins/security_solution/ @elastic/siem
# Security Intelligence And Analytics
/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics
@@ -367,13 +308,6 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
**/*.scss @elastic/kibana-design
#CC# /packages/kbn-ui-framework/ @elastic/kibana-design
-# Core UI design
-/src/plugins/dashboard/**/*.scss @elastic/kibana-core-ui-designers
-/src/plugins/embeddable/**/*.scss @elastic/kibana-core-ui-designers
-/x-pack/plugins/canvas/**/*.scss @elastic/kibana-core-ui-designers
-/x-pack/plugins/spaces/**/*.scss @elastic/kibana-core-ui-designers
-/x-pack/plugins/security/**/*.scss @elastic/kibana-core-ui-designers
-
# Observability design
/x-pack/plugins/apm/**/*.scss @elastic/observability-design
/x-pack/plugins/infra/**/*.scss @elastic/observability-design
diff --git a/.github/ISSUE_TEMPLATE/v8_breaking_change.md b/.github/ISSUE_TEMPLATE/v8_breaking_change.md
index a64ce33b8f976..86e321990d05f 100644
--- a/.github/ISSUE_TEMPLATE/v8_breaking_change.md
+++ b/.github/ISSUE_TEMPLATE/v8_breaking_change.md
@@ -30,6 +30,8 @@ requesting the breaking change to be surfaced in the Upgrade Assistant.
+**How can we programmatically determine whether the cluster is affected by this breaking change?**
+
**What can users do to address the change manually?**
diff --git a/docs/developer/best-practices/stability.asciidoc b/docs/developer/best-practices/stability.asciidoc
index 348412e593d9e..29be86f58317f 100644
--- a/docs/developer/best-practices/stability.asciidoc
+++ b/docs/developer/best-practices/stability.asciidoc
@@ -43,11 +43,26 @@ dependency list!
[discrete]
=== Test coverage
-* Does the feature have sufficient unit test coverage? (does it handle
-storeinSessions?)
-* Does the feature have sufficient Functional UI test coverage?
-* Does the feature have sufficient Rest API coverage test coverage?
-* Does the feature have sufficient Integration test coverage?
+Testing UI code is hard. We strive for https://github.com/elastic/engineering/blob/master/kibana_dev_principles.md#automate-tests-through-ci[total automated test coverage] of our code and UX,
+but this is difficult to measure and we're constrained by time. During development, test coverage
+measurement is subjective and manual, based on our understanding of the feature. Code coverage
+reports indicate possible gaps, but it ultimately comes down to a judgment call. Here are some
+guidelines to help you ensure sufficient automated test coverage.
+
+* Every PR should be accompanied by tests.
+* Check the before and after automated test coverage metrics. If coverage has gone down you might
+have missed some tests.
+* Cover failure cases, edge cases, and happy paths with your tests.
+* Pay special attention to code that could contain bugs that harm to the user. "Harm" includes
+direct problems like data loss and data entering a bad state, as well as indirect problems like
+making a poor business decision based on misinformation presented by the UI. For example, state
+migrations and security permissions are important areas to cover.
+* Pay special attention to public APIs, which may be used in unexpected ways. Any code you release
+for consumption by other plugins should be rigorously tested with many permutations.
+* Include end-to-end tests for areas where the logic spans global state, URLs, and multiple plugin APIs.
+* Every time a bug is reported, add a test to cover it.
+* Retrospectively gauge the quality of the code you ship by tracking how many bugs are reported for
+features that are released. How can you reduce this number by improving your testing approach?
[discrete]
=== Browser coverage
@@ -63,4 +78,4 @@ Does the feature work efficiently on the list of supported browsers?
* Does the feature affect old indices or saved objects?
* Has the feature been tested with {kib} aliases?
* Read/Write privileges of the indices before and after the
-upgrade?
+upgrade?
\ No newline at end of file
diff --git a/docs/developer/contributing/development-tests.asciidoc b/docs/developer/contributing/development-tests.asciidoc
index e4bd49e12101b..4cf667195153d 100644
--- a/docs/developer/contributing/development-tests.asciidoc
+++ b/docs/developer/contributing/development-tests.asciidoc
@@ -50,6 +50,8 @@ yarn test:ftr:runner –config test/api_integration/config
**Testing IE on OS X**
+**Note:** IE11 is not supported from 7.9 onwards.
+
* http://www.vmware.com/products/fusion/fusion-evaluation.html[Download
VMWare Fusion].
* https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/#downloads[Download
diff --git a/docs/development/core/server/kibana-plugin-core-server.coresetup.i18n.md b/docs/development/core/server/kibana-plugin-core-server.coresetup.i18n.md
new file mode 100644
index 0000000000000..cac878c1e4449
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.coresetup.i18n.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CoreSetup](./kibana-plugin-core-server.coresetup.md) > [i18n](./kibana-plugin-core-server.coresetup.i18n.md)
+
+## CoreSetup.i18n property
+
+[I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md)
+
+Signature:
+
+```typescript
+i18n: I18nServiceSetup;
+```
diff --git a/docs/development/core/server/kibana-plugin-core-server.coresetup.md b/docs/development/core/server/kibana-plugin-core-server.coresetup.md
index 7a733cc34dace..1171dbad570ce 100644
--- a/docs/development/core/server/kibana-plugin-core-server.coresetup.md
+++ b/docs/development/core/server/kibana-plugin-core-server.coresetup.md
@@ -21,6 +21,7 @@ export interface CoreSetupElasticsearchServiceSetup | [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) |
| [getStartServices](./kibana-plugin-core-server.coresetup.getstartservices.md) | StartServicesAccessor<TPluginsStart, TStart>
| [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) |
| [http](./kibana-plugin-core-server.coresetup.http.md) | HttpServiceSetup & {
resources: HttpResources;
}
| [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) |
+| [i18n](./kibana-plugin-core-server.coresetup.i18n.md) | I18nServiceSetup
| [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) |
| [logging](./kibana-plugin-core-server.coresetup.logging.md) | LoggingServiceSetup
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) |
| [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | MetricsServiceSetup
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) |
| [savedObjects](./kibana-plugin-core-server.coresetup.savedobjects.md) | SavedObjectsServiceSetup
| [SavedObjectsServiceSetup](./kibana-plugin-core-server.savedobjectsservicesetup.md) |
diff --git a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md
new file mode 100644
index 0000000000000..2fe8e564e7ce5
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md
@@ -0,0 +1,17 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) > [getLocale](./kibana-plugin-core-server.i18nservicesetup.getlocale.md)
+
+## I18nServiceSetup.getLocale() method
+
+Return the locale currently in use.
+
+Signature:
+
+```typescript
+getLocale(): string;
+```
+Returns:
+
+`string`
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md
new file mode 100644
index 0000000000000..81caed287454e
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md
@@ -0,0 +1,17 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) > [getTranslationFiles](./kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md)
+
+## I18nServiceSetup.getTranslationFiles() method
+
+Return the absolute paths to translation files currently in use.
+
+Signature:
+
+```typescript
+getTranslationFiles(): string[];
+```
+Returns:
+
+`string[]`
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.md
new file mode 100644
index 0000000000000..f68b7877953e7
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.md
@@ -0,0 +1,20 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md)
+
+## I18nServiceSetup interface
+
+
+Signature:
+
+```typescript
+export interface I18nServiceSetup
+```
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [getLocale()](./kibana-plugin-core-server.i18nservicesetup.getlocale.md) | Return the locale currently in use. |
+| [getTranslationFiles()](./kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md) | Return the absolute paths to translation files currently in use. |
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md
index 68f5e72915556..adbb2460dc80a 100644
--- a/docs/development/core/server/kibana-plugin-core-server.md
+++ b/docs/development/core/server/kibana-plugin-core-server.md
@@ -89,6 +89,7 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [HttpServerInfo](./kibana-plugin-core-server.httpserverinfo.md) | |
| [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) | Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins don't have direct access to hapi
server and its primitives anymore. Moreover, plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood. This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins. If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs. |
| [HttpServiceStart](./kibana-plugin-core-server.httpservicestart.md) | |
+| [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) | |
| [IClusterClient](./kibana-plugin-core-server.iclusterclient.md) | Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via asScoped(...)
). |
| [IContextContainer](./kibana-plugin-core-server.icontextcontainer.md) | An object that handles registration of context providers and configuring handlers with context. |
| [ICspConfig](./kibana-plugin-core-server.icspconfig.md) | CSP configuration for use in Kibana. |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.executioncontextsearch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.executioncontextsearch.md
new file mode 100644
index 0000000000000..67dcb2fa44241
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.executioncontextsearch.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExecutionContextSearch](./kibana-plugin-plugins-data-public.executioncontextsearch.md)
+
+## ExecutionContextSearch type
+
+Signature:
+
+```typescript
+export declare type ExecutionContextSearch = {
+ filters?: Filter[];
+ query?: Query | Query[];
+ timeRange?: TimeRange;
+};
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionfunctionkibana.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionfunctionkibana.md
new file mode 100644
index 0000000000000..c91f2e8144ead
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionfunctionkibana.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExpressionFunctionKibana](./kibana-plugin-plugins-data-public.expressionfunctionkibana.md)
+
+## ExpressionFunctionKibana type
+
+Signature:
+
+```typescript
+export declare type ExpressionFunctionKibana = ExpressionFunctionDefinition<'kibana', ExpressionValueSearchContext | null, object, ExpressionValueSearchContext, ExecutionContext>;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md
new file mode 100644
index 0000000000000..97d2e81d45554
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md)
+
+## ExpressionFunctionKibanaContext type
+
+Signature:
+
+```typescript
+export declare type ExpressionFunctionKibanaContext = ExpressionFunctionDefinition<'kibana_context', KibanaContext | null, Arguments, Promise, ExecutionContext>;
+```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvaluesearchcontext.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md
similarity index 54%
rename from docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvaluesearchcontext.md
rename to docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md
index 6e38adde3ba91..4849d82b94a62 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvaluesearchcontext.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md
@@ -1,6 +1,6 @@
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionValueSearchContext](./kibana-plugin-plugins-expressions-server.expressionvaluesearchcontext.md)
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExpressionValueSearchContext](./kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md)
## ExpressionValueSearchContext type
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md
index c06c3c6f68492..f288573cd7abb 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md
@@ -9,5 +9,5 @@ Get field list by providing an index patttern (or spec)
Signature:
```typescript
-getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions) => Promise;
+getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise;
```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md
index aec84866b9e58..32bf6fc13b02c 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md
@@ -9,5 +9,5 @@ Get field list by providing { pattern }
Signature:
```typescript
-getFieldsForWildcard: (options?: GetFieldsOptions) => Promise;
+getFieldsForWildcard: (options: GetFieldsOptions) => Promise;
```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
index 34df8656e9175..57bb98de09ebd 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
@@ -26,8 +26,8 @@ export declare class IndexPatternsService
| [get](./kibana-plugin-plugins-data-public.indexpatternsservice.get.md) | | (id: string) => Promise<IndexPattern>
| Get an index pattern by id. Cache optimized |
| [getCache](./kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md) | | () => Promise<SavedObject<IndexPatternSavedObjectAttrs>[] | null | undefined>
| |
| [getDefault](./kibana-plugin-plugins-data-public.indexpatternsservice.getdefault.md) | | () => Promise<IndexPattern | null>
| Get default index pattern |
-| [getFieldsForIndexPattern](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md) | | (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions) => Promise<any>
| Get field list by providing an index patttern (or spec) |
-| [getFieldsForWildcard](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md) | | (options?: GetFieldsOptions) => Promise<any>
| Get field list by providing { pattern } |
+| [getFieldsForIndexPattern](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md) | | (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise<any>
| Get field list by providing an index patttern (or spec) |
+| [getFieldsForWildcard](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md) | | (options: GetFieldsOptions) => Promise<any>
| Get field list by providing { pattern } |
| [getIds](./kibana-plugin-plugins-data-public.indexpatternsservice.getids.md) | | (refresh?: boolean) => Promise<string[]>
| Get list of index pattern ids |
| [getIdsWithTitle](./kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md) | | (refresh?: boolean) => Promise<Array<{
id: string;
title: string;
}>>
| Get list of index pattern ids with titles |
| [getTitles](./kibana-plugin-plugins-data-public.indexpatternsservice.gettitles.md) | | (refresh?: boolean) => Promise<string[]>
| Get list of index pattern titles |
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.kibanacontext.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kibanacontext.md
similarity index 51%
rename from docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.kibanacontext.md
rename to docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kibanacontext.md
index 108533e8de357..cb8842c66761d 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.kibanacontext.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kibanacontext.md
@@ -1,6 +1,6 @@
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [KibanaContext](./kibana-plugin-plugins-expressions-public.kibanacontext.md)
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KibanaContext](./kibana-plugin-plugins-data-public.kibanacontext.md)
## KibanaContext type
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
index 255a9947858f6..bafcd8bdffff9 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
@@ -142,7 +142,11 @@
| [EsdslExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esdslexpressionfunctiondefinition.md) | |
| [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | |
| [EsRawResponseExpressionTypeDefinition](./kibana-plugin-plugins-data-public.esrawresponseexpressiontypedefinition.md) | |
+| [ExecutionContextSearch](./kibana-plugin-plugins-data-public.executioncontextsearch.md) | |
| [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) | |
+| [ExpressionFunctionKibana](./kibana-plugin-plugins-data-public.expressionfunctionkibana.md) | |
+| [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md) | |
+| [ExpressionValueSearchContext](./kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md) | |
| [FieldFormatId](./kibana-plugin-plugins-data-public.fieldformatid.md) | id type is needed for creating custom converters. |
| [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* |
| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | |
@@ -161,6 +165,7 @@
| [InputTimeRange](./kibana-plugin-plugins-data-public.inputtimerange.md) | |
| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) | |
| [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) | search source interface |
+| [KibanaContext](./kibana-plugin-plugins-data-public.kibanacontext.md) | |
| [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-public.parsedinterval.md) | |
| [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) | |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md
index 96e43ca836891..de6f4563b678a 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md
@@ -23,4 +23,5 @@ export interface QuerySuggestionGetFnArgs
| [selectionEnd](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md) | number
| |
| [selectionStart](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md) | number
| |
| [signal](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md) | AbortSignal
| |
+| [useTimeRange](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.usetimerange.md) | boolean
| |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.usetimerange.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.usetimerange.md
new file mode 100644
index 0000000000000..a29cddd81d885
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.usetimerange.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [useTimeRange](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.usetimerange.md)
+
+## QuerySuggestionGetFnArgs.useTimeRange property
+
+Signature:
+
+```typescript
+useTimeRange?: boolean;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md
index d1d20291a6799..b886aafcfc00f 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md
@@ -7,7 +7,7 @@
Signature:
```typescript
-SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "timeHistory" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "indicateNoData" | "onFiltersUpdated">, any> & {
- WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>;
+SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & {
+ WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>;
}
```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md
index 6ed20beb396f1..9a0c37c8edd38 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md
@@ -37,5 +37,6 @@ UI_SETTINGS: {
readonly INDEXPATTERN_PLACEHOLDER: "indexPattern:placeholder";
readonly FILTERS_PINNED_BY_DEFAULT: "filters:pinnedByDefault";
readonly FILTERS_EDITOR_SUGGEST_VALUES: "filterEditor:suggestValues";
+ readonly AUTOCOMPLETE_USE_TIMERANGE: "autocomplete:useTimeRange";
}
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.executioncontextsearch.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.executioncontextsearch.md
new file mode 100644
index 0000000000000..2f94dbe970d44
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.executioncontextsearch.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ExecutionContextSearch](./kibana-plugin-plugins-data-server.executioncontextsearch.md)
+
+## ExecutionContextSearch type
+
+Signature:
+
+```typescript
+export declare type ExecutionContextSearch = {
+ filters?: Filter[];
+ query?: Query | Query[];
+ timeRange?: TimeRange;
+};
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionfunctionkibana.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionfunctionkibana.md
new file mode 100644
index 0000000000000..d80ff78dd803c
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionfunctionkibana.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ExpressionFunctionKibana](./kibana-plugin-plugins-data-server.expressionfunctionkibana.md)
+
+## ExpressionFunctionKibana type
+
+Signature:
+
+```typescript
+export declare type ExpressionFunctionKibana = ExpressionFunctionDefinition<'kibana', ExpressionValueSearchContext | null, object, ExpressionValueSearchContext, ExecutionContext>;
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md
new file mode 100644
index 0000000000000..b67f7b8c4b60d
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md)
+
+## ExpressionFunctionKibanaContext type
+
+Signature:
+
+```typescript
+export declare type ExpressionFunctionKibanaContext = ExpressionFunctionDefinition<'kibana_context', KibanaContext | null, Arguments, Promise, ExecutionContext>;
+```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionvaluesearchcontext.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md
similarity index 54%
rename from docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionvaluesearchcontext.md
rename to docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md
index bf64dfe4c86f7..8015482ddec1e 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionvaluesearchcontext.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md
@@ -1,6 +1,6 @@
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionValueSearchContext](./kibana-plugin-plugins-expressions-public.expressionvaluesearchcontext.md)
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ExpressionValueSearchContext](./kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md)
## ExpressionValueSearchContext type
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getcapabilitiesforrollupindices.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getcapabilitiesforrollupindices.md
new file mode 100644
index 0000000000000..ba2efcc9b75ca
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getcapabilitiesforrollupindices.md
@@ -0,0 +1,28 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [getCapabilitiesForRollupIndices](./kibana-plugin-plugins-data-server.getcapabilitiesforrollupindices.md)
+
+## getCapabilitiesForRollupIndices() function
+
+Signature:
+
+```typescript
+export declare function getCapabilitiesForRollupIndices(indices: {
+ [key: string]: any;
+}): {
+ [key: string]: any;
+};
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| indices | {
[key: string]: any;
}
| |
+
+Returns:
+
+`{
+ [key: string]: any;
+}`
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md
index addd29916d81d..f0989097a727d 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md
@@ -15,6 +15,8 @@ getFieldsForWildcard(options: {
fieldCapsOptions?: {
allow_no_indices: boolean;
};
+ type?: string;
+ rollupIndex?: string;
}): Promise;
```
@@ -22,7 +24,7 @@ getFieldsForWildcard(options: {
| Parameter | Type | Description |
| --- | --- | --- |
-| options | {
pattern: string | string[];
metaFields?: string[];
fieldCapsOptions?: {
allow_no_indices: boolean;
};
}
| |
+| options | {
pattern: string | string[];
metaFields?: string[];
fieldCapsOptions?: {
allow_no_indices: boolean;
};
type?: string;
rollupIndex?: string;
}
| |
Returns:
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.start.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.start.md
index e7c331bad64e8..6528b1c213cca 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.start.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.start.md
@@ -8,7 +8,7 @@
```typescript
start(core: CoreStart, { fieldFormats, logger }: IndexPatternsServiceStartDeps): {
- indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract) => Promise;
+ indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract, elasticsearchClient: ElasticsearchClient) => Promise;
};
```
@@ -22,6 +22,6 @@ start(core: CoreStart, { fieldFormats, logger }: IndexPatternsServiceStartDeps):
Returns:
`{
- indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract) => Promise;
+ indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract, elasticsearchClient: ElasticsearchClient) => Promise;
}`
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.kibanacontext.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kibanacontext.md
similarity index 51%
rename from docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.kibanacontext.md
rename to docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kibanacontext.md
index 023748173e7dd..1ddc43c633b26 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.kibanacontext.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kibanacontext.md
@@ -1,6 +1,6 @@
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [KibanaContext](./kibana-plugin-plugins-expressions-server.kibanacontext.md)
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KibanaContext](./kibana-plugin-plugins-data-server.kibanacontext.md)
## KibanaContext type
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
index 82d0a5a3182b9..8957f6d0f06b4 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
@@ -28,6 +28,7 @@
| Function | Description |
| --- | --- |
+| [getCapabilitiesForRollupIndices(indices)](./kibana-plugin-plugins-data-server.getcapabilitiesforrollupindices.md) | |
| [getDefaultSearchParams(uiSettingsClient)](./kibana-plugin-plugins-data-server.getdefaultsearchparams.md) | |
| [getShardTimeout(config)](./kibana-plugin-plugins-data-server.getshardtimeout.md) | |
| [getTime(indexPattern, timeRange, options)](./kibana-plugin-plugins-data-server.gettime.md) | |
@@ -77,6 +78,7 @@
| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | |
| [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | |
+| [mergeCapabilitiesWithFields](./kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md) | |
| [search](./kibana-plugin-plugins-data-server.search.md) | |
| [UI\_SETTINGS](./kibana-plugin-plugins-data-server.ui_settings.md) | |
@@ -88,6 +90,10 @@
| [AggGroupName](./kibana-plugin-plugins-data-server.agggroupname.md) | |
| [AggParam](./kibana-plugin-plugins-data-server.aggparam.md) | |
| [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-server.esaggsexpressionfunctiondefinition.md) | |
+| [ExecutionContextSearch](./kibana-plugin-plugins-data-server.executioncontextsearch.md) | |
+| [ExpressionFunctionKibana](./kibana-plugin-plugins-data-server.expressionfunctionkibana.md) | |
+| [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md) | |
+| [ExpressionValueSearchContext](./kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md) | |
| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | |
| [Filter](./kibana-plugin-plugins-data-server.filter.md) | |
| [IAggConfig](./kibana-plugin-plugins-data-server.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. |
@@ -96,6 +102,7 @@
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [IFieldParamType](./kibana-plugin-plugins-data-server.ifieldparamtype.md) | |
| [IMetricAggType](./kibana-plugin-plugins-data-server.imetricaggtype.md) | |
+| [KibanaContext](./kibana-plugin-plugins-data-server.kibanacontext.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | |
| [Query](./kibana-plugin-plugins-data-server.query.md) | |
| [TabbedAggRow](./kibana-plugin-plugins-data-server.tabbedaggrow.md) | \* |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md
new file mode 100644
index 0000000000000..2880e2d0d8f2c
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [mergeCapabilitiesWithFields](./kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md)
+
+## mergeCapabilitiesWithFields variable
+
+Signature:
+
+```typescript
+mergeCapabilitiesWithFields: (rollupIndexCapabilities: {
+ [key: string]: any;
+}, fieldsFromFieldCapsApi: {
+ [key: string]: any;
+}, previousFields?: FieldDescriptor[]) => FieldDescriptor[]
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md
index 139c5794f0146..43129891c5412 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md
@@ -11,7 +11,7 @@ setup(core: CoreSetup, { expressio
__enhance: (enhancements: DataEnhancements) => void;
search: ISearchSetup;
fieldFormats: {
- register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number;
+ register: (customFieldFormat: import("../common").FieldFormatInstanceType) => number;
};
};
```
@@ -29,7 +29,7 @@ setup(core: CoreSetup, { expressio
__enhance: (enhancements: DataEnhancements) => void;
search: ISearchSetup;
fieldFormats: {
- register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number;
+ register: (customFieldFormat: import("../common").FieldFormatInstanceType) => number;
};
}`
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md
index 03d3485fce9ee..8a3dbe5a6350c 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md
@@ -12,7 +12,7 @@ start(core: CoreStart): {
fieldFormatServiceFactory: (uiSettings: import("src/core/server").IUiSettingsClient) => Promise;
};
indexPatterns: {
- indexPatternsServiceFactory: (savedObjectsClient: Pick) => Promise;
+ indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: import("src/core/server").ElasticsearchClient) => Promise;
};
search: ISearchStart>;
};
@@ -31,7 +31,7 @@ start(core: CoreStart): {
fieldFormatServiceFactory: (uiSettings: import("src/core/server").IUiSettingsClient) => Promise;
};
indexPatterns: {
- indexPatternsServiceFactory: (savedObjectsClient: Pick) => Promise;
+ indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: import("src/core/server").ElasticsearchClient) => Promise;
};
search: ISearchStart>;
}`
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md
index 2d4ce75b956df..c2edc64f292d2 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md
@@ -37,5 +37,6 @@ UI_SETTINGS: {
readonly INDEXPATTERN_PLACEHOLDER: "indexPattern:placeholder";
readonly FILTERS_PINNED_BY_DEFAULT: "filters:pinnedByDefault";
readonly FILTERS_EDITOR_SUGGEST_VALUES: "filterEditor:suggestValues";
+ readonly AUTOCOMPLETE_USE_TIMERANGE: "autocomplete:useTimeRange";
}
```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md
index 2a1a78b8fcb1a..86d24534f7a44 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md
@@ -9,7 +9,7 @@
Signature:
```typescript
-export interface ExecutionContext
+export interface ExecutionContext
```
## Properties
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana.md
deleted file mode 100644
index abe8e0ae161ad..0000000000000
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md) > [kibana](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana.md)
-
-## ExpressionFunctionDefinitions.kibana property
-
-Signature:
-
-```typescript
-kibana: ExpressionFunctionKibana;
-```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana_context.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana_context.md
deleted file mode 100644
index 4b58fd84e160d..0000000000000
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana_context.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md) > [kibana\_context](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana_context.md)
-
-## ExpressionFunctionDefinitions.kibana\_context property
-
-Signature:
-
-```typescript
-kibana_context: ExpressionFunctionKibanaContext;
-```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md
index 53f090ea30c3f..c6e00842a31e6 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md
@@ -20,8 +20,6 @@ export interface ExpressionFunctionDefinitions
| [cumulative\_sum](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.cumulative_sum.md) | ExpressionFunctionCumulativeSum
| |
| [derivative](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.derivative.md) | ExpressionFunctionDerivative
| |
| [font](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.font.md) | ExpressionFunctionFont
| |
-| [kibana\_context](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana_context.md) | ExpressionFunctionKibanaContext
| |
-| [kibana](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana.md) | ExpressionFunctionKibana
| |
| [moving\_average](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.moving_average.md) | ExpressionFunctionMovingAverage
| |
| [theme](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.theme.md) | ExpressionFunctionTheme
| |
| [var\_set](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.var_set.md) | ExpressionFunctionVarSet
| |
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctionkibana.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctionkibana.md
deleted file mode 100644
index 8ccf48ba28527..0000000000000
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctionkibana.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunctionKibana](./kibana-plugin-plugins-expressions-public.expressionfunctionkibana.md)
-
-## ExpressionFunctionKibana type
-
-Signature:
-
-```typescript
-export declare type ExpressionFunctionKibana = ExpressionFunctionDefinition<'kibana', ExpressionValueSearchContext | null, object, ExpressionValueSearchContext>;
-```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.md
index e2ad6215e25d0..2dfc67d2af5fa 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.md
@@ -21,7 +21,7 @@ export interface IExpressionLoaderParams
| [disableCaching](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.disablecaching.md) | boolean
| |
| [inspectorAdapters](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.inspectoradapters.md) | Adapters
| |
| [onRenderError](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.onrendererror.md) | RenderErrorHandlerFnType
| |
-| [searchContext](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md) | ExecutionContextSearch
| |
+| [searchContext](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md) | SerializableState
| |
| [searchSessionId](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchsessionid.md) | string
| |
| [uiState](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.uistate.md) | unknown
| |
| [variables](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.variables.md) | Record<string, any>
| |
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md
index 523d0c562f7ca..6b5fad950c4e9 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-searchContext?: ExecutionContextSearch;
+searchContext?: SerializableState;
```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.kibana_context_name.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.kibana_context_name.md
deleted file mode 100644
index e568db84f383d..0000000000000
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.kibana_context_name.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [KIBANA\_CONTEXT\_NAME](./kibana-plugin-plugins-expressions-public.kibana_context_name.md)
-
-## KIBANA\_CONTEXT\_NAME type
-
-Signature:
-
-```typescript
-export declare type KIBANA_CONTEXT_NAME = 'kibana_context';
-```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.md
index db09f966e2fa5..a03ea32482011 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.md
@@ -99,7 +99,6 @@
| [ExpressionAstExpression](./kibana-plugin-plugins-expressions-public.expressionastexpression.md) | |
| [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md) | |
| [ExpressionAstNode](./kibana-plugin-plugins-expressions-public.expressionastnode.md) | |
-| [ExpressionFunctionKibana](./kibana-plugin-plugins-expressions-public.expressionfunctionkibana.md) | |
| [ExpressionRendererComponent](./kibana-plugin-plugins-expressions-public.expressionrenderercomponent.md) | |
| [ExpressionsServiceSetup](./kibana-plugin-plugins-expressions-public.expressionsservicesetup.md) | The public contract that ExpressionsService
provides to other plugins in Kibana Platform in \*setup\* life-cycle. |
| [ExpressionsSetup](./kibana-plugin-plugins-expressions-public.expressionssetup.md) | Expressions public setup contract, extends [ExpressionsServiceSetup](./kibana-plugin-plugins-expressions-public.expressionsservicesetup.md) |
@@ -110,13 +109,10 @@
| [ExpressionValueFilter](./kibana-plugin-plugins-expressions-public.expressionvaluefilter.md) | Represents an object that is a Filter. |
| [ExpressionValueNum](./kibana-plugin-plugins-expressions-public.expressionvaluenum.md) | |
| [ExpressionValueRender](./kibana-plugin-plugins-expressions-public.expressionvaluerender.md) | Represents an object that is intended to be rendered. |
-| [ExpressionValueSearchContext](./kibana-plugin-plugins-expressions-public.expressionvaluesearchcontext.md) | |
| [ExpressionValueUnboxed](./kibana-plugin-plugins-expressions-public.expressionvalueunboxed.md) | |
| [FontLabel](./kibana-plugin-plugins-expressions-public.fontlabel.md) | This type contains a unions of all supported font labels, or the the name of the font the user would see in a UI. |
| [FontValue](./kibana-plugin-plugins-expressions-public.fontvalue.md) | This type contains a union of all supported font values, equivalent to the CSS font-value
property. |
| [InterpreterErrorType](./kibana-plugin-plugins-expressions-public.interpretererrortype.md) | |
-| [KIBANA\_CONTEXT\_NAME](./kibana-plugin-plugins-expressions-public.kibana_context_name.md) | |
-| [KibanaContext](./kibana-plugin-plugins-expressions-public.kibanacontext.md) | |
| [KnownTypeToString](./kibana-plugin-plugins-expressions-public.knowntypetostring.md) | Map the type of the generic to a string-based representation of the type.If the provided generic is its own type interface, we use the value of the type
key as a string literal type for it. |
| [PointSeries](./kibana-plugin-plugins-expressions-public.pointseries.md) | A PointSeries
is a unique structure that represents dots on a chart. |
| [PointSeriesColumnName](./kibana-plugin-plugins-expressions-public.pointseriescolumnname.md) | Allowed column names in a PointSeries |
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md
index 047879fd99255..e2547cc9470d1 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md
@@ -9,7 +9,7 @@
Signature:
```typescript
-export interface ExecutionContext
+export interface ExecutionContext
```
## Properties
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana.md
deleted file mode 100644
index 8e6d189f8f450..0000000000000
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md) > [kibana](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana.md)
-
-## ExpressionFunctionDefinitions.kibana property
-
-Signature:
-
-```typescript
-kibana: ExpressionFunctionKibana;
-```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana_context.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana_context.md
deleted file mode 100644
index f9e248ad6d913..0000000000000
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana_context.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md) > [kibana\_context](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana_context.md)
-
-## ExpressionFunctionDefinitions.kibana\_context property
-
-Signature:
-
-```typescript
-kibana_context: ExpressionFunctionKibanaContext;
-```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md
index 6f152bb10b37e..219678244951b 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md
@@ -20,8 +20,6 @@ export interface ExpressionFunctionDefinitions
| [cumulative\_sum](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.cumulative_sum.md) | ExpressionFunctionCumulativeSum
| |
| [derivative](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.derivative.md) | ExpressionFunctionDerivative
| |
| [font](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.font.md) | ExpressionFunctionFont
| |
-| [kibana\_context](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana_context.md) | ExpressionFunctionKibanaContext
| |
-| [kibana](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana.md) | ExpressionFunctionKibana
| |
| [moving\_average](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.moving_average.md) | ExpressionFunctionMovingAverage
| |
| [theme](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.theme.md) | ExpressionFunctionTheme
| |
| [var\_set](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.var_set.md) | ExpressionFunctionVarSet
| |
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctionkibana.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctionkibana.md
deleted file mode 100644
index aac2ae1c3ca4e..0000000000000
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunctionkibana.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunctionKibana](./kibana-plugin-plugins-expressions-server.expressionfunctionkibana.md)
-
-## ExpressionFunctionKibana type
-
-Signature:
-
-```typescript
-export declare type ExpressionFunctionKibana = ExpressionFunctionDefinition<'kibana', ExpressionValueSearchContext | null, object, ExpressionValueSearchContext>;
-```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.kibana_context_name.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.kibana_context_name.md
deleted file mode 100644
index bd47c52e0d5ce..0000000000000
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.kibana_context_name.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [KIBANA\_CONTEXT\_NAME](./kibana-plugin-plugins-expressions-server.kibana_context_name.md)
-
-## KIBANA\_CONTEXT\_NAME type
-
-Signature:
-
-```typescript
-export declare type KIBANA_CONTEXT_NAME = 'kibana_context';
-```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md
index 9e2189dad2732..5f7f373cd927f 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md
@@ -83,7 +83,6 @@
| [ExpressionAstExpression](./kibana-plugin-plugins-expressions-server.expressionastexpression.md) | |
| [ExpressionAstFunction](./kibana-plugin-plugins-expressions-server.expressionastfunction.md) | |
| [ExpressionAstNode](./kibana-plugin-plugins-expressions-server.expressionastnode.md) | |
-| [ExpressionFunctionKibana](./kibana-plugin-plugins-expressions-server.expressionfunctionkibana.md) | |
| [ExpressionsServerSetup](./kibana-plugin-plugins-expressions-server.expressionsserversetup.md) | |
| [ExpressionsServerStart](./kibana-plugin-plugins-expressions-server.expressionsserverstart.md) | |
| [ExpressionValue](./kibana-plugin-plugins-expressions-server.expressionvalue.md) | |
@@ -93,13 +92,10 @@
| [ExpressionValueFilter](./kibana-plugin-plugins-expressions-server.expressionvaluefilter.md) | Represents an object that is a Filter. |
| [ExpressionValueNum](./kibana-plugin-plugins-expressions-server.expressionvaluenum.md) | |
| [ExpressionValueRender](./kibana-plugin-plugins-expressions-server.expressionvaluerender.md) | Represents an object that is intended to be rendered. |
-| [ExpressionValueSearchContext](./kibana-plugin-plugins-expressions-server.expressionvaluesearchcontext.md) | |
| [ExpressionValueUnboxed](./kibana-plugin-plugins-expressions-server.expressionvalueunboxed.md) | |
| [FontLabel](./kibana-plugin-plugins-expressions-server.fontlabel.md) | This type contains a unions of all supported font labels, or the the name of the font the user would see in a UI. |
| [FontValue](./kibana-plugin-plugins-expressions-server.fontvalue.md) | This type contains a union of all supported font values, equivalent to the CSS font-value
property. |
| [InterpreterErrorType](./kibana-plugin-plugins-expressions-server.interpretererrortype.md) | |
-| [KIBANA\_CONTEXT\_NAME](./kibana-plugin-plugins-expressions-server.kibana_context_name.md) | |
-| [KibanaContext](./kibana-plugin-plugins-expressions-server.kibanacontext.md) | |
| [KnownTypeToString](./kibana-plugin-plugins-expressions-server.knowntypetostring.md) | Map the type of the generic to a string-based representation of the type.If the provided generic is its own type interface, we use the value of the type
key as a string literal type for it. |
| [PointSeries](./kibana-plugin-plugins-expressions-server.pointseries.md) | A PointSeries
is a unique structure that represents dots on a chart. |
| [PointSeriesColumnName](./kibana-plugin-plugins-expressions-server.pointseriescolumnname.md) | Allowed column names in a PointSeries |
diff --git a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.addtriggeraction.md b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.addtriggeraction.md
index ba9060e01e57d..5a1ab83551d34 100644
--- a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.addtriggeraction.md
+++ b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.addtriggeraction.md
@@ -11,5 +11,5 @@
Signature:
```typescript
-readonly addTriggerAction: (triggerId: T, action: ActionDefinition | Action) => void;
+readonly addTriggerAction: (triggerId: T, action: ActionDefinition | Action) => void;
```
diff --git a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.getaction.md b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.getaction.md
index 3e433809f9471..5b0b3eea01cb1 100644
--- a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.getaction.md
+++ b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.getaction.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-readonly getAction: >(id: string) => Action, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">;
+readonly getAction: >(id: string) => Action, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">;
```
diff --git a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggeractions.md b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggeractions.md
index 83afcab29689d..2dda422046318 100644
--- a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggeractions.md
+++ b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggeractions.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-readonly getTriggerActions: (triggerId: T) => Action[];
+readonly getTriggerActions: (triggerId: T) => Action[];
```
diff --git a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggercompatibleactions.md b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggercompatibleactions.md
index 879f5a3d8628a..e087753726a8a 100644
--- a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggercompatibleactions.md
+++ b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggercompatibleactions.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-readonly getTriggerCompatibleActions: (triggerId: T, context: TriggerContextMapping[T]) => Promise[]>;
+readonly getTriggerCompatibleActions: (triggerId: T, context: TriggerContextMapping[T]) => Promise[]>;
```
diff --git a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.md b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.md
index 7fade7c4c841b..f9eb693b492f7 100644
--- a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.md
+++ b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.md
@@ -21,19 +21,19 @@ export declare class UiActionsService
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [actions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.actions.md) | | ActionRegistry
| |
-| [addTriggerAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.addtriggeraction.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T, action: ActionDefinition<TriggerContextMapping[T]> | Action<TriggerContextMapping[T], "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">) => void
| addTriggerAction
is similar to attachAction
as it attaches action to a trigger, but it also registers the action, if it has not been registered, yet.addTriggerAction
also infers better typing of the action
argument. |
+| [addTriggerAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.addtriggeraction.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T, action: ActionDefinition<TriggerContextMapping[T]> | Action<TriggerContextMapping[T], "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">) => void
| addTriggerAction
is similar to attachAction
as it attaches action to a trigger, but it also registers the action, if it has not been registered, yet.addTriggerAction
also infers better typing of the action
argument. |
| [attachAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.attachaction.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T, actionId: string) => void
| |
| [clear](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.clear.md) | | () => void
| Removes all registered triggers and actions. |
| [detachAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.detachaction.md) | | (triggerId: TriggerId, actionId: string) => void
| |
| [executeTriggerActions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.executetriggeractions.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T, context: TriggerContext<T>) => Promise<void>
| |
| [executionService](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.executionservice.md) | | UiActionsExecutionService
| |
| [fork](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.fork.md) | | () => UiActionsService
| "Fork" a separate instance of UiActionsService
that inherits all existing triggers and actions, but going forward all new triggers and actions added to this instance of UiActionsService
are only available within this instance. |
-| [getAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.getaction.md) | | <T extends ActionDefinition<{}>>(id: string) => Action<ActionContext<T>, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">
| |
+| [getAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.getaction.md) | | <T extends ActionDefinition<{}>>(id: string) => Action<ActionContext<T>, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">
| |
| [getTrigger](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettrigger.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T) => TriggerContract<T>
| |
-| [getTriggerActions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggeractions.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T) => Action<TriggerContextMapping[T], "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">[]
| |
-| [getTriggerCompatibleActions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggercompatibleactions.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T, context: TriggerContextMapping[T]) => Promise<Action<TriggerContextMapping[T], "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">[]>
| |
+| [getTriggerActions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggeractions.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T) => Action<TriggerContextMapping[T], "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">[]
| |
+| [getTriggerCompatibleActions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.gettriggercompatibleactions.md) | | <T extends "" | "SELECT_RANGE_TRIGGER" | "VALUE_CLICK_TRIGGER" | "FILTER_TRIGGER" | "VISUALIZE_FIELD_TRIGGER" | "VISUALIZE_GEO_FIELD_TRIGGER" | "CONTEXT_MENU_TRIGGER" | "PANEL_BADGE_TRIGGER" | "PANEL_NOTIFICATION_TRIGGER">(triggerId: T, context: TriggerContextMapping[T]) => Promise<Action<TriggerContextMapping[T], "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">[]>
| |
| [hasAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.hasaction.md) | | (actionId: string) => boolean
| |
-| [registerAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.registeraction.md) | | <A extends ActionDefinition<{}>>(definition: A) => Action<ActionContext<A>, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">
| |
+| [registerAction](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.registeraction.md) | | <A extends ActionDefinition<{}>>(definition: A) => Action<ActionContext<A>, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">
| |
| [registerTrigger](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.registertrigger.md) | | (trigger: Trigger) => void
| |
| [triggers](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.triggers.md) | | TriggerRegistry
| |
| [triggerToActions](./kibana-plugin-plugins-ui_actions-public.uiactionsservice.triggertoactions.md) | | TriggerToActionsRegistry
| |
diff --git a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.registeraction.md b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.registeraction.md
index eeda7b503037d..bd340eb76fbac 100644
--- a/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.registeraction.md
+++ b/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsservice.registeraction.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-readonly registerAction: >(definition: A) => Action, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK">;
+readonly registerAction: >(definition: A) => Action, "" | "ACTION_VISUALIZE_FIELD" | "ACTION_VISUALIZE_GEO_FIELD" | "ACTION_VISUALIZE_LENS_FIELD" | "ACTION_GLOBAL_APPLY_FILTER" | "ACTION_SELECT_RANGE" | "ACTION_VALUE_CLICK" | "ACTION_CUSTOMIZE_PANEL" | "ACTION_ADD_PANEL" | "openInspector" | "deletePanel" | "editPanel" | "togglePanel" | "replacePanel" | "clonePanel" | "addToFromLibrary" | "unlinkFromLibrary" | "ACTION_LIBRARY_NOTIFICATION">;
```
diff --git a/docs/glossary.asciidoc b/docs/glossary.asciidoc
index be24402170bbe..ff03a60173961 100644
--- a/docs/glossary.asciidoc
+++ b/docs/glossary.asciidoc
@@ -330,6 +330,11 @@ See
{kibana-ref}/xpack-spaces.html[Spaces].
// end::space-def[]
+[[glossary-stack-alerts]] stack alerts ::
+// tag::stack-alert-def[]
+The general purpose alert types {kib} provides out of the box. Index threshold and geo alerts are currently the two stack alert types.
+// end::stack-alert-def[]
+
[float]
[[t_glos]]
diff --git a/docs/maps/images/create_phrase_filter.png b/docs/maps/images/create_phrase_filter.png
deleted file mode 100644
index 720aecf44d9fa..0000000000000
Binary files a/docs/maps/images/create_phrase_filter.png and /dev/null differ
diff --git a/docs/maps/images/create_spatial_filter.png b/docs/maps/images/create_spatial_filter.png
index abb52bd0b5b0a..21614aa0f4e24 100644
Binary files a/docs/maps/images/create_spatial_filter.png and b/docs/maps/images/create_spatial_filter.png differ
diff --git a/docs/maps/images/gs_add_cloropeth_layer.png b/docs/maps/images/gs_add_cloropeth_layer.png
index 2800a5a2d2584..1528f404026f2 100644
Binary files a/docs/maps/images/gs_add_cloropeth_layer.png and b/docs/maps/images/gs_add_cloropeth_layer.png differ
diff --git a/docs/maps/images/gs_create_new_map.png b/docs/maps/images/gs_create_new_map.png
deleted file mode 100644
index bf5fd56ceba13..0000000000000
Binary files a/docs/maps/images/gs_create_new_map.png and /dev/null differ
diff --git a/docs/maps/import-geospatial-data.asciidoc b/docs/maps/import-geospatial-data.asciidoc
index ff0c9bf1f72ba..fb4250368086e 100644
--- a/docs/maps/import-geospatial-data.asciidoc
+++ b/docs/maps/import-geospatial-data.asciidoc
@@ -26,7 +26,7 @@ Choose an import tool based on the format of your geospatial data.
*Upload GeoJSON* indexes GeoJSON features as a geo_point or geo_shape.
-. <>.
+. <>.
. Click *Add layer*.
. Select *Upload GeoJSON*.
. Use the file chooser to select a GeoJSON file.
diff --git a/docs/maps/maps-getting-started.asciidoc b/docs/maps/maps-getting-started.asciidoc
index 5c6cd87b235e1..32a81c8e65f56 100644
--- a/docs/maps/maps-getting-started.asciidoc
+++ b/docs/maps/maps-getting-started.asciidoc
@@ -1,231 +1,197 @@
[role="xpack"]
[[maps-getting-started]]
-== Get started with Maps
+== Create a map with multiple layers and data sources
++++
-Get started
+Create a multilayer map
++++
+If you are new to **Maps**, this tutorial is a good place to start.
+It guides you through the common steps for working with your location data.
+You'll learn to:
-You work with Maps by adding layers. The data for a layer can come from
-sources such as {es} documents, vector sources, tile map services, web map
-services, and more. You can symbolize the data in different ways.
-For example, you might show which airports have the longest flight
-delays by using circles from small to big. Or,
-you might show the amount of web log traffic by shading countries from
-light to dark.
+- Create a map with multiple layers and data sources
+- Use symbols, colors, and labels to style data values
+- Embed a map in a dashboard
+- Search across panels in your dashboard
-[role="screenshot"]
-image::maps/images/sample_data_web_logs.png[]
-
-[[maps-read-only-access]]
-NOTE: If you have insufficient privileges to create or save maps, a read-only icon
-appears in the application header. The buttons to create new maps or edit
-existing maps won't be visible. For more information on granting access to
-Kibana see <>.
+When you complete this tutorial, you’ll have a map that looks like this:
[role="screenshot"]
-image::maps/images/read-only-badge.png[Example of Maps' read only access indicator in Kibana's header]
+image::maps/images/sample_data_web_logs.png[]
[float]
=== Prerequisites
-Before you start this tutorial, <>. Each
-sample data set includes a map to go along with the data. Once you've added the data, open Maps and
-explore the different layers of the *[Logs] Total Requests and Bytes* map.
-You'll re-create this map in this tutorial.
-[float]
-=== Take-away skills
-In this tutorial, you'll learn to:
+- If you don’t already have {kib}, set it up with https://www.elastic.co/cloud/elasticsearch-service/signup?baymax=docs-body&elektra=docs[our free trial].
+- This tutorial requires the <>. The sample data includes a [Logs] Total Requests and Bytes map, which you’ll re-create in this tutorial.
+- You must have the correct privileges for creating a map.
+If you don't have sufficient privileges to create or save maps,
+a read-only icon appears in the toolbar. For more information,
+refer to <>.
-* Create a multi-layer map
-* Connect a layer to a data source
-* Use symbols, colors, and labels to style a layer
-* Create layers for {es} data
-
-[role="xpack"]
+[float]
[[maps-create]]
-=== Create a map
-
-The first thing to do is to create a new map.
+=== Step 1. Create a map
-. If you haven't already, open the main menu, then click *Maps*.
-. On the maps list page, click *Create map*.
+. Open the main menu, and then click *Dashboard*.
+. Click **Create dashboard**.
. Set the time range to *Last 7 days*.
-+
-A new map is created using a base tile layer.
-+
-[role="screenshot"]
-image::maps/images/gs_create_new_map.png[]
+. Click **Create new**.
+. Click **Maps**.
-[role="xpack"]
+[float]
[[maps-add-choropleth-layer]]
-=== Add a choropleth layer
+=== Step 2. Add a choropleth layer
-Now that you have a map, you'll want to add layers to it.
The first layer you'll add is a choropleth layer to shade world countries
-by web log traffic. Darker shades symbolize countries with more web log traffic,
-and lighter shades symbolize countries with less traffic.
-
-. Click *Add layer*.
-. Select *Choropleth*.
-. From the *Layer* dropdown menu, select *World Countries*.
-. Under *Statistics source*, set *Index pattern* to *kibana_sample_data_logs*.
-. Set *Join field* to *geo.src*.
-. Click the *Add layer* button.
-. Set *Name* to `Total Requests by Country`.
-. Set *Opacity* to 50%.
-. Click *Add* under *Tooltip fields*.
-. In the popover, select *ISO 3166-1 alpha-2 code* and *name* and click *Add*.
-. Under *Fill color*, select the grey color ramp.
-. Under *Border color*, change the selected color to *white*.
-. Click *Save & close*.
+by web log traffic. Darker shades will symbolize countries with more web log traffic,
+and lighter shades will symbolize countries with less traffic.
+
+. Click **Add layer**, and then click **Choropleth**.
+
+. From the **Layer** dropdown menu, select **World Countries**.
+
+. In **Statistics source**, set:
+** **Index pattern** to **kibana_sample_data_logs**
+** **Join field** to **geo.src**
+
+. Click **Add layer**.
+
+. In **Layer settings**, set:
+
+** **Name** to `Total Requests by Country`
+** **Opacity** to 50%
+
+. Add a Tooltip field:
+
+** Select **ISO 3166-1 alpha-2 code** and **name**.
+** Click **Add**.
+
+. In **Layer style**, set:
+
+** **Fill color** to the grey color ramp
+** **Border color** to white
+
+. Click **Save & close**.
+
Your map now looks like this:
+
[role="screenshot"]
image::maps/images/gs_add_cloropeth_layer.png[]
-[role="xpack"]
+[float]
[[maps-add-elasticsearch-layer]]
-=== Add layers for the {es} data
-
-To avoid overwhelming the user with too much data at once, you'll add two layers for {es} data.
+=== Step 3. Add layers for the Elasticsearch data
-* The first layer will display individual documents.
-The layer will appear when the user zooms in the map to show smaller regions.
-* The second layer will display aggregated data that represents many documents.
-The layer will appear when the user zooms out the map to show larger amounts of the globe.
+To avoid overwhelming the user with too much data at once, you'll add two layers
+for the Elasticsearch data. The first layer will display individual documents
+when users zoom in on the map. The second layer will
+display aggregated data when users zoom the map out.
-==== Add a vector layer to display individual documents
+[float]
+==== Add a layer for individual documents
This layer displays web log documents as points.
-The layer is only visible when users zoom in the map past zoom level 9.
-
-. Click *Add layer*.
-. Select *Documents*.
-. Set *Index pattern* to *kibana_sample_data_logs*.
-. Click the *Add layer* button.
-. Set *Name* to `Actual Requests`.
-. Set *Visibilty* to the range [9, 24].
-. Set *Opacity* to 100%.
-. Click *Add* under *Tooltip fields*.
-. In the popover, select *clientip*, *timestamp*, *host*, *request*, *response*, *machine.os*, *agent*, and *bytes* and click *Add*.
-. Set *Fill color* to *#2200ff*.
-. Click *Save & close*.
+The layer is only visible when users zoom in.
+
+. Click **Add layer**, and then click **Documents**.
+
+. Set **Index pattern** to **kibana_sample_data_logs**.
+
+. Set **Scaling** to *Limits results to 10000.*
+
+. Click **Add layer**.
+
+. In **Layer settings**, set:
+** **Name** to `Actual Requests`
+** **Visibilty** to the range [9, 24]
+** **Opacity** to 100%
+
+. Add a tooltip field and select **agent**, **bytes**, **clientip**, **host**,
+**machine.os**, **request**, **response**, and **timestamp**.
+
+. In **Layer style**, set **Fill color** to **#2200FF**.
+
+. Click **Save & close**.
+
-Your map now looks like this between zoom levels 9 and 24:
+Your map will look like this from zoom level 9 to 24:
+
[role="screenshot"]
image::maps/images/gs_add_es_document_layer.png[]
-==== Add a vector layer to display aggregated data
-
-Aggregations group {es} documents into grids. You can calculate metrics
-for each gridded cell.
+[float]
+==== Add a layer for aggregated data
-You'll create a layer for aggregated data and make it visible only when the map
-is zoomed out past zoom level 9. Darker colors will symbolize grids
+You'll create a layer for {ref}/search-aggregations.html[aggregated data] and make it visible only when the map
+is zoomed out. Darker colors will symbolize grids
with more web log traffic, and lighter colors will symbolize grids with less
traffic. Larger circles will symbolize grids with
more total bytes transferred, and smaller circles will symbolize
grids with less bytes transferred.
-[role="screenshot"]
-image::maps/images/grid_metrics_both.png[]
-
-===== Add the layer
-
-. Click *Add layer*.
-. Select *Clusters and grids*.
-. Set *Index pattern* to *kibana_sample_data_logs*.
-. Click the *Add layer* button.
-. Set *Name* to `Total Requests and Bytes`.
-. Set *Visibility* to the range [0, 9].
-. Set *Opacity* to 100%.
-
-===== Configure the aggregation metrics
-
-. Click *Add metric* under of *Metrics* label.
-. Select *Sum* in the aggregation select.
-. Select *bytes* in the field select.
-
-===== Set the layer style
-
-. In *Layer style*, change *Symbol size*:
- .. Set *Min size* to 7.
- .. Set *Max size* to 25.
- .. Change the field select from *count* to *sum of bytes*.
-. Click *Save & close* button.
-+
-Your map now looks like this between zoom levels 0 and 9:
+. Click **Add layer**, and select **Clusters and grids**.
+. Set **Index pattern** to **kibana_sample_data_logs**.
+. Click **Add layer**.
+. In **Layer settings**, set:
+** **Name** to `Total Requests and Bytes`
+** **Visibility** to the range [0, 9]
+** **Opacity** to 100%
+. Add a metric with:
+** **Aggregation** set to **Sum**
+** **Field** set to **bytes**
+. In **Layer style**, change **Symbol size**:
+** Set the field select to *sum bytes*.
+** Set the min size to 7 and the max size to 25 px.
+. Click **Save & close** button.
++
+Your map will look like this between zoom levels 0 and 9:
+
[role="screenshot"]
image::maps/images/sample_data_web_logs.png[]
-[role="xpack"]
+[float]
[[maps-save]]
-=== Save the map
-Now that your map is complete, you'll want to save it so others can use it.
+=== Step 4. Save the map
+Now that your map is complete, save it and return to the dashboard.
-. In the application toolbar, click *Save*.
+. In the toolbar, click *Save*.
. Enter `Tutorial web logs map` for the title.
-. Click *Save*.
-+
-You have completed the steps for re-creating the sample data map.
-
-*Next steps:*
+. Ensure *Add to Dashboard after saving* is enabled.
+. Click *Save and return*.
-* Continue with this tutorial and <>.
-* Create a map using your own data. You might find these resources helpful:
-** <>
-** <>
-** <>
-
-[role="xpack"]
+[float]
[[maps-embedding]]
-=== Add the map to a dashboard
-You can add your saved map to a {kibana-ref}/dashboard.html[dashboard] and view your geospatial data alongside bar charts, pie charts, and other visualizations.
+=== Step 5. Explore your data from the dashboard
-. Open the main menu, then click *Dashboard*.
-. Click *Create dashboard*.
-. Set the time range to *Last 7 days*.
-. Click *Add*.
-+
-A panel opens with a list of objects that you can add to the dashboard. You'll add a map and two visualizations.
-+
-. Set the *Types* select to *Map*.
-. Click the name of your saved map or the *[Logs] Total Requests and Bytes* map included with the sample data set to add a map to the dashboard.
-. Set the *Types* select to *Visualization*.
-. Click *[Logs] Heatmap* to add a heatmap to the dashboard.
-. Click *[Logs] Visitors by OS* to add a pie chart to the dashboard.
-. Close the panel.
-+
-Your dashboard should look like this:
+View your geospatial data alongside a heat map and pie chart, and then filter the data.
+When you apply a filter in one panel, it is applied to all panels on the dashboard.
+
+. In the toolbar, click **Add** to open a list of objects that you can add to the dashboard.
+. Set the **Types** select to **Visualization**.
+. Add **[Logs] Heatmap** and **[Logs] Visitors by OS** to the dashboard.
+
[role="screenshot"]
image::maps/images/gs_dashboard_with_map.png[]
-==== Explore your data using filters
+. To filter for documents where **machine.os.keyword** is **osx**, click
+the **osx** slice in the pie chart.
-You can apply filters to your dashboard to hone in on the data that you are most interested in.
-The dashboard is interactive--you can quickly create filters by clicking on the desired data in the map and visualizations.
-The panels are linked, so that when you apply a filter in one panel, the filter is applied to all panels on the dashboard.
+. Remove the filter by clicking **x** next to its name in the filter bar.
-. In the *[Logs] Visitors by OS* visualization, click on the *osx* pie slice.
-+
-Both the visualizations and map are filtered to only show documents where *machine.os.keyword* is *osx*.
-The *machine.os.keyword: osx* filter appears in the dashboard query bar.
-+
-. Click the *x* to remove the *machine.os.keyword: osx* filter.
-. In the map, click in the United States vector.
-. Click plus image:maps/images/gs_plus_icon.png[] next to the *iso2* row in the tooltip.
-+
-Both the visualizations and the map are filtered to only show documents where *geo.src* is *US*.
-The *geo.src: US* filter appears in the dashboard query bar.
-+
-Your dashboard should look like this:
+. Set a filter from the map:
+
+.. Open a tooltip by clicking anywhere in the United States vector.
+
+.. To show only documents where **geo.src** is **US**, click the filter icon in the row for **ISO 3066-1 alpha-2**.
+
[role="screenshot"]
image::maps/images/gs_dashboard_with_terms_filter.png[]
+
+[float]
+=== What's next?
+
+* Check out <> that you can add to your map.
+* Learn more ways <>.
+* Learn more about <>.
diff --git a/docs/maps/search.asciidoc b/docs/maps/search.asciidoc
index 09d9788cd37e0..764a84d88b1d2 100644
--- a/docs/maps/search.asciidoc
+++ b/docs/maps/search.asciidoc
@@ -30,6 +30,9 @@ You can create two types of filters by interacting with your map:
* <>
* <>
+[role="screenshot"]
+image::maps/images/create_spatial_filter.png[]
+
[float]
[[maps-spatial-filters]]
==== Spatial filters
@@ -40,9 +43,6 @@ You can create spatial filters in two ways:
* Click the tool icon image:maps/images/tools_icon.png[], and then draw a polygon or bounding box on the map to define the spatial filter.
* Click *Filter by geometry* in a <>, and then use the feature's geometry for the spatial filter.
-+
-[role="screenshot"]
-image::maps/images/create_spatial_filter.png[]
Spatial filters have the following properties:
@@ -59,9 +59,6 @@ A phrase filter narrows search results to documents that contain the specified t
You can create a phrase filter by clicking the plus icon image:maps/images/gs_plus_icon.png[] in a <>.
If the map is a dashboard panel with drilldowns, you can apply a phrase filter to a drilldown by selecting the drilldown action.
-[role="screenshot"]
-image::maps/images/create_phrase_filter.png[]
-
[role="xpack"]
[[maps-layer-based-filtering]]
=== Filter a single layer
diff --git a/docs/user/alerting/alert-types.asciidoc b/docs/user/alerting/alert-types.asciidoc
index f71e43c5defc7..7de5ff56228cc 100644
--- a/docs/user/alerting/alert-types.asciidoc
+++ b/docs/user/alerting/alert-types.asciidoc
@@ -2,11 +2,13 @@
[[alert-types]]
== Alert types
-{kib} supplies alerts types in two ways: some are built into {kib}, while domain-specific alert types are registered by {kib} apps such as <>, <>, and <>.
+{kib} supplies alert types in two ways: some are built into {kib} (these are known as stack alerts), while domain-specific alert types are registered by {kib} apps such as <>, <>, and <>.
-This section covers built-in alert types. For domain-specific alert types, refer to the documentation for that app.
+This section covers stack alerts. For domain-specific alert types, refer to the documentation for that app.
+Users will need `all` access to the *Stack Alerts* feature to be able to create and edit any of the alerts listed below.
+See <> for more information on configuring roles that provide access to this feature.
-Currently {kib} provides one built-in alert type: the <> type.
+Currently {kib} provides one stack alert: the <> type.
[float]
[[alert-type-index-threshold]]
diff --git a/docs/user/alerting/alerting-getting-started.asciidoc b/docs/user/alerting/alerting-getting-started.asciidoc
index 2b22b49375676..53aef4aaa062e 100644
--- a/docs/user/alerting/alerting-getting-started.asciidoc
+++ b/docs/user/alerting/alerting-getting-started.asciidoc
@@ -6,7 +6,7 @@ beta[]
--
-Alerting allows you to detect complex conditions within different {kib} apps and trigger actions when those conditions are met. Alerting is integrated with <>, <>, <>, <>, can be centrally managed from the <> UI, and provides a set of built-in <> and <> for you to use.
+Alerting allows you to detect complex conditions within different {kib} apps and trigger actions when those conditions are met. Alerting is integrated with <>, <>, <>, <>, can be centrally managed from the <> UI, and provides a set of built-in <> and <> (known as stack alerts) for you to use.
image::images/alerting-overview.png[Alerts and actions UI]
diff --git a/docs/user/dashboard/dashboard-drilldown.asciidoc b/docs/user/dashboard/dashboard-drilldown.asciidoc
deleted file mode 100644
index bdff7355d7467..0000000000000
--- a/docs/user/dashboard/dashboard-drilldown.asciidoc
+++ /dev/null
@@ -1,96 +0,0 @@
-[[dashboard-drilldown]]
-=== Dashboard drilldown
-
-The dashboard drilldown allows you to navigate from one dashboard to another dashboard.
-For example, you might have a dashboard that shows the overall status of multiple data centers.
-You can create a drilldown that navigates from this dashboard to a dashboard
-that shows a single data center or server.
-
-This example shows a dashboard panel that contains a pie chart with a configured dashboard drilldown:
-
-[role="screenshot"]
-image::images/drilldown_on_piechart.gif[Drilldown on pie chart that navigates to another dashboard]
-
-[float]
-[[dashboard-drilldown-supported-panels]]
-==== Supported panels
-
-The following panels support dashboard drilldowns:
-
-* Lens
-* Area
-* Data table
-* Heat map
-* Horizontal bar
-* Line
-* Maps
-* Pie
-* TSVB
-* Tag cloud
-* Timelion
-* Vega
-* Vertical bar
-
-[float]
-[[drilldowns-example]]
-==== Try it: Create a dashboard drilldown
-
-Create the *Host Overview* drilldown shown above.
-
-*Set up the dashboards*
-
-. Add the sample web logs data set.
-
-. Create a new dashboard, called `Host Overview`, and include these visualizations
-from the sample data set:
-+
-[%hardbreaks]
-*[Logs] Heatmap*
-*[Logs] Visitors by OS*
-*[Logs] Host, Visits, and Bytes Table*
-*[Logs] Total Requests and Bytes*
-+
-TIP: If you don’t see data for a panel, try changing the time range.
-
-. Open the *[Logs] Web traffic* dashboard.
-
-. Set a search and filter.
-+
-[%hardbreaks]
-Search: `extension.keyword: ("gz" or "css" or "deb")`
-Filter: `geo.src: CN`
-
-
-*Create the drilldown*
-
-
-. In the dashboard menu bar, click *Edit*.
-
-. In *[Logs] Visitors by OS*, open the panel menu, and then select *Create drilldown*.
-
-. Pick *Go to dashboard* action.
-
-. Give the drilldown a name.
-
-. Select *Host Overview* as the destination dashboard.
-
-. Keep both filters enabled so that the drilldown carries over the global filters and date range.
-+
-Your input should look similar to this:
-+
-[role="screenshot"]
-image::images/drilldown_create.png[Create drilldown with entries for drilldown name and destination]
-
-. Click *Create drilldown.*
-
-. Save the dashboard.
-+
-If you don’t save the drilldown, and then navigate away, the drilldown is lost.
-
-. In *[Logs] Visitors by OS*, click the `win 8` slice of the pie, and then select the name of your drilldown.
-+
-[role="screenshot"]
-image::images/drilldown_on_panel.png[Drilldown on pie chart that navigates to another dashboard]
-+
-You are navigated to your destination dashboard. Verify that the search query, filters,
-and time range are carried over.
diff --git a/docs/user/dashboard/drilldowns.asciidoc b/docs/user/dashboard/drilldowns.asciidoc
index e3d0e16630c5c..ca788020d9286 100644
--- a/docs/user/dashboard/drilldowns.asciidoc
+++ b/docs/user/dashboard/drilldowns.asciidoc
@@ -1,52 +1,259 @@
[role="xpack"]
[[drilldowns]]
-== Use drilldowns for dashboard actions
+== Create custom dashboard actions
-Drilldowns, also known as custom actions, allow you to configure a
-workflow for analyzing and troubleshooting your data.
-For example, using a drilldown, you can navigate from one dashboard to another,
-taking the current time range, filters, and other parameters with you,
-so the context remains the same. You can continue your analysis from a new perspective.
+Custom dashboard actions, also known as drilldowns, allow you to create
+workflows for analyzing and troubleshooting your data. Drilldowns apply only to the panel that you created the drilldown from, and are not shared across all of the panels. Each panel can have multiple drilldowns.
-[role="screenshot"]
-image::images/drilldown_on_piechart.gif[Drilldown on pie chart that navigates to another dashboard]
+Third-party developers can create drilldowns. To learn how to code drilldowns, refer to {kib-repo}blob/{branch}/x-pack/examples/ui_actions_enhanced_examples[this example plugin].
+
+[float]
+[[supported-drilldowns]]
+=== Supported drilldowns
+
+{kib} supports two types of drilldowns.
+
+[NOTE]
+==============================================
+Some drilldowns are paid subscription features, while others are free.
+For a comparison of the Elastic subscription levels,
+refer https://www.elastic.co/subscriptions[the subscription page].
+==============================================
+
+[float]
+[[dashboard-drilldown]]
+==== Dashboard drilldowns
+
+Dashboard drilldowns enable you to open a dashboard from another dashboard,
+taking the time range, filters, and other parameters with you,
+so the context remains the same. Dashboard drilldowns help you to continue your analysis from a new perspective.
+
+For example, if you have a dashboard that shows the overall status of multiple data center,
+you can create a drilldown that navigates from the overall status dashboard to a dashboard
+that shows a single data center or server.
+
+[float]
+[[url-drilldown]]
+==== URL drilldowns
+
+beta[] URL drilldowns enable you to navigate from a dashboard to internal or external URLs.
+Destination URLs can be dynamic, depending on the dashboard context or user interaction with a panel.
+For example, if you have a dashboard that shows data from a Github repository, you can create a URL drilldown
+that opens Github from the dashboard.
+
+Some panels support multiple interactions, also known as triggers.
+The <> you use to create a <> depends on the trigger you choose. URL drilldowns support these types of triggers:
+
+* *Single click* — A single data point in the visualization.
+
+* *Range selection* — A range of values in a visualization.
+
+For example, *Single click* has `{{event.value}}` and *Range selection* has `{{event.from}}` and `{{event.to}}`.
+
+To disable URL drilldowns on your {kib} instance, disable the plugin:
-Drilldowns are specific to the dashboard panel for which you create them—they are not shared across panels. A panel can have multiple drilldowns.
+["source","yml"]
+-----------
+url_drilldown.enabled: false
+-----------
[float]
-[[actions]]
-=== Drilldown actions
+[[dashboard-drilldown-supported-panels]]
+=== Supported panels
-Drilldowns are user-configurable {kib} actions that are stored with the dashboard metadata.
-Kibana provides the following types of actions:
+The following panels support dashboard and URL drilldowns.
-[cols="2"]
+[options="header"]
|===
-a| <>
+| Panel | Dashboard drilldown | URL drilldown
-| Navigate to a dashboard.
+| Lens
+^| X
+^| X
-a| <>
+| Area
+^| X
+^| X
-| Navigate to external or internal URL.
+| Controls
+^|
+^|
+
+| Data Table
+^| X
+^| X
+
+| Gauge
+^|
+^|
+
+| Goal
+^|
+^|
+
+| Heat map
+^| X
+^| X
+
+| Horizontal Bar
+^| X
+^| X
+
+| Line
+^| X
+^| X
+
+| Maps
+^| X
+^|
+
+| Markdown
+^|
+^|
+
+| Metric
+^|
+^|
+
+| Pie
+^| X
+^| X
+
+| TSVB
+^| X
+^|
+
+| Tag Cloud
+^| X
+^| X
+
+| Timelion
+^| X
+^|
+
+| Vega
+^| X
+^|
+
+| Vertical Bar
+^| X
+^| X
|===
-[NOTE]
-==============================================
-Some action types are paid commercial features, while others are free.
-For a comparison of the Elastic subscription levels,
-see https://www.elastic.co/subscriptions[the subscription page].
-==============================================
+[float]
+[[drilldowns-example]]
+=== Try it: Create a dashboard drilldown
+
+To create dashboard drilldowns, you create or locate the dashboards you want to connect, then configure the drilldown that allows you to easily open one dashboard from the other dashboard.
+
+image:images/drilldown_on_piechart.gif[Drilldown on pie chart that navigates to another dashboard]
[float]
-[[code-drilldowns]]
-=== Code drilldowns
-Third-party developers can create drilldowns.
-Refer to {kib-repo}blob/{branch}/x-pack/examples/ui_actions_enhanced_examples[this example plugin]
-to learn how to code drilldowns.
+==== Create the dashboard
-include::dashboard-drilldown.asciidoc[]
-include::url-drilldown.asciidoc[]
+. Add the *Sample web logs* data.
+
+. Create a new dashboard, then add the following panels:
+
+* *[Logs] Heatmap*
+* *[Logs] Host, Visits, and Bytes Table*
+* *[Logs] Total Requests and Bytes*
+* *[Logs] Visitors by OS*
++
+If you don’t see data for a panel, try changing the <>.
+
+. Save the dashboard. In the *Title* field, enter `Host Overview`.
+
+. Open the *[Logs] Web traffic* dashboard.
+
+. Set a search and filter.
++
+[%hardbreaks]
+Search: `extension.keyword: ("gz" or "css" or "deb")`
+Filter: `geo.src: CN`
+
+[float]
+==== Create the drilldown
+
+. In the toolbar, click *Edit*.
+
+. Open the *[Logs] Visitors by OS* panel menu, then select *Create drilldown*.
+
+. Give the drilldown a name, then select *Go to dashboard*.
+
+. From the *Choose a destination dashboard* dropdown, select *Host Overview*.
+
+. To carry over the filter, query, and date range, make sure that *Use filters and query from origin dashboard* and *Use date range from origin dashboard* are selected.
++
+[role="screenshot"]
+image::images/drilldown_create.png[Create drilldown with entries for drilldown name and destination]
+
+. Click *Create drilldown*.
++
+The drilldown is stored as dashboard metadata.
+
+. Save the dashboard.
++
+If you fail to save the dashboard, the drilldown is lost when you navigate away from the dashboard.
+
+. In the *[Logs] Visitors by OS* panel, click *win 8*, then select the drilldown.
++
+[role="screenshot"]
+image::images/drilldown_on_panel.png[Drilldown on pie chart that navigates to another dashboard]
+. On the *Host Overview* dashboard, verify that the search query, filters,
+and date range are carried over.
+
+[float]
+[[create-a-url-drilldown]]
+=== Try it: Create a URL drilldown
+
+beta[] To create URL drilldowns, you add <> to a URL template, which configures the bahavior of the drilldown.
+
+image:images/url_drilldown_go_to_github.gif[Drilldown on pie chart that navigates to Github]
+
+. Add the *Sample web logs* data.
+
+. Open the *[Logs] Web traffic* dashboard. This isn’t data from Github, but works for demonstration purposes.
+
+. In the toolbar, click *Edit*.
+
+. Open the *[Logs] Visitors by OS* panel menu, then select *Create drilldown*.
+
+.. In the *Name* field, enter `Show on Github`.
+
+.. Select *Go to URL*.
+
+.. Enter the URL template:
++
+[source, bash]
+----
+https://github.com/elastic/kibana/issues?q=is:issue+is:open+{{event.value}}
+----
++
+The example URL navigates to {kib} issues on Github. `{{event.value}}` is substituted with a value associated with a selected pie slice. In *URL preview*, `{{event.value}}` is substituted with a <> value.
++
+[role="screenshot"]
+image:images/url_drilldown_url_template.png[URL template input]
+
+.. Click *Create drilldown*.
++
+The drilldown is stored as dashboard metadata.
+
+. Save the dashboard.
++
+If you fail to save the dashboard, the drilldown is lost when you navigate away from the dashboard.
+
+. On the *[Logs] Visitors by OS* panel, click any chart slice, then select *Show on Github*.
++
+[role="screenshot"]
+image:images/url_drilldown_popup.png[URL drilldown popup]
+
+. On the page that lists the issues in the {kib} repository, verify the slice value appears in Github.
++
+[role="screenshot"]
+image:images/url_drilldown_github.png[Github]
+
+include::url-drilldown.asciidoc[]
diff --git a/docs/user/dashboard/url-drilldown.asciidoc b/docs/user/dashboard/url-drilldown.asciidoc
index 212e29898bd40..cf92016e23f19 100644
--- a/docs/user/dashboard/url-drilldown.asciidoc
+++ b/docs/user/dashboard/url-drilldown.asciidoc
@@ -1,96 +1,9 @@
-[[url-drilldown]]
-=== URL drilldown
+[[url_templating]]
+=== URL templating
beta[]
-The URL drilldown allows you to navigate from a dashboard to an internal or external URL.
-The destination URL can be dynamic, depending on the dashboard context or user’s interaction with a visualization.
-
-For example, you might have a dashboard that shows data from a Github repository.
-You can create a drilldown that navigates from this dashboard to Github.
-
-[role="screenshot"]
-image:images/url_drilldown_go_to_github.gif[Drilldown on pie chart that navigates to Github]
-
-NOTE: URL drilldown is available with the https://www.elastic.co/subscriptions[Gold subscription] and higher.
-
-[float]
-[[url-drilldown-supported-panels]]
-==== Supported panels
-
-The following panels support URL drilldowns:
-
-* Lens
-* Area
-* Data table
-* Heat map
-* Horizontal bar
-* Line
-* Pie
-* Tag cloud
-* Vertical bar
-
-[float]
-[[try-it]]
-==== Try it: Create a URL drilldown
-
-This example shows how to create the "Show on Github" drilldown shown above.
-
-. Add the sample web logs data set.
-. Open the *[Logs] Web traffic* dashboard. This isn’t data from Github, but it should work for demonstration purposes.
-. In the dashboard menu bar, click *Edit*.
-. In *[Logs] Visitors by OS*, open the panel menu, and then select *Create drilldown*.
-. Give the drilldown a name: *Show on Github*.
-. Select a drilldown action: *Go to URL*.
-+
-[role="screenshot"]
-image:images/url_drilldown_pick_an_action.png[Action picker]
-. Enter a URL template:
-+
-[source, bash]
-----
-https://github.com/elastic/kibana/issues?q=is:issue+is:open+{{event.value}}
-----
-+
-This example URL navigates to {kib} issues on Github. `{{event.value}}` will be substituted with a value associated with a clicked pie slice. In _preview_ `{{event.value}}` is substituted with a <> value.
-[role="screenshot"]
-image:images/url_drilldown_url_template.png[URL template input]
-. Click *Create drilldown*.
-. Save the dashboard.
-+
-If you don’t save the drilldown, and then navigate away, the drilldown is lost.
-
-. In *[Logs] Visitors by OS*, click any slice of the pie, and then select the drilldown *Show on Github*.
-+
-[role="screenshot"]
-image:images/url_drilldown_popup.png[URL drilldown popup]
-+
-You are navigated to the issue list in the {kib} repository. Verify that value from a pie slice you’ve clicked on is carried over to Github.
-+
-[role="screenshot"]
-image:images/url_drilldown_github.png[Github]
-
-[float]
-[[trigger-picker]]
-==== Picking a trigger for a URL drilldown
-
-Some panels support multiple user interactions (called triggers) for which you can configure a URL drilldown. The list of supported variables in the URL template depends on the trigger you selected.
-In the preceding example, you configured a URL drilldown on a pie chart. The only trigger that pie chart supports is clicking on a pie slice, so you didn’t have to pick a trigger.
-
-However, the sample *[Logs] Unique Visitors vs. Average Bytes* chart supports both clicking on a data point and selecting a range. When you create a URL drilldown for this chart, you have the following choices:
-
-[role="screenshot"]
-image:images/url_drilldown_trigger_picker.png[Trigger picker: Single click and Range selection]
-
-Variables in the URL template differ per trigger.
-For example, *Single click* has `{{event.value}}` and *Range selection* has `{{event.from}}` and `{{event.to}}`.
-You can create multiple URL drilldowns per panel and attach them to different triggers.
-
-[float]
-[[templating]]
-==== URL templating language
-
-The URL template input uses Handlebars — a simple templating language. Handlebars templates look like regular text with embedded Handlebars expressions.
+The URL template input uses https://ela.st/handlebars-docs#expressions[Handlebars] — a simple templating language. Handlebars templates look like regular text with embedded Handlebars expressions.
[source, bash]
----
@@ -99,14 +12,13 @@ https://github.com/elastic/kibana/issues?q={{event.value}}
A Handlebars expression is a `{{`, some contents, followed by a `}}`. When the drilldown is executed, these expressions are replaced by values from the dashboard and interaction context.
-Refer to Handlebars https://ela.st/handlebars-docs#expressions[documentation] to learn about advanced use cases.
-
[[helpers]]
-In addition to https://ela.st/handlebars-helpers[built-in] Handlebars helpers, you can use the following custom helpers:
+In addition to https://ela.st/handlebars-helpers[built-in] Handlebars helpers, you can use custom helpers.
+Refer to Handlebars https://ela.st/handlebars-docs#expressions[documentation] to learn about advanced use cases.
|===
-|Helper |Use case
+|Custom helper |Use case
|json
a|Serialize variables in JSON format.
@@ -133,7 +45,7 @@ a|Format dates. Supports relative dates expressions (for example, "now-15d"). R
Example:
-`{{ date event.from “YYYY MM DD”}}` +
+`{{date event.from “YYYY MM DD”}}` +
`{{date “now-15”}}`
|formatNumber
@@ -240,7 +152,7 @@ For example, `{{context.panel.filters}}` are previewed with the current filters
*Event* variables are extracted during drilldown execution from a user interaction with a panel (for example, from a pie slice that the user clicked on).
Because there is no user interaction with a panel in preview, there is no interaction context to use in a preview.
-To work around this, {kib} provides a sample interaction that relies on a picked <>.
+To work around this, {kib} provides a sample interaction that relies on a trigger.
So in a preview, you might notice that `{{event.value}}` is replaced with `{{event.value}}` instead of with a sample from your data.
Such previews can help you make sure that the structure of your URL template is valid.
However, to ensure that the configured URL drilldown works as expected with your data, you have to save the dashboard and test in the panel.
@@ -340,14 +252,3 @@ Tip: Consider using <> helper for date formatting.
| Aggregation field behind the selected range, if available.
|===
-
-[float]
-[[disable]]
-==== Disable URL drilldown
-
-You can disable URL drilldown feature on your {kib} instance by disabling the plugin:
-
-["source","yml"]
------------
-url_drilldown.enabled: false
------------
diff --git a/package.json b/package.json
index 353d3dc85356c..7edbcb03be542 100644
--- a/package.json
+++ b/package.json
@@ -140,8 +140,6 @@
"@slack/webhook": "^5.0.0",
"@storybook/addons": "^6.0.16",
"@turf/circle": "6.0.1",
- "@types/pdfmake": "^0.1.15",
- "@types/yauzl": "^2.9.1",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
@@ -509,6 +507,7 @@
"@types/ora": "^1.3.5",
"@types/papaparse": "^5.0.3",
"@types/parse-link-header": "^1.0.0",
+ "@types/pdfmake": "^0.1.15",
"@types/pegjs": "^0.10.1",
"@types/pngjs": "^3.4.0",
"@types/prettier": "^2.0.2",
@@ -566,6 +565,7 @@
"@types/write-pkg": "^3.1.0",
"@types/xml-crypto": "^1.4.1",
"@types/xml2js": "^0.4.5",
+ "@types/yauzl": "^2.9.1",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^3.10.0",
"@typescript-eslint/parser": "^3.10.0",
@@ -577,8 +577,8 @@
"angular-recursion": "^1.0.5",
"angular-route": "^1.8.0",
"angular-sortable-view": "^0.0.17",
- "apidoc": "^0.20.1",
- "apidoc-markdown": "^5.0.0",
+ "apidoc": "^0.25.0",
+ "apidoc-markdown": "^5.1.8",
"apollo-link": "^1.2.3",
"apollo-link-error": "^1.1.7",
"apollo-link-state": "^0.4.1",
diff --git a/packages/kbn-plugin-helpers/README.md b/packages/kbn-plugin-helpers/README.md
index d7ed3106c1ceb..05eb9f5998737 100644
--- a/packages/kbn-plugin-helpers/README.md
+++ b/packages/kbn-plugin-helpers/README.md
@@ -4,13 +4,20 @@ Just some helpers for kibana plugin devs.
## Installation
-To install the plugin helpers use `yarn` to link to the package from the Kibana project:
+You don't actually need to install the plugin helpers, they are automatically inherited from the Kibana project by building your plugin within the Kibana repo. To use the plugin helpers just create the needed npm scripts on your plugin's `package.json` (as exemplified below) which
+is already the case if you use the new `node scripts/generate_plugin` script.
-```sh
-yarn add --dev link:../../kibana/packages/kbn-plugin-helpers
+```json
+{
+ "scripts" : {
+ "build": "yarn plugin-helpers build",
+ "plugin-helpers": "node ../../scripts/plugin_helpers",
+ "kbn": "node ../../scripts/kbn"
+ }
+}
```
-This will link the package from the repository into your plugin, but the `plugin-helpers` executable won't be available in your project until you run bootstrap again.
+This will make it easier to execute the `plugin-helpers` script from within your plugin repository.
```sh
yarn kbn bootstrap
@@ -18,24 +25,38 @@ yarn kbn bootstrap
## Usage
-This simple CLI has several tasks that plugin devs can run from to easily debug, test, or package kibana plugins.
+This simple CLI has a build task that plugin devs can run from to easily package Kibana plugins.
+
+Previously you could also use that tool to start and test your plugin. Currently you can run
+your plugin along with Kibana running `yarn start` in the Kibana repository root folder. Finally to test
+your plugin you should now configure and use your own tools.
```sh
$ plugin-helpers help
- Usage: plugin-helpers [options] [command]
+ Usage: plugin-helpers [command] [options]
Commands:
-
- start Start kibana and have it include this plugin
- build [options] [files...] Build a distributable archive
- test Run the server and browser tests
- test:mocha [files...] Run the server tests using mocha
-
- Options:
-
- -h, --help output usage information
- -V, --version output the version number
+ build
+ Copies files from the source into a zip archive that can be distributed for
+ installation into production Kibana installs. The archive includes the non-
+ development npm dependencies and builds itself using raw files in the source
+ directory so make sure they are clean/up to date. The resulting archive can
+ be found at:
+
+ build/{plugin.id}-{kibanaVersion}.zip
+
+ Options:
+ --skip-archive Don't create the zip file, just create the build/kibana directory
+ --kibana-version, -v Kibana version that the
+
+
+ Global options:
+ --verbose, -v Log verbosely
+ --debug Log debug messages (less than verbose)
+ --quiet Only log errors
+ --silent Don't log anything
+ --help Show this message
```
@@ -55,21 +76,13 @@ All configuration setting listed below can simply can be included in the json co
## Global settings
-### Settings for `start`
-
-Setting | Description
-------- | -----------
-`includePlugins` | Intended to be used in a config file, an array of additional plugin paths to include, absolute or relative to the plugin root
-`*` | Any options/flags included will be passed unmodified to the Kibana binary
-
### Settings for `build`
Setting | Description
------- | -----------
+`serverSourcePatterns` | Defines the files that are built with babel and written to your distributable for your server plugin. It is ignored if `kibana.json` has none `server: true` setting defined.
`skipArchive` | Don't create the zip file, leave the build path alone
-`buildDestination` | Target path for the build output, absolute or relative to the plugin root
`skipInstallDependencies` | Don't install dependencies defined in package.json into build output
-`buildVersion` | Version for the build output
`kibanaVersion` | Kibana version for the build output (added to package.json)
## TypeScript support
diff --git a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap
index cf734f33cc3e4..b01dd205440a9 100644
--- a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap
+++ b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap
@@ -131,7 +131,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
"category": Object {
"euiIconType": "logoKibana",
"id": "kibana",
- "label": "Kibana",
+ "label": "Analytics",
"order": 1000,
},
"data-test-subj": "discover",
@@ -187,7 +187,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
"category": Object {
"euiIconType": "logoKibana",
"id": "kibana",
- "label": "Kibana",
+ "label": "Analytics",
"order": 1000,
},
"data-test-subj": "visualize",
@@ -201,7 +201,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
"category": Object {
"euiIconType": "logoKibana",
"id": "kibana",
- "label": "Kibana",
+ "label": "Analytics",
"order": 1000,
},
"data-test-subj": "dashboard",
@@ -859,7 +859,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
isCollapsible={true}
key="kibana"
onToggle={[Function]}
- title="Kibana"
+ title="Analytics"
>
- Kibana
+ Analytics
@@ -971,7 +971,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
className="euiTitle euiTitle--xxsmall euiCollapsibleNavGroup__title"
id="mockId__title"
>
- Kibana
+ Analytics
@@ -996,7 +996,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
className="euiCollapsibleNavGroup__children"
>
{
const setupContract: jest.Mocked = {
diff --git a/src/core/server/i18n/fs.ts b/src/core/server/i18n/fs.ts
new file mode 100644
index 0000000000000..23d729504f81c
--- /dev/null
+++ b/src/core/server/i18n/fs.ts
@@ -0,0 +1,23 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import Fs from 'fs';
+import { promisify } from 'util';
+
+export const readFile = promisify(Fs.readFile);
diff --git a/src/core/server/i18n/get_kibana_translation_files.test.ts b/src/core/server/i18n/get_kibana_translation_files.test.ts
new file mode 100644
index 0000000000000..737d8ed8bc4e2
--- /dev/null
+++ b/src/core/server/i18n/get_kibana_translation_files.test.ts
@@ -0,0 +1,81 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { getKibanaTranslationFiles } from './get_kibana_translation_files';
+import { getTranslationPaths } from './get_translation_paths';
+
+const mockGetTranslationPaths = getTranslationPaths as jest.Mock;
+
+jest.mock('./get_translation_paths', () => ({
+ getTranslationPaths: jest.fn().mockResolvedValue([]),
+}));
+jest.mock('../utils', () => ({
+ fromRoot: jest.fn().mockImplementation((path: string) => path),
+}));
+
+const locale = 'en';
+
+describe('getKibanaTranslationPaths', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ it('calls getTranslationPaths against kibana root and kibana-extra', async () => {
+ await getKibanaTranslationFiles(locale, []);
+
+ expect(mockGetTranslationPaths).toHaveBeenCalledTimes(2);
+
+ expect(mockGetTranslationPaths).toHaveBeenCalledWith({
+ cwd: '.',
+ nested: true,
+ });
+
+ expect(mockGetTranslationPaths).toHaveBeenCalledWith({
+ cwd: '../kibana-extra',
+ nested: true,
+ });
+ });
+
+ it('calls getTranslationPaths for each config returned in plugin.paths and plugins.scanDirs', async () => {
+ const pluginPaths = ['/path/to/pluginA', '/path/to/pluginB'];
+
+ await getKibanaTranslationFiles(locale, pluginPaths);
+
+ expect(mockGetTranslationPaths).toHaveBeenCalledTimes(2 + pluginPaths.length);
+
+ pluginPaths.forEach((pluginPath) => {
+ expect(mockGetTranslationPaths).toHaveBeenCalledWith({
+ cwd: pluginPath,
+ nested: false,
+ });
+ });
+ });
+
+ it('only return files for specified locale', async () => {
+ mockGetTranslationPaths.mockResolvedValueOnce(['/root/en.json', '/root/fr.json']);
+ mockGetTranslationPaths.mockResolvedValueOnce([
+ '/kibana-extra/en.json',
+ '/kibana-extra/fr.json',
+ ]);
+
+ const translationFiles = await getKibanaTranslationFiles('en', []);
+
+ expect(translationFiles).toEqual(['/root/en.json', '/kibana-extra/en.json']);
+ });
+});
diff --git a/src/legacy/server/i18n/get_kibana_translation_paths.ts b/src/core/server/i18n/get_kibana_translation_files.ts
similarity index 64%
rename from src/legacy/server/i18n/get_kibana_translation_paths.ts
rename to src/core/server/i18n/get_kibana_translation_files.ts
index d7f77d3185ba4..dacb6a1e16a5c 100644
--- a/src/legacy/server/i18n/get_kibana_translation_paths.ts
+++ b/src/core/server/i18n/get_kibana_translation_files.ts
@@ -17,26 +17,27 @@
* under the License.
*/
-import { KibanaConfig } from '../kbn_server';
-import { fromRoot } from '../../../core/server/utils';
-import { I18N_RC } from './constants';
+import { basename } from 'path';
+import { fromRoot } from '../utils';
import { getTranslationPaths } from './get_translation_paths';
-export async function getKibanaTranslationPaths(config: Pick) {
- return await Promise.all([
+export const getKibanaTranslationFiles = async (
+ locale: string,
+ pluginPaths: string[]
+): Promise => {
+ const translationPaths = await Promise.all([
getTranslationPaths({
cwd: fromRoot('.'),
- glob: `*/${I18N_RC}`,
+ nested: true,
}),
- ...(config.get('plugins.paths') as string[]).map((cwd) =>
- getTranslationPaths({ cwd, glob: I18N_RC })
- ),
- ...(config.get('plugins.scanDirs') as string[]).map((cwd) =>
- getTranslationPaths({ cwd, glob: `*/${I18N_RC}` })
- ),
+ ...pluginPaths.map((pluginPath) => getTranslationPaths({ cwd: pluginPath, nested: false })),
getTranslationPaths({
cwd: fromRoot('../kibana-extra'),
- glob: `*/${I18N_RC}`,
+ nested: true,
}),
]);
-}
+
+ return ([] as string[])
+ .concat(...translationPaths)
+ .filter((translationPath) => basename(translationPath, '.json') === locale);
+};
diff --git a/src/core/server/i18n/get_translation_paths.test.mocks.ts b/src/core/server/i18n/get_translation_paths.test.mocks.ts
new file mode 100644
index 0000000000000..f3b688062523c
--- /dev/null
+++ b/src/core/server/i18n/get_translation_paths.test.mocks.ts
@@ -0,0 +1,26 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export const globbyMock = jest.fn();
+jest.doMock('globby', () => globbyMock);
+
+export const readFileMock = jest.fn();
+jest.doMock('./fs', () => ({
+ readFile: readFileMock,
+}));
diff --git a/src/core/server/i18n/get_translation_paths.test.ts b/src/core/server/i18n/get_translation_paths.test.ts
new file mode 100644
index 0000000000000..c6af59da07fb5
--- /dev/null
+++ b/src/core/server/i18n/get_translation_paths.test.ts
@@ -0,0 +1,90 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { resolve, join } from 'path';
+import { globbyMock, readFileMock } from './get_translation_paths.test.mocks';
+import { getTranslationPaths } from './get_translation_paths';
+
+describe('getTranslationPaths', () => {
+ beforeEach(() => {
+ globbyMock.mockReset();
+ readFileMock.mockReset();
+
+ globbyMock.mockResolvedValue([]);
+ readFileMock.mockResolvedValue('{}');
+ });
+
+ it('calls `globby` with the correct parameters', async () => {
+ getTranslationPaths({ cwd: '/some/cwd', nested: false });
+
+ expect(globbyMock).toHaveBeenCalledTimes(1);
+ expect(globbyMock).toHaveBeenCalledWith('.i18nrc.json', { cwd: '/some/cwd' });
+
+ globbyMock.mockClear();
+
+ await getTranslationPaths({ cwd: '/other/cwd', nested: true });
+
+ expect(globbyMock).toHaveBeenCalledTimes(1);
+ expect(globbyMock).toHaveBeenCalledWith('*/.i18nrc.json', { cwd: '/other/cwd' });
+ });
+
+ it('calls `readFile` for each entry returned by `globby`', async () => {
+ const entries = [join('pathA', '.i18nrc.json'), join('pathB', '.i18nrc.json')];
+ globbyMock.mockResolvedValue(entries);
+
+ const cwd = '/kibana-extra';
+
+ await getTranslationPaths({ cwd, nested: true });
+
+ expect(readFileMock).toHaveBeenCalledTimes(2);
+
+ expect(readFileMock).toHaveBeenNthCalledWith(1, resolve(cwd, entries[0]), 'utf8');
+ expect(readFileMock).toHaveBeenNthCalledWith(2, resolve(cwd, entries[1]), 'utf8');
+ });
+
+ it('returns the absolute path to the translation files', async () => {
+ const entries = ['.i18nrc.json'];
+ globbyMock.mockResolvedValue(entries);
+
+ const i18nFileContent = {
+ translations: ['translations/en.json', 'translations/fr.json'],
+ };
+ readFileMock.mockResolvedValue(JSON.stringify(i18nFileContent));
+
+ const cwd = '/cwd';
+
+ const translationPaths = await getTranslationPaths({ cwd, nested: true });
+
+ expect(translationPaths).toEqual([
+ resolve(cwd, 'translations/en.json'),
+ resolve(cwd, 'translations/fr.json'),
+ ]);
+ });
+
+ it('throws if i18nrc parsing fails', async () => {
+ globbyMock.mockResolvedValue(['.i18nrc.json']);
+ readFileMock.mockRejectedValue(new Error('error parsing file'));
+
+ await expect(
+ getTranslationPaths({ cwd: '/cwd', nested: true })
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
+ `"Failed to parse .i18nrc.json file at /cwd/.i18nrc.json"`
+ );
+ });
+});
diff --git a/src/legacy/server/i18n/get_translation_paths.ts b/src/core/server/i18n/get_translation_paths.ts
similarity index 85%
rename from src/legacy/server/i18n/get_translation_paths.ts
rename to src/core/server/i18n/get_translation_paths.ts
index a2a292e2278be..41d9dc4722e37 100644
--- a/src/legacy/server/i18n/get_translation_paths.ts
+++ b/src/core/server/i18n/get_translation_paths.ts
@@ -17,18 +17,18 @@
* under the License.
*/
-import { promisify } from 'util';
-import { readFile } from 'fs';
import { resolve, dirname } from 'path';
import globby from 'globby';
-
-const readFileAsync = promisify(readFile);
+import { readFile } from './fs';
interface I18NRCFileStructure {
translations?: string[];
}
-export async function getTranslationPaths({ cwd, glob }: { cwd: string; glob: string }) {
+const I18N_RC = '.i18nrc.json';
+
+export async function getTranslationPaths({ cwd, nested }: { cwd: string; nested: boolean }) {
+ const glob = nested ? `*/${I18N_RC}` : I18N_RC;
const entries = await globby(glob, { cwd });
const translationPaths: string[] = [];
@@ -36,7 +36,7 @@ export async function getTranslationPaths({ cwd, glob }: { cwd: string; glob: st
const entryFullPath = resolve(cwd, entry);
const pluginBasePath = dirname(entryFullPath);
try {
- const content = await readFileAsync(entryFullPath, 'utf8');
+ const content = await readFile(entryFullPath, 'utf8');
const { translations } = JSON.parse(content) as I18NRCFileStructure;
if (translations && translations.length) {
translations.forEach((translation) => {
diff --git a/src/core/server/i18n/i18n_config.ts b/src/core/server/i18n/i18n_config.ts
new file mode 100644
index 0000000000000..f181c52dc4b06
--- /dev/null
+++ b/src/core/server/i18n/i18n_config.ts
@@ -0,0 +1,29 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { schema, TypeOf } from '@kbn/config-schema';
+
+export const config = {
+ path: 'i18n',
+ schema: schema.object({
+ locale: schema.string({ defaultValue: 'en' }),
+ }),
+};
+
+export type I18nConfigType = TypeOf;
diff --git a/src/core/server/i18n/i18n_service.mock.ts b/src/core/server/i18n/i18n_service.mock.ts
new file mode 100644
index 0000000000000..679751aefbf27
--- /dev/null
+++ b/src/core/server/i18n/i18n_service.mock.ts
@@ -0,0 +1,50 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { PublicMethodsOf } from '@kbn/utility-types';
+import type { I18nServiceSetup, I18nService } from './i18n_service';
+
+const createSetupContractMock = () => {
+ const mock: jest.Mocked = {
+ getLocale: jest.fn(),
+ getTranslationFiles: jest.fn(),
+ };
+
+ mock.getLocale.mockReturnValue('en');
+ mock.getTranslationFiles.mockReturnValue([]);
+
+ return mock;
+};
+
+type I18nServiceContract = PublicMethodsOf;
+
+const createMock = () => {
+ const mock: jest.Mocked = {
+ setup: jest.fn(),
+ };
+
+ mock.setup.mockResolvedValue(createSetupContractMock());
+
+ return mock;
+};
+
+export const i18nServiceMock = {
+ create: createMock,
+ createSetupContract: createSetupContractMock,
+};
diff --git a/src/core/server/i18n/i18n_service.test.mocks.ts b/src/core/server/i18n/i18n_service.test.mocks.ts
new file mode 100644
index 0000000000000..23f97a1404fff
--- /dev/null
+++ b/src/core/server/i18n/i18n_service.test.mocks.ts
@@ -0,0 +1,28 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export const getKibanaTranslationFilesMock = jest.fn();
+jest.doMock('./get_kibana_translation_files', () => ({
+ getKibanaTranslationFiles: getKibanaTranslationFilesMock,
+}));
+
+export const initTranslationsMock = jest.fn();
+jest.doMock('./init_translations', () => ({
+ initTranslations: initTranslationsMock,
+}));
diff --git a/src/core/server/i18n/i18n_service.test.ts b/src/core/server/i18n/i18n_service.test.ts
new file mode 100644
index 0000000000000..87de39a92ab26
--- /dev/null
+++ b/src/core/server/i18n/i18n_service.test.ts
@@ -0,0 +1,84 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { getKibanaTranslationFilesMock, initTranslationsMock } from './i18n_service.test.mocks';
+
+import { BehaviorSubject } from 'rxjs';
+import { I18nService } from './i18n_service';
+
+import { configServiceMock } from '../config/mocks';
+import { mockCoreContext } from '../core_context.mock';
+
+const getConfigService = (locale = 'en') => {
+ const configService = configServiceMock.create();
+ configService.atPath.mockImplementation((path) => {
+ if (path === 'i18n') {
+ return new BehaviorSubject({
+ locale,
+ });
+ }
+ return new BehaviorSubject({});
+ });
+ return configService;
+};
+
+describe('I18nService', () => {
+ let service: I18nService;
+ let configService: ReturnType;
+
+ beforeEach(() => {
+ jest.clearAllMocks();
+ configService = getConfigService();
+
+ const coreContext = mockCoreContext.create({ configService });
+ service = new I18nService(coreContext);
+ });
+
+ describe('#setup', () => {
+ it('calls `getKibanaTranslationFiles` with the correct parameters', async () => {
+ getKibanaTranslationFilesMock.mockResolvedValue([]);
+
+ const pluginPaths = ['/pathA', '/pathB'];
+ await service.setup({ pluginPaths });
+
+ expect(getKibanaTranslationFilesMock).toHaveBeenCalledTimes(1);
+ expect(getKibanaTranslationFilesMock).toHaveBeenCalledWith('en', pluginPaths);
+ });
+
+ it('calls `initTranslations` with the correct parameters', async () => {
+ const translationFiles = ['/path/to/file', 'path/to/another/file'];
+ getKibanaTranslationFilesMock.mockResolvedValue(translationFiles);
+
+ await service.setup({ pluginPaths: [] });
+
+ expect(initTranslationsMock).toHaveBeenCalledTimes(1);
+ expect(initTranslationsMock).toHaveBeenCalledWith('en', translationFiles);
+ });
+
+ it('returns accessors for locale and translation files', async () => {
+ const translationFiles = ['/path/to/file', 'path/to/another/file'];
+ getKibanaTranslationFilesMock.mockResolvedValue(translationFiles);
+
+ const { getLocale, getTranslationFiles } = await service.setup({ pluginPaths: [] });
+
+ expect(getLocale()).toEqual('en');
+ expect(getTranslationFiles()).toEqual(translationFiles);
+ });
+ });
+});
diff --git a/src/core/server/i18n/i18n_service.ts b/src/core/server/i18n/i18n_service.ts
new file mode 100644
index 0000000000000..fd32dd7fdd6ef
--- /dev/null
+++ b/src/core/server/i18n/i18n_service.ts
@@ -0,0 +1,75 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { take } from 'rxjs/operators';
+import { Logger } from '../logging';
+import { IConfigService } from '../config';
+import { CoreContext } from '../core_context';
+import { config as i18nConfigDef, I18nConfigType } from './i18n_config';
+import { getKibanaTranslationFiles } from './get_kibana_translation_files';
+import { initTranslations } from './init_translations';
+
+interface SetupDeps {
+ pluginPaths: string[];
+}
+
+/**
+ * @public
+ */
+export interface I18nServiceSetup {
+ /**
+ * Return the locale currently in use.
+ */
+ getLocale(): string;
+
+ /**
+ * Return the absolute paths to translation files currently in use.
+ */
+ getTranslationFiles(): string[];
+}
+
+export class I18nService {
+ private readonly log: Logger;
+ private readonly configService: IConfigService;
+
+ constructor(coreContext: CoreContext) {
+ this.log = coreContext.logger.get('i18n');
+ this.configService = coreContext.configService;
+ }
+
+ public async setup({ pluginPaths }: SetupDeps): Promise {
+ const i18nConfig = await this.configService
+ .atPath(i18nConfigDef.path)
+ .pipe(take(1))
+ .toPromise();
+
+ const locale = i18nConfig.locale;
+ this.log.debug(`Using locale: ${locale}`);
+
+ const translationFiles = await getKibanaTranslationFiles(locale, pluginPaths);
+
+ this.log.debug(`Using translation files: [${translationFiles.join(', ')}]`);
+ await initTranslations(locale, translationFiles);
+
+ return {
+ getLocale: () => locale,
+ getTranslationFiles: () => translationFiles,
+ };
+ }
+}
diff --git a/src/core/server/i18n/index.ts b/src/core/server/i18n/index.ts
new file mode 100644
index 0000000000000..2db3fdeb405d9
--- /dev/null
+++ b/src/core/server/i18n/index.ts
@@ -0,0 +1,21 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { config, I18nConfigType } from './i18n_config';
+export { I18nService, I18nServiceSetup } from './i18n_service';
diff --git a/src/core/server/i18n/init_translations.ts b/src/core/server/i18n/init_translations.ts
new file mode 100644
index 0000000000000..94e6d41019ad2
--- /dev/null
+++ b/src/core/server/i18n/init_translations.ts
@@ -0,0 +1,31 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { i18n, i18nLoader } from '@kbn/i18n';
+
+export const initTranslations = async (locale: string, translationFiles: string[]) => {
+ i18nLoader.registerTranslationFiles(translationFiles);
+ const translations = await i18nLoader.getTranslationsByLocale(locale);
+ i18n.init(
+ Object.freeze({
+ locale,
+ ...translations,
+ })
+ );
+};
diff --git a/src/core/server/index.ts b/src/core/server/index.ts
index 0adda4770639d..7b19c3a686757 100644
--- a/src/core/server/index.ts
+++ b/src/core/server/index.ts
@@ -64,6 +64,7 @@ import { MetricsServiceSetup, MetricsServiceStart } from './metrics';
import { StatusServiceSetup } from './status';
import { AppenderConfigType, appendersSchema, LoggingServiceSetup } from './logging';
import { CoreUsageDataStart } from './core_usage_data';
+import { I18nServiceSetup } from './i18n';
// Because of #79265 we need to explicity import, then export these types for
// scripts/telemetry_check.js to work as expected
@@ -336,6 +337,8 @@ export {
MetricsServiceStart,
} from './metrics';
+export { I18nServiceSetup } from './i18n';
+
export { AppCategory } from '../types';
export { DEFAULT_APP_CATEGORIES } from '../utils';
@@ -421,6 +424,8 @@ export interface CoreSetup = KbnServer as any;
@@ -75,6 +76,7 @@ beforeEach(() => {
capabilities: capabilitiesServiceMock.createSetupContract(),
context: contextServiceMock.createSetupContract(),
elasticsearch: { legacy: {} } as any,
+ i18n: i18nServiceMock.createSetupContract(),
uiSettings: uiSettingsServiceMock.createSetupContract(),
http: {
...httpServiceMock.createInternalSetupContract(),
diff --git a/src/core/server/legacy/legacy_service.ts b/src/core/server/legacy/legacy_service.ts
index c42771179aba2..3111c8daf7981 100644
--- a/src/core/server/legacy/legacy_service.ts
+++ b/src/core/server/legacy/legacy_service.ts
@@ -251,6 +251,7 @@ export class LegacyService implements CoreService {
csp: setupDeps.core.http.csp,
getServerInfo: setupDeps.core.http.getServerInfo,
},
+ i18n: setupDeps.core.i18n,
logging: {
configure: (config$) => setupDeps.core.logging.configure([], config$),
},
diff --git a/src/core/server/metrics/metrics_service.mock.ts b/src/core/server/metrics/metrics_service.mock.ts
index 0d9e9af39317c..6faccc9c9da56 100644
--- a/src/core/server/metrics/metrics_service.mock.ts
+++ b/src/core/server/metrics/metrics_service.mock.ts
@@ -19,7 +19,7 @@
import { BehaviorSubject } from 'rxjs';
import type { PublicMethodsOf } from '@kbn/utility-types';
-import { MetricsService } from './metrics_service';
+import type { MetricsService } from './metrics_service';
import {
InternalMetricsServiceSetup,
InternalMetricsServiceStart,
diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts
index 8ca0c82219ed4..03a0ae2d6443a 100644
--- a/src/core/server/mocks.ts
+++ b/src/core/server/mocks.ts
@@ -38,6 +38,7 @@ import { metricsServiceMock } from './metrics/metrics_service.mock';
import { environmentServiceMock } from './environment/environment_service.mock';
import { statusServiceMock } from './status/status_service.mock';
import { coreUsageDataServiceMock } from './core_usage_data/core_usage_data_service.mock';
+import { i18nServiceMock } from './i18n/i18n_service.mock';
export { configServiceMock } from './config/mocks';
export { httpServerMock } from './http/http_server.mocks';
@@ -57,6 +58,7 @@ export { statusServiceMock } from './status/status_service.mock';
export { contextServiceMock } from './context/context_service.mock';
export { capabilitiesServiceMock } from './capabilities/capabilities_service.mock';
export { coreUsageDataServiceMock } from './core_usage_data/core_usage_data_service.mock';
+export { i18nServiceMock } from './i18n/i18n_service.mock';
export function pluginInitializerContextConfigMock(config: T) {
const globalConfig: SharedGlobalConfig = {
@@ -136,6 +138,7 @@ function createCoreSetupMock({
context: contextServiceMock.createSetupContract(),
elasticsearch: elasticsearchServiceMock.createSetup(),
http: httpMock,
+ i18n: i18nServiceMock.createSetupContract(),
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
status: statusServiceMock.createSetupContract(),
uiSettings: uiSettingsMock,
@@ -172,6 +175,7 @@ function createInternalCoreSetupMock() {
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
status: statusServiceMock.createInternalSetupContract(),
environment: environmentServiceMock.createSetupContract(),
+ i18n: i18nServiceMock.createSetupContract(),
httpResources: httpResourcesMock.createSetupContract(),
rendering: renderingMock.createSetupContract(),
uiSettings: uiSettingsServiceMock.createSetupContract(),
diff --git a/src/core/server/plugins/plugin_context.ts b/src/core/server/plugins/plugin_context.ts
index 22e79741e854c..3b2634ddbe315 100644
--- a/src/core/server/plugins/plugin_context.ts
+++ b/src/core/server/plugins/plugin_context.ts
@@ -176,6 +176,7 @@ export function createPluginSetupContext(
csp: deps.http.csp,
getServerInfo: deps.http.getServerInfo,
},
+ i18n: deps.i18n,
logging: {
configure: (config$) => deps.logging.configure(['plugins', plugin.name], config$),
},
diff --git a/src/core/server/plugins/plugins_service.mock.ts b/src/core/server/plugins/plugins_service.mock.ts
index 14d6de889dd42..3ea8badb0f450 100644
--- a/src/core/server/plugins/plugins_service.mock.ts
+++ b/src/core/server/plugins/plugins_service.mock.ts
@@ -17,7 +17,7 @@
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
-import { PluginsService, PluginsServiceSetup } from './plugins_service';
+import type { PluginsService, PluginsServiceSetup } from './plugins_service';
type PluginsServiceMock = jest.Mocked>;
diff --git a/src/core/server/plugins/plugins_service.test.ts b/src/core/server/plugins/plugins_service.test.ts
index 64a382e539fb0..02b82c17ed4fc 100644
--- a/src/core/server/plugins/plugins_service.test.ts
+++ b/src/core/server/plugins/plugins_service.test.ts
@@ -127,6 +127,7 @@ async function testSetup(options: { isDevClusterMaster?: boolean } = {}) {
[mockPluginSystem] = MockPluginsSystem.mock.instances as any;
mockPluginSystem.uiPlugins.mockReturnValue(new Map());
+ mockPluginSystem.getPlugins.mockReturnValue([]);
environmentSetup = environmentServiceMock.createSetupContract();
}
@@ -469,6 +470,22 @@ describe('PluginsService', () => {
deprecationProvider
);
});
+
+ it('returns the paths of the plugins', async () => {
+ const pluginA = createPlugin('A', { path: '/plugin-A-path', configPath: 'pathA' });
+ const pluginB = createPlugin('B', { path: '/plugin-B-path', configPath: 'pathB' });
+
+ mockDiscover.mockReturnValue({
+ error$: from([]),
+ plugin$: from([]),
+ });
+
+ mockPluginSystem.getPlugins.mockReturnValue([pluginA, pluginB]);
+
+ const { pluginPaths } = await pluginsService.discover({ environment: environmentSetup });
+
+ expect(pluginPaths).toEqual(['/plugin-A-path', '/plugin-B-path']);
+ });
});
describe('#generateUiPluginsConfigs()', () => {
@@ -633,6 +650,7 @@ describe('PluginService when isDevClusterMaster is true', () => {
await expect(pluginsService.discover({ environment: environmentSetup })).resolves
.toMatchInlineSnapshot(`
Object {
+ "pluginPaths": Array [],
"pluginTree": undefined,
"uiPlugins": Object {
"browserConfigs": Map {},
diff --git a/src/core/server/plugins/plugins_service.ts b/src/core/server/plugins/plugins_service.ts
index a1062bde7765f..5967e6d5358de 100644
--- a/src/core/server/plugins/plugins_service.ts
+++ b/src/core/server/plugins/plugins_service.ts
@@ -118,6 +118,7 @@ export class PluginsService implements CoreService plugin.path),
uiPlugins: {
internal: this.uiPluginInternalInfo,
public: uiPlugins,
diff --git a/src/core/server/plugins/plugins_system.test.ts b/src/core/server/plugins/plugins_system.test.ts
index ae9267ca5cf60..89a3697ebe9cd 100644
--- a/src/core/server/plugins/plugins_system.test.ts
+++ b/src/core/server/plugins/plugins_system.test.ts
@@ -92,6 +92,15 @@ test('can be setup even without plugins', async () => {
expect(pluginsSetup.size).toBe(0);
});
+test('getPlugins returns the list of plugins', () => {
+ const pluginA = createPlugin('plugin-a');
+ const pluginB = createPlugin('plugin-b');
+ pluginsSystem.addPlugin(pluginA);
+ pluginsSystem.addPlugin(pluginB);
+
+ expect(pluginsSystem.getPlugins()).toEqual([pluginA, pluginB]);
+});
+
test('getPluginDependencies returns dependency tree of symbols', () => {
pluginsSystem.addPlugin(createPlugin('plugin-a', { required: ['no-dep'] }));
pluginsSystem.addPlugin(
diff --git a/src/core/server/plugins/plugins_system.ts b/src/core/server/plugins/plugins_system.ts
index 72d2cfe158b37..23dc77b7bf673 100644
--- a/src/core/server/plugins/plugins_system.ts
+++ b/src/core/server/plugins/plugins_system.ts
@@ -42,6 +42,10 @@ export class PluginsSystem {
this.plugins.set(plugin.name, plugin);
}
+ public getPlugins() {
+ return [...this.plugins.values()];
+ }
+
/**
* @returns a ReadonlyMap of each plugin and an Array of its available dependencies
* @internal
diff --git a/src/core/server/rendering/__mocks__/rendering_service.ts b/src/core/server/rendering/__mocks__/rendering_service.ts
index 01d084f9ae53c..00e617de82542 100644
--- a/src/core/server/rendering/__mocks__/rendering_service.ts
+++ b/src/core/server/rendering/__mocks__/rendering_service.ts
@@ -17,8 +17,8 @@
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
-import { RenderingService as Service } from '../rendering_service';
-import { InternalRenderingServiceSetup } from '../types';
+import type { RenderingService as Service } from '../rendering_service';
+import type { InternalRenderingServiceSetup } from '../types';
import { mockRenderingServiceParams } from './params';
type IRenderingService = PublicMethodsOf;
diff --git a/src/core/server/saved_objects/saved_objects_service.mock.ts b/src/core/server/saved_objects/saved_objects_service.mock.ts
index c56cdabf6e4cd..85dbf4b5e8c6a 100644
--- a/src/core/server/saved_objects/saved_objects_service.mock.ts
+++ b/src/core/server/saved_objects/saved_objects_service.mock.ts
@@ -19,8 +19,7 @@
import { BehaviorSubject } from 'rxjs';
import type { PublicMethodsOf } from '@kbn/utility-types';
-
-import {
+import type {
SavedObjectsService,
InternalSavedObjectsServiceSetup,
InternalSavedObjectsServiceStart,
diff --git a/src/core/server/saved_objects/service/lib/search_dsl/query_params.test.ts b/src/core/server/saved_objects/service/lib/search_dsl/query_params.test.ts
index c35ec809fcf8d..e78b944183df9 100644
--- a/src/core/server/saved_objects/service/lib/search_dsl/query_params.test.ts
+++ b/src/core/server/saved_objects/service/lib/search_dsl/query_params.test.ts
@@ -103,12 +103,11 @@ describe('#getQueryParams', () => {
if (registry.isMultiNamespace(type)) {
const array = [...(namespaces ?? [DEFAULT_NAMESPACE_STRING]), ALL_NAMESPACES_STRING];
- const namespacesClause = { terms: { namespaces: array } };
return {
bool: {
must: namespaces?.includes(ALL_NAMESPACES_STRING)
- ? expect.not.arrayContaining([namespacesClause])
- : expect.arrayContaining([namespacesClause]),
+ ? [{ term: { type } }]
+ : [{ term: { type } }, { terms: { namespaces: array } }],
must_not: [{ exists: { field: 'namespace' } }],
},
};
diff --git a/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts b/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts
index 2ecba42e408e7..cb58db171681a 100644
--- a/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts
+++ b/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts
@@ -78,13 +78,19 @@ function getClauseForType(
const searchAcrossAllNamespaces = namespaces.includes(ALL_NAMESPACES_STRING);
if (registry.isMultiNamespace(type)) {
- const namespacesFilterClause = searchAcrossAllNamespaces
- ? {}
- : { terms: { namespaces: [...namespaces, ALL_NAMESPACES_STRING] } };
+ const typeFilterClause = { term: { type } };
+
+ const namespacesFilterClause = {
+ terms: { namespaces: [...namespaces, ALL_NAMESPACES_STRING] },
+ };
+
+ const must = searchAcrossAllNamespaces
+ ? [typeFilterClause]
+ : [typeFilterClause, namespacesFilterClause];
return {
bool: {
- must: [{ term: { type } }, namespacesFilterClause],
+ must,
must_not: [{ exists: { field: 'namespace' } }],
},
};
diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md
index 52500673f7f31..88d7fecbcf502 100644
--- a/src/core/server/server.api.md
+++ b/src/core/server/server.api.md
@@ -480,6 +480,8 @@ export interface CoreSetup HttpServerInfo;
}
+// @public (undocumented)
+export interface I18nServiceSetup {
+ getLocale(): string;
+ getTranslationFiles(): string[];
+}
+
// @public
export type IBasePath = Pick;
diff --git a/src/core/server/server.test.mocks.ts b/src/core/server/server.test.mocks.ts
index fe299c6d11675..d2d6990dc5451 100644
--- a/src/core/server/server.test.mocks.ts
+++ b/src/core/server/server.test.mocks.ts
@@ -100,3 +100,9 @@ export const mockLoggingService = loggingServiceMock.create();
jest.doMock('./logging/logging_service', () => ({
LoggingService: jest.fn(() => mockLoggingService),
}));
+
+import { i18nServiceMock } from './i18n/i18n_service.mock';
+export const mockI18nService = i18nServiceMock.create();
+jest.doMock('./i18n/i18n_service', () => ({
+ I18nService: jest.fn(() => mockI18nService),
+}));
diff --git a/src/core/server/server.test.ts b/src/core/server/server.test.ts
index 78703ceeec7ae..0c7ebbcb527ec 100644
--- a/src/core/server/server.test.ts
+++ b/src/core/server/server.test.ts
@@ -31,6 +31,7 @@ import {
mockMetricsService,
mockStatusService,
mockLoggingService,
+ mockI18nService,
} from './server.test.mocks';
import { BehaviorSubject } from 'rxjs';
@@ -49,6 +50,7 @@ beforeEach(() => {
mockConfigService.atPath.mockReturnValue(new BehaviorSubject({ autoListen: true }));
mockPluginsService.discover.mockResolvedValue({
pluginTree: { asOpaqueIds: new Map(), asNames: new Map() },
+ pluginPaths: [],
uiPlugins: { internal: new Map(), public: new Map(), browserConfigs: new Map() },
});
});
@@ -70,6 +72,7 @@ test('sets up services on "setup"', async () => {
expect(mockMetricsService.setup).not.toHaveBeenCalled();
expect(mockStatusService.setup).not.toHaveBeenCalled();
expect(mockLoggingService.setup).not.toHaveBeenCalled();
+ expect(mockI18nService.setup).not.toHaveBeenCalled();
await server.setup();
@@ -83,6 +86,7 @@ test('sets up services on "setup"', async () => {
expect(mockMetricsService.setup).toHaveBeenCalledTimes(1);
expect(mockStatusService.setup).toHaveBeenCalledTimes(1);
expect(mockLoggingService.setup).toHaveBeenCalledTimes(1);
+ expect(mockI18nService.setup).toHaveBeenCalledTimes(1);
});
test('injects legacy dependency to context#setup()', async () => {
@@ -96,6 +100,7 @@ test('injects legacy dependency to context#setup()', async () => {
]);
mockPluginsService.discover.mockResolvedValue({
pluginTree: { asOpaqueIds: pluginDependencies, asNames: new Map() },
+ pluginPaths: [],
uiPlugins: { internal: new Map(), public: new Map(), browserConfigs: new Map() },
});
@@ -185,6 +190,7 @@ test(`doesn't setup core services if config validation fails`, async () => {
expect(mockMetricsService.setup).not.toHaveBeenCalled();
expect(mockStatusService.setup).not.toHaveBeenCalled();
expect(mockLoggingService.setup).not.toHaveBeenCalled();
+ expect(mockI18nService.setup).not.toHaveBeenCalled();
});
test(`doesn't setup core services if legacy config validation fails`, async () => {
@@ -207,6 +213,7 @@ test(`doesn't setup core services if legacy config validation fails`, async () =
expect(mockMetricsService.setup).not.toHaveBeenCalled();
expect(mockStatusService.setup).not.toHaveBeenCalled();
expect(mockLoggingService.setup).not.toHaveBeenCalled();
+ expect(mockI18nService.setup).not.toHaveBeenCalled();
});
test(`doesn't validate config if env.isDevClusterMaster is true`, async () => {
diff --git a/src/core/server/server.ts b/src/core/server/server.ts
index eaa03d11cab98..55ed88e55a9f5 100644
--- a/src/core/server/server.ts
+++ b/src/core/server/server.ts
@@ -16,11 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import apm from 'elastic-apm-node';
import { config as pathConfig } from '@kbn/utils';
import { mapToObject } from '@kbn/std';
import { ConfigService, Env, RawConfigurationProvider, coreDeprecationProvider } from './config';
import { CoreApp } from './core_app';
+import { I18nService } from './i18n';
import { ElasticsearchService } from './elasticsearch';
import { HttpService } from './http';
import { HttpResourcesService } from './http_resources';
@@ -29,10 +31,11 @@ import { LegacyService, ensureValidConfiguration } from './legacy';
import { Logger, LoggerFactory, LoggingService, ILoggingSystem } from './logging';
import { UiSettingsService } from './ui_settings';
import { PluginsService, config as pluginsConfig } from './plugins';
-import { SavedObjectsService } from '../server/saved_objects';
+import { SavedObjectsService } from './saved_objects';
import { MetricsService, opsConfig } from './metrics';
import { CapabilitiesService } from './capabilities';
import { EnvironmentService, config as pidConfig } from './environment';
+// do not try to shorten the import to `./status`, it will break server test mocking
import { StatusService } from './status/status_service';
import { config as cspConfig } from './csp';
@@ -44,6 +47,7 @@ import { config as kibanaConfig } from './kibana_config';
import { savedObjectsConfig, savedObjectsMigrationConfig } from './saved_objects';
import { config as uiSettingsConfig } from './ui_settings';
import { config as statusConfig } from './status';
+import { config as i18nConfig } from './i18n';
import { ContextService } from './context';
import { RequestHandlerContext } from '.';
import { InternalCoreSetup, InternalCoreStart, ServiceConfigDescriptor } from './internal_types';
@@ -72,6 +76,7 @@ export class Server {
private readonly logging: LoggingService;
private readonly coreApp: CoreApp;
private readonly coreUsageData: CoreUsageDataService;
+ private readonly i18n: I18nService;
#pluginsInitialized?: boolean;
private coreStart?: InternalCoreStart;
@@ -103,6 +108,7 @@ export class Server {
this.httpResources = new HttpResourcesService(core);
this.logging = new LoggingService(core);
this.coreUsageData = new CoreUsageDataService(core);
+ this.i18n = new I18nService(core);
}
public async setup() {
@@ -112,7 +118,7 @@ export class Server {
const environmentSetup = await this.environment.setup();
// Discover any plugins before continuing. This allows other systems to utilize the plugin dependency graph.
- const { pluginTree, uiPlugins } = await this.plugins.discover({
+ const { pluginTree, pluginPaths, uiPlugins } = await this.plugins.discover({
environment: environmentSetup,
});
const legacyConfigSetup = await this.legacy.setupLegacyConfig();
@@ -125,6 +131,9 @@ export class Server {
await ensureValidConfiguration(this.configService, legacyConfigSetup);
}
+ // setup i18n prior to any other service, to have translations ready
+ const i18nServiceSetup = await this.i18n.setup({ pluginPaths });
+
const contextServiceSetup = this.context.setup({
// We inject a fake "legacy plugin" with dependencies on every plugin so that legacy plugins:
// 1) Can access context from any KP plugin
@@ -190,6 +199,7 @@ export class Server {
elasticsearch: elasticsearchServiceSetup,
environment: environmentSetup,
http: httpSetup,
+ i18n: i18nServiceSetup,
savedObjects: savedObjectsSetup,
status: statusSetup,
uiSettings: uiSettingsSetup,
@@ -302,6 +312,7 @@ export class Server {
opsConfig,
statusConfig,
pidConfig,
+ i18nConfig,
];
this.configService.addDeprecationProvider(rootConfigPath, coreDeprecationProvider);
diff --git a/src/core/server/status/status_service.mock.ts b/src/core/server/status/status_service.mock.ts
index 0ee2d03229a78..42892ddbb490c 100644
--- a/src/core/server/status/status_service.mock.ts
+++ b/src/core/server/status/status_service.mock.ts
@@ -17,7 +17,7 @@
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
-import { StatusService } from './status_service';
+import type { StatusService } from './status_service';
import {
InternalStatusServiceSetup,
StatusServiceSetup,
diff --git a/src/core/server/ui_settings/ui_settings_service.mock.ts b/src/core/server/ui_settings/ui_settings_service.mock.ts
index b1ed0dd188cde..818e9b43889e3 100644
--- a/src/core/server/ui_settings/ui_settings_service.mock.ts
+++ b/src/core/server/ui_settings/ui_settings_service.mock.ts
@@ -22,7 +22,7 @@ import {
InternalUiSettingsServiceSetup,
InternalUiSettingsServiceStart,
} from './types';
-import { UiSettingsService } from './ui_settings_service';
+import type { UiSettingsService } from './ui_settings_service';
const createClientMock = () => {
const mocked: jest.Mocked = {
diff --git a/src/core/server/ui_settings/ui_settings_service.test.ts b/src/core/server/ui_settings/ui_settings_service.test.ts
index 0c17a3a614d60..f4e24e3a517c3 100644
--- a/src/core/server/ui_settings/ui_settings_service.test.ts
+++ b/src/core/server/ui_settings/ui_settings_service.test.ts
@@ -89,6 +89,20 @@ describe('uiSettings', () => {
describe('#start', () => {
describe('validation', () => {
+ it('throws if validation schema is not provided', async () => {
+ const { register } = await service.setup(setupDeps);
+ register({
+ // @ts-expect-error schema is required key
+ custom: {
+ value: 42,
+ },
+ });
+
+ await expect(service.start()).rejects.toMatchInlineSnapshot(
+ `[Error: Validation schema is not provided for [custom] UI Setting]`
+ );
+ });
+
it('validates registered definitions', async () => {
const { register } = await service.setup(setupDeps);
register({
@@ -125,6 +139,21 @@ describe('uiSettings', () => {
`[Error: [ui settings overrides [custom]]: expected value of type [string] but got [number]]`
);
});
+
+ it('do not throw on unknown overrides', async () => {
+ const coreContext = mockCoreContext.create();
+ coreContext.configService.atPath.mockReturnValueOnce(
+ new BehaviorSubject({
+ overrides: {
+ custom: 42,
+ },
+ })
+ );
+ const customizedService = new UiSettingsService(coreContext);
+ await customizedService.setup(setupDeps);
+
+ await customizedService.start();
+ });
});
describe('#asScopedToClient', () => {
diff --git a/src/core/server/ui_settings/ui_settings_service.ts b/src/core/server/ui_settings/ui_settings_service.ts
index 25062490f5b6b..4f757d18ea7da 100644
--- a/src/core/server/ui_settings/ui_settings_service.ts
+++ b/src/core/server/ui_settings/ui_settings_service.ts
@@ -109,15 +109,17 @@ export class UiSettingsService
private validatesDefinitions() {
for (const [key, definition] of this.uiSettingsDefaults) {
- if (definition.schema) {
- definition.schema.validate(definition.value, {}, `ui settings defaults [${key}]`);
+ if (!definition.schema) {
+ throw new Error(`Validation schema is not provided for [${key}] UI Setting`);
}
+ definition.schema.validate(definition.value, {}, `ui settings defaults [${key}]`);
}
}
private validatesOverrides() {
for (const [key, value] of Object.entries(this.overrides)) {
const definition = this.uiSettingsDefaults.get(key);
+ // overrides might contain UiSettings for a disabled plugin
if (definition?.schema) {
definition.schema.validate(value, {}, `ui settings overrides [${key}]`);
}
diff --git a/src/core/utils/default_app_categories.ts b/src/core/utils/default_app_categories.ts
index 809aaddb74172..d31ed8a8eb307 100644
--- a/src/core/utils/default_app_categories.ts
+++ b/src/core/utils/default_app_categories.ts
@@ -25,7 +25,7 @@ export const DEFAULT_APP_CATEGORIES: Record = Object.freeze
kibana: {
id: 'kibana',
label: i18n.translate('core.ui.kibanaNavList.label', {
- defaultMessage: 'Kibana',
+ defaultMessage: 'Analytics',
}),
euiIconType: 'logoKibana',
order: 1000,
diff --git a/src/legacy/server/config/schema.js b/src/legacy/server/config/schema.js
index e1f03b8a08847..39df3990ff2ff 100644
--- a/src/legacy/server/config/schema.js
+++ b/src/legacy/server/config/schema.js
@@ -128,21 +128,12 @@ export default () =>
cGroupOverrides: HANDLED_IN_NEW_PLATFORM,
}).default(),
- // still used by the legacy i18n mixin
- plugins: Joi.object({
- paths: Joi.array().items(Joi.string()).default([]),
- scanDirs: Joi.array().items(Joi.string()).default([]),
- initialize: Joi.boolean().default(true),
- }).default(),
-
+ plugins: HANDLED_IN_NEW_PLATFORM,
path: HANDLED_IN_NEW_PLATFORM,
stats: HANDLED_IN_NEW_PLATFORM,
status: HANDLED_IN_NEW_PLATFORM,
map: HANDLED_IN_NEW_PLATFORM,
-
- i18n: Joi.object({
- locale: Joi.string().default('en'),
- }).default(),
+ i18n: HANDLED_IN_NEW_PLATFORM,
// temporarily moved here from the (now deleted) kibana legacy plugin
kibana: Joi.object({
diff --git a/src/legacy/server/i18n/get_kibana_translation_paths.test.ts b/src/legacy/server/i18n/get_kibana_translation_paths.test.ts
deleted file mode 100644
index 0f202c4d433c0..0000000000000
--- a/src/legacy/server/i18n/get_kibana_translation_paths.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { I18N_RC } from './constants';
-import { fromRoot } from '../../../core/server/utils';
-
-jest.mock('./get_translation_paths', () => ({ getTranslationPaths: jest.fn() }));
-import { getKibanaTranslationPaths } from './get_kibana_translation_paths';
-import { getTranslationPaths as mockGetTranslationPaths } from './get_translation_paths';
-
-describe('getKibanaTranslationPaths', () => {
- const mockConfig = { get: jest.fn() };
-
- beforeEach(() => {
- jest.resetAllMocks();
- });
-
- it('calls getTranslationPaths against kibana root and kibana-extra', async () => {
- mockConfig.get.mockReturnValue([]);
- await getKibanaTranslationPaths(mockConfig);
- expect(mockGetTranslationPaths).toHaveBeenNthCalledWith(1, {
- cwd: fromRoot('.'),
- glob: `*/${I18N_RC}`,
- });
-
- expect(mockGetTranslationPaths).toHaveBeenNthCalledWith(2, {
- cwd: fromRoot('../kibana-extra'),
- glob: `*/${I18N_RC}`,
- });
- });
-
- it('calls getTranslationPaths for each config returned in plugin.paths and plugins.scanDirs', async () => {
- mockConfig.get.mockReturnValueOnce(['a', 'b']).mockReturnValueOnce(['c']);
- await getKibanaTranslationPaths(mockConfig);
- expect(mockConfig.get).toHaveBeenNthCalledWith(1, 'plugins.paths');
- expect(mockConfig.get).toHaveBeenNthCalledWith(2, 'plugins.scanDirs');
-
- expect(mockGetTranslationPaths).toHaveBeenNthCalledWith(2, { cwd: 'a', glob: I18N_RC });
- expect(mockGetTranslationPaths).toHaveBeenNthCalledWith(3, { cwd: 'b', glob: I18N_RC });
- expect(mockGetTranslationPaths).toHaveBeenNthCalledWith(4, { cwd: 'c', glob: `*/${I18N_RC}` });
- });
-});
diff --git a/src/legacy/server/i18n/i18n_mixin.ts b/src/legacy/server/i18n/i18n_mixin.ts
deleted file mode 100644
index 0b3879073c164..0000000000000
--- a/src/legacy/server/i18n/i18n_mixin.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { i18n, i18nLoader } from '@kbn/i18n';
-import { basename } from 'path';
-import { Server } from '@hapi/hapi';
-import type { UsageCollectionSetup } from '../../../plugins/usage_collection/server';
-import { getKibanaTranslationPaths } from './get_kibana_translation_paths';
-import KbnServer, { KibanaConfig } from '../kbn_server';
-import { registerLocalizationUsageCollector } from './localization';
-
-export async function i18nMixin(
- kbnServer: KbnServer,
- server: Server,
- config: Pick
-) {
- const locale = config.get('i18n.locale') as string;
-
- const translationPaths = await getKibanaTranslationPaths(config);
-
- const currentTranslationPaths = ([] as string[])
- .concat(...translationPaths)
- .filter((translationPath) => basename(translationPath, '.json') === locale);
- i18nLoader.registerTranslationFiles(currentTranslationPaths);
-
- const translations = await i18nLoader.getTranslationsByLocale(locale);
- i18n.init(
- Object.freeze({
- locale,
- ...translations,
- })
- );
-
- const getTranslationsFilePaths = () => currentTranslationPaths;
-
- server.decorate('server', 'getTranslationsFilePaths', getTranslationsFilePaths);
-
- if (kbnServer.newPlatform.setup.plugins.usageCollection) {
- const { usageCollection } = kbnServer.newPlatform.setup.plugins as {
- usageCollection: UsageCollectionSetup;
- };
- registerLocalizationUsageCollector(usageCollection, {
- getLocale: () => config.get('i18n.locale') as string,
- getTranslationsFilePaths,
- });
- }
-}
diff --git a/src/legacy/server/kbn_server.js b/src/legacy/server/kbn_server.js
index e29563a7c6266..013da35d2acb7 100644
--- a/src/legacy/server/kbn_server.js
+++ b/src/legacy/server/kbn_server.js
@@ -31,7 +31,6 @@ import warningsMixin from './warnings';
import configCompleteMixin from './config/complete';
import { optimizeMixin } from '../../optimize';
import { uiMixin } from '../ui';
-import { i18nMixin } from './i18n';
/**
* @typedef {import('./kbn_server').KibanaConfig} KibanaConfig
@@ -82,9 +81,6 @@ export default class KbnServer {
loggingMixin,
warningsMixin,
- // scan translations dirs, register locale files and initialize i18n engine.
- i18nMixin,
-
// tell the config we are done loading plugins
configCompleteMixin,
diff --git a/src/plugins/data/common/constants.ts b/src/plugins/data/common/constants.ts
index 43120583bd3a4..a70c5eedbf847 100644
--- a/src/plugins/data/common/constants.ts
+++ b/src/plugins/data/common/constants.ts
@@ -49,4 +49,5 @@ export const UI_SETTINGS = {
INDEXPATTERN_PLACEHOLDER: 'indexPattern:placeholder',
FILTERS_PINNED_BY_DEFAULT: 'filters:pinnedByDefault',
FILTERS_EDITOR_SUGGEST_VALUES: 'filterEditor:suggestValues',
+ AUTOCOMPLETE_USE_TIMERANGE: 'autocomplete:useTimeRange',
} as const;
diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
index aae9b89cdc61f..19c6e9c7b8a7a 100644
--- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
+++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
@@ -98,11 +98,12 @@ export class IndexPatternsService {
* Refresh cache of index pattern ids and titles
*/
private async refreshSavedObjectsCache() {
- this.savedObjectsCache = await this.savedObjectsClient.find({
+ const so = await this.savedObjectsClient.find({
type: 'index-pattern',
fields: ['title'],
perPage: 10000,
});
+ this.savedObjectsCache = so;
}
/**
@@ -215,13 +216,13 @@ export class IndexPatternsService {
* Get field list by providing { pattern }
* @param options
*/
- getFieldsForWildcard = async (options: GetFieldsOptions = {}) => {
+ getFieldsForWildcard = async (options: GetFieldsOptions) => {
const metaFields = await this.config.get(UI_SETTINGS.META_FIELDS);
return this.apiClient.getFieldsForWildcard({
pattern: options.pattern,
metaFields,
type: options.type,
- params: options.params || {},
+ rollupIndex: options.rollupIndex,
});
};
@@ -231,13 +232,13 @@ export class IndexPatternsService {
*/
getFieldsForIndexPattern = async (
indexPattern: IndexPattern | IndexPatternSpec,
- options: GetFieldsOptions = {}
+ options?: GetFieldsOptions
) =>
this.getFieldsForWildcard({
- pattern: indexPattern.title as string,
- ...options,
type: indexPattern.type,
- params: indexPattern.typeMeta && indexPattern.typeMeta.params,
+ rollupIndex: indexPattern?.typeMeta?.params?.rollup_index,
+ ...options,
+ pattern: indexPattern.title as string,
});
/**
@@ -374,10 +375,10 @@ export class IndexPatternsService {
try {
spec.fields = isFieldRefreshRequired
? await this.refreshFieldSpecMap(spec.fields || {}, id, spec.title as string, {
- pattern: title,
+ pattern: title as string,
metaFields: await this.config.get(UI_SETTINGS.META_FIELDS),
type,
- params: typeMeta && typeMeta.params,
+ rollupIndex: typeMeta?.params?.rollupIndex,
})
: spec.fields;
} catch (err) {
diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts
index 3387bc3b3c19e..b381cc0963333 100644
--- a/src/plugins/data/common/index_patterns/types.ts
+++ b/src/plugins/data/common/index_patterns/types.ts
@@ -86,15 +86,22 @@ export interface SavedObjectsClientCommon {
}
export interface GetFieldsOptions {
- pattern?: string;
+ pattern: string;
type?: string;
- params?: any;
lookBack?: boolean;
metaFields?: string[];
+ rollupIndex?: string;
+}
+
+export interface GetFieldsOptionsTimePattern {
+ pattern: string;
+ metaFields: string[];
+ lookBack: number;
+ interval: string;
}
export interface IIndexPatternsApiClient {
- getFieldsForTimePattern: (options: GetFieldsOptions) => Promise;
+ getFieldsForTimePattern: (options: GetFieldsOptionsTimePattern) => Promise;
getFieldsForWildcard: (options: GetFieldsOptions) => Promise;
}
diff --git a/src/plugins/data/common/search/aggs/agg_config.test.ts b/src/plugins/data/common/search/aggs/agg_config.test.ts
index f6fcc29805dc4..9bb47f5cb3575 100644
--- a/src/plugins/data/common/search/aggs/agg_config.test.ts
+++ b/src/plugins/data/common/search/aggs/agg_config.test.ts
@@ -680,16 +680,6 @@ describe('AggConfig', () => {
const json = aggConfig.toExpressionAst()?.arguments.json;
expect(json).toEqual([JSON.stringify(configStates.params.json)]);
});
-
- it(`returns undefined if an expressionName doesn't exist on the agg type`, () => {
- const ac = new AggConfigs(indexPattern, [], { typesRegistry });
- const configStates = {
- type: 'unknown type',
- params: {},
- };
- const aggConfig = ac.createAggConfig(configStates);
- expect(aggConfig.toExpressionAst()).toBe(undefined);
- });
});
describe('#makeLabel', () => {
diff --git a/src/plugins/data/common/search/aggs/agg_configs.test.ts b/src/plugins/data/common/search/aggs/agg_configs.test.ts
index 803ccc70b98a7..d1c8e29a03cc7 100644
--- a/src/plugins/data/common/search/aggs/agg_configs.test.ts
+++ b/src/plugins/data/common/search/aggs/agg_configs.test.ts
@@ -150,6 +150,27 @@ describe('AggConfigs', () => {
);
expect(ac.aggs).toHaveLength(1);
});
+
+ it(`throws if trying to add an agg which doesn't have a type in the registry`, () => {
+ const configStates = [
+ {
+ enabled: true,
+ type: 'histogram',
+ params: {},
+ },
+ ];
+
+ const ac = new AggConfigs(indexPattern, configStates, { typesRegistry });
+ expect(() =>
+ ac.createAggConfig({
+ enabled: true,
+ type: 'oops',
+ params: {},
+ })
+ ).toThrowErrorMatchingInlineSnapshot(
+ `"Unable to find a registered agg type for \\"oops\\"."`
+ );
+ });
});
describe('#getRequestAggs', () => {
diff --git a/src/plugins/data/common/search/aggs/agg_configs.ts b/src/plugins/data/common/search/aggs/agg_configs.ts
index 282e6f3b538a4..368f44f161132 100644
--- a/src/plugins/data/common/search/aggs/agg_configs.ts
+++ b/src/plugins/data/common/search/aggs/agg_configs.ts
@@ -18,6 +18,7 @@
*/
import _ from 'lodash';
+import { i18n } from '@kbn/i18n';
import { Assign } from '@kbn/utility-types';
import { ISearchOptions, ISearchSource } from 'src/plugins/data/public';
@@ -122,15 +123,29 @@ export class AggConfigs {
{ addToAggConfigs = true } = {}
) => {
const { type } = params;
- let aggConfig;
+ const getType = (t: string) => {
+ const typeFromRegistry = this.typesRegistry.get(t);
+
+ if (!typeFromRegistry) {
+ throw new Error(
+ i18n.translate('data.search.aggs.error.aggNotFound', {
+ defaultMessage: 'Unable to find a registered agg type for "{type}".',
+ values: { type: type as string },
+ })
+ );
+ }
+ return typeFromRegistry;
+ };
+
+ let aggConfig;
if (params instanceof AggConfig) {
aggConfig = params;
params.parent = this;
} else {
aggConfig = new AggConfig(this, {
...params,
- type: typeof type === 'string' ? this.typesRegistry.get(type) : type,
+ type: typeof type === 'string' ? getType(type) : type,
});
}
diff --git a/src/plugins/expressions/common/expression_functions/specs/tests/__snapshots__/kibana.test.ts.snap b/src/plugins/data/common/search/expressions/__snapshots__/kibana.test.ts.snap
similarity index 100%
rename from src/plugins/expressions/common/expression_functions/specs/tests/__snapshots__/kibana.test.ts.snap
rename to src/plugins/data/common/search/expressions/__snapshots__/kibana.test.ts.snap
diff --git a/src/plugins/data/common/search/expressions/esaggs.ts b/src/plugins/data/common/search/expressions/esaggs.ts
index 4f65babdcd360..47d97a81a67b1 100644
--- a/src/plugins/data/common/search/expressions/esaggs.ts
+++ b/src/plugins/data/common/search/expressions/esaggs.ts
@@ -17,11 +17,8 @@
* under the License.
*/
-import {
- KibanaContext,
- Datatable,
- ExpressionFunctionDefinition,
-} from '../../../../../plugins/expressions/common';
+import { Datatable, ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
+import { KibanaContext } from './kibana_context_type';
type Input = KibanaContext | null;
type Output = Promise;
diff --git a/src/plugins/data/common/search/expressions/index.ts b/src/plugins/data/common/search/expressions/index.ts
index 25839a805d8c5..28d892d091956 100644
--- a/src/plugins/data/common/search/expressions/index.ts
+++ b/src/plugins/data/common/search/expressions/index.ts
@@ -17,5 +17,8 @@
* under the License.
*/
+export * from './kibana';
+export * from './kibana_context';
+export * from './kibana_context_type';
export * from './esaggs';
export * from './utils';
diff --git a/src/plugins/expressions/common/expression_functions/specs/tests/kibana.test.ts b/src/plugins/data/common/search/expressions/kibana.test.ts
similarity index 92%
rename from src/plugins/expressions/common/expression_functions/specs/tests/kibana.test.ts
rename to src/plugins/data/common/search/expressions/kibana.test.ts
index e5c4b92de4fdb..58fee1ee1f6a6 100644
--- a/src/plugins/expressions/common/expression_functions/specs/tests/kibana.test.ts
+++ b/src/plugins/data/common/search/expressions/kibana.test.ts
@@ -17,14 +17,14 @@
* under the License.
*/
+import { ExecutionContext } from 'src/plugins/expressions/common';
+import { kibana } from './kibana';
+import { ExpressionValueSearchContext } from './kibana_context_type';
import { functionWrapper } from './utils';
-import { kibana } from '../kibana';
-import { ExecutionContext } from '../../../execution/types';
-import { KibanaContext, ExpressionValueSearchContext } from '../../../expression_types';
describe('interpreter/functions#kibana', () => {
const fn = functionWrapper(kibana);
- let input: Partial;
+ let input: Partial;
let search: ExpressionValueSearchContext;
let context: ExecutionContext;
diff --git a/src/plugins/expressions/common/expression_functions/specs/kibana.ts b/src/plugins/data/common/search/expressions/kibana.ts
similarity index 82%
rename from src/plugins/expressions/common/expression_functions/specs/kibana.ts
rename to src/plugins/data/common/search/expressions/kibana.ts
index 3ec4c23eab28d..c31219284760a 100644
--- a/src/plugins/expressions/common/expression_functions/specs/kibana.ts
+++ b/src/plugins/data/common/search/expressions/kibana.ts
@@ -18,8 +18,9 @@
*/
import { i18n } from '@kbn/i18n';
-import { ExpressionFunctionDefinition } from '../types';
-import { ExpressionValueSearchContext } from '../../expression_types';
+import { ExecutionContext, ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
+import { Adapters } from 'src/plugins/inspector/common';
+import { ExpressionValueSearchContext, ExecutionContextSearch } from './kibana_context_type';
const toArray = (query: undefined | T | T[]): T[] =>
!query ? [] : Array.isArray(query) ? query : [query];
@@ -29,7 +30,8 @@ export type ExpressionFunctionKibana = ExpressionFunctionDefinition<
// TODO: Get rid of the `null` type below.
ExpressionValueSearchContext | null,
object,
- ExpressionValueSearchContext
+ ExpressionValueSearchContext,
+ ExecutionContext
>;
export const kibana: ExpressionFunctionKibana = {
@@ -38,7 +40,7 @@ export const kibana: ExpressionFunctionKibana = {
inputTypes: ['kibana_context', 'null'],
- help: i18n.translate('expressions.functions.kibana.help', {
+ help: i18n.translate('data.search.functions.kibana.help', {
defaultMessage: 'Gets kibana global context',
}),
diff --git a/src/plugins/expressions/common/expression_functions/specs/kibana_context.ts b/src/plugins/data/common/search/expressions/kibana_context.ts
similarity index 84%
rename from src/plugins/expressions/common/expression_functions/specs/kibana_context.ts
rename to src/plugins/data/common/search/expressions/kibana_context.ts
index 2b7d1b8ed9d76..7bf14ff02316e 100644
--- a/src/plugins/expressions/common/expression_functions/specs/kibana_context.ts
+++ b/src/plugins/data/common/search/expressions/kibana_context.ts
@@ -16,11 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import { uniqBy } from 'lodash';
import { i18n } from '@kbn/i18n';
-import { ExpressionFunctionDefinition } from '../../expression_functions';
-import { KibanaContext } from '../../expression_types';
-import { Query, uniqFilters } from '../../../../data/common';
+import { ExpressionFunctionDefinition, ExecutionContext } from 'src/plugins/expressions/common';
+import { Adapters } from 'src/plugins/inspector/common';
+import { Query, uniqFilters } from '../../query';
+import { ExecutionContextSearch, KibanaContext } from './kibana_context_type';
interface Arguments {
q?: string | null;
@@ -33,7 +35,8 @@ export type ExpressionFunctionKibanaContext = ExpressionFunctionDefinition<
'kibana_context',
KibanaContext | null,
Arguments,
- Promise
+ Promise,
+ ExecutionContext
>;
const getParsedValue = (data: any, defaultValue: any) =>
@@ -49,7 +52,7 @@ export const kibanaContextFunction: ExpressionFunctionKibanaContext = {
name: 'kibana_context',
type: 'kibana_context',
inputTypes: ['kibana_context', 'null'],
- help: i18n.translate('expressions.functions.kibana_context.help', {
+ help: i18n.translate('data.search.functions.kibana_context.help', {
defaultMessage: 'Updates kibana global context',
}),
args: {
@@ -57,28 +60,28 @@ export const kibanaContextFunction: ExpressionFunctionKibanaContext = {
types: ['string', 'null'],
aliases: ['query', '_'],
default: null,
- help: i18n.translate('expressions.functions.kibana_context.q.help', {
+ help: i18n.translate('data.search.functions.kibana_context.q.help', {
defaultMessage: 'Specify Kibana free form text query',
}),
},
filters: {
types: ['string', 'null'],
default: '"[]"',
- help: i18n.translate('expressions.functions.kibana_context.filters.help', {
+ help: i18n.translate('data.search.functions.kibana_context.filters.help', {
defaultMessage: 'Specify Kibana generic filters',
}),
},
timeRange: {
types: ['string', 'null'],
default: null,
- help: i18n.translate('expressions.functions.kibana_context.timeRange.help', {
+ help: i18n.translate('data.search.functions.kibana_context.timeRange.help', {
defaultMessage: 'Specify Kibana time range filter',
}),
},
savedSearchId: {
types: ['string', 'null'],
default: null,
- help: i18n.translate('expressions.functions.kibana_context.savedSearchId.help', {
+ help: i18n.translate('data.search.functions.kibana_context.savedSearchId.help', {
defaultMessage: 'Specify saved search ID to be used for queries and filters',
}),
},
diff --git a/src/plugins/expressions/common/expression_types/specs/kibana_context.ts b/src/plugins/data/common/search/expressions/kibana_context_type.ts
similarity index 79%
rename from src/plugins/expressions/common/expression_types/specs/kibana_context.ts
rename to src/plugins/data/common/search/expressions/kibana_context_type.ts
index 3af7b990429c0..a5b459a607991 100644
--- a/src/plugins/expressions/common/expression_types/specs/kibana_context.ts
+++ b/src/plugins/data/common/search/expressions/kibana_context_type.ts
@@ -17,8 +17,16 @@
* under the License.
*/
-import { ExpressionValueBoxed } from '../types';
-import { ExecutionContextSearch } from '../../execution/types';
+import { ExpressionValueBoxed } from 'src/plugins/expressions/common';
+import { Filter } from '../../es_query';
+import { Query, TimeRange } from '../../query';
+
+// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
+export type ExecutionContextSearch = {
+ filters?: Filter[];
+ query?: Query | Query[];
+ timeRange?: TimeRange;
+};
export type ExpressionValueSearchContext = ExpressionValueBoxed<
'kibana_context',
diff --git a/src/plugins/data/common/search/expressions/utils/function_wrapper.ts b/src/plugins/data/common/search/expressions/utils/function_wrapper.ts
new file mode 100644
index 0000000000000..b5e45d9ca1de0
--- /dev/null
+++ b/src/plugins/data/common/search/expressions/utils/function_wrapper.ts
@@ -0,0 +1,34 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { mapValues } from 'lodash';
+import { AnyExpressionFunctionDefinition, ExecutionContext } from 'src/plugins/expressions/common';
+
+/**
+ * Takes a function spec and passes in default args,
+ * overriding with any provided args.
+ */
+export const functionWrapper = (spec: AnyExpressionFunctionDefinition) => {
+ const defaultArgs = mapValues(spec.args, (argSpec) => argSpec.default);
+ return (
+ context: object | null,
+ args: Record = {},
+ handlers: ExecutionContext = {} as ExecutionContext
+ ) => spec.fn(context, { ...defaultArgs, ...args }, handlers);
+};
diff --git a/src/plugins/data/common/search/expressions/utils/index.ts b/src/plugins/data/common/search/expressions/utils/index.ts
index 75c1809770c78..39f88b0f13fee 100644
--- a/src/plugins/data/common/search/expressions/utils/index.ts
+++ b/src/plugins/data/common/search/expressions/utils/index.ts
@@ -18,3 +18,4 @@
*/
export * from './courier_inspector_stats';
+export * from './function_wrapper';
diff --git a/src/plugins/data/common/utils/index.ts b/src/plugins/data/common/utils/index.ts
index 33989f3ad50a7..8b8686c51b9c1 100644
--- a/src/plugins/data/common/utils/index.ts
+++ b/src/plugins/data/common/utils/index.ts
@@ -19,4 +19,3 @@
/** @internal */
export { shortenDottedString } from './shorten_dotted_string';
-export { AbortError, toPromise, getCombinedSignal } from './abort_utils';
diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json
index 9cb9b1745373a..d6f2534bd5e3b 100644
--- a/src/plugins/data/kibana.json
+++ b/src/plugins/data/kibana.json
@@ -8,7 +8,7 @@
"uiActions"
],
"optionalPlugins": ["usageCollection"],
- "extraPublicDirs": ["common", "common/utils/abort_utils"],
+ "extraPublicDirs": ["common"],
"requiredBundles": [
"usageCollection",
"kibanaUtils",
diff --git a/src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts b/src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts
index 16500ac9e239a..da523e740c3d6 100644
--- a/src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts
+++ b/src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts
@@ -39,6 +39,7 @@ export interface QuerySuggestionGetFnArgs {
selectionStart: number;
selectionEnd: number;
signal?: AbortSignal;
+ useTimeRange?: boolean;
boolFilter?: any;
}
diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts
index 6b0c0f07cf6c9..0ef5b7db958e4 100644
--- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts
+++ b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.test.ts
@@ -21,6 +21,26 @@ import { stubIndexPattern, stubFields } from '../../stubs';
import { setupValueSuggestionProvider, ValueSuggestionsGetFn } from './value_suggestion_provider';
import { IUiSettingsClient, CoreSetup } from 'kibana/public';
+jest.mock('../../services', () => ({
+ getQueryService: () => ({
+ timefilter: {
+ timefilter: {
+ createFilter: () => {
+ return {
+ time: 'fake',
+ };
+ },
+ getTime: () => {
+ return {
+ to: 'now',
+ from: 'now-15m',
+ };
+ },
+ },
+ },
+ }),
+}));
+
describe('FieldSuggestions', () => {
let getValueSuggestions: ValueSuggestionsGetFn;
let http: any;
@@ -94,6 +114,7 @@ describe('FieldSuggestions', () => {
indexPattern: stubIndexPattern,
field,
query: '',
+ useTimeRange: false,
});
expect(http.fetch).toHaveBeenCalled();
@@ -107,6 +128,7 @@ describe('FieldSuggestions', () => {
indexPattern: stubIndexPattern,
field,
query: '',
+ useTimeRange: false,
};
await getValueSuggestions(args);
@@ -123,6 +145,7 @@ describe('FieldSuggestions', () => {
indexPattern: stubIndexPattern,
field,
query: '',
+ useTimeRange: false,
};
const { now } = Date;
@@ -146,50 +169,76 @@ describe('FieldSuggestions', () => {
indexPattern: stubIndexPattern,
field: fields[0],
query: '',
+ useTimeRange: false,
});
await getValueSuggestions({
indexPattern: stubIndexPattern,
field: fields[0],
query: 'query',
+ useTimeRange: false,
});
await getValueSuggestions({
indexPattern: stubIndexPattern,
field: fields[1],
query: '',
+ useTimeRange: false,
});
await getValueSuggestions({
indexPattern: stubIndexPattern,
field: fields[1],
query: 'query',
+ useTimeRange: false,
});
const customIndexPattern = {
...stubIndexPattern,
title: 'customIndexPattern',
+ useTimeRange: false,
};
await getValueSuggestions({
indexPattern: customIndexPattern,
field: fields[0],
query: '',
+ useTimeRange: false,
});
await getValueSuggestions({
indexPattern: customIndexPattern,
field: fields[0],
query: 'query',
+ useTimeRange: false,
});
await getValueSuggestions({
indexPattern: customIndexPattern,
field: fields[1],
query: '',
+ useTimeRange: false,
});
await getValueSuggestions({
indexPattern: customIndexPattern,
field: fields[1],
query: 'query',
+ useTimeRange: false,
});
expect(http.fetch).toHaveBeenCalledTimes(8);
});
+
+ it('should apply timefilter', async () => {
+ const [field] = stubFields.filter(
+ ({ type, aggregatable }) => type === 'string' && aggregatable
+ );
+
+ await getValueSuggestions({
+ indexPattern: stubIndexPattern,
+ field,
+ query: '',
+ useTimeRange: true,
+ });
+ const callParams = http.fetch.mock.calls[0][1];
+
+ expect(JSON.parse(callParams.body).filters).toHaveLength(1);
+ expect(http.fetch).toHaveBeenCalled();
+ });
});
});
diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts
index a6a45a26f06b3..fe9f939a0261d 100644
--- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts
+++ b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts
@@ -17,15 +17,16 @@
* under the License.
*/
+import dateMath from '@elastic/datemath';
import { memoize } from 'lodash';
import { CoreSetup } from 'src/core/public';
-import { IIndexPattern, IFieldType, UI_SETTINGS } from '../../../common';
+import { IIndexPattern, IFieldType, UI_SETTINGS, buildQueryFromFilters } from '../../../common';
+import { getQueryService } from '../../services';
-function resolver(title: string, field: IFieldType, query: string, boolFilter: any) {
+function resolver(title: string, field: IFieldType, query: string, filters: any[]) {
// Only cache results for a minute
const ttl = Math.floor(Date.now() / 1000 / 60);
-
- return [ttl, query, title, field.name, JSON.stringify(boolFilter)].join('|');
+ return [ttl, query, title, field.name, JSON.stringify(filters)].join('|');
}
export type ValueSuggestionsGetFn = (args: ValueSuggestionsGetFnArgs) => Promise;
@@ -34,18 +35,31 @@ interface ValueSuggestionsGetFnArgs {
indexPattern: IIndexPattern;
field: IFieldType;
query: string;
+ useTimeRange?: boolean;
boolFilter?: any[];
signal?: AbortSignal;
}
+const getAutocompleteTimefilter = (indexPattern: IIndexPattern) => {
+ const { timefilter } = getQueryService().timefilter;
+ const timeRange = timefilter.getTime();
+
+ // Use a rounded timerange so that memoizing works properly
+ const roundedTimerange = {
+ from: dateMath.parse(timeRange.from)!.startOf('minute').toISOString(),
+ to: dateMath.parse(timeRange.to)!.endOf('minute').toISOString(),
+ };
+ return timefilter.createFilter(indexPattern, roundedTimerange);
+};
+
export const getEmptyValueSuggestions = (() => Promise.resolve([])) as ValueSuggestionsGetFn;
export const setupValueSuggestionProvider = (core: CoreSetup): ValueSuggestionsGetFn => {
const requestSuggestions = memoize(
- (index: string, field: IFieldType, query: string, boolFilter: any = [], signal?: AbortSignal) =>
+ (index: string, field: IFieldType, query: string, filters: any = [], signal?: AbortSignal) =>
core.http.fetch(`/api/kibana/suggestions/values/${index}`, {
method: 'POST',
- body: JSON.stringify({ query, field: field.name, boolFilter }),
+ body: JSON.stringify({ query, field: field.name, filters }),
signal,
}),
resolver
@@ -55,12 +69,15 @@ export const setupValueSuggestionProvider = (core: CoreSetup): ValueSuggestionsG
indexPattern,
field,
query,
+ useTimeRange,
boolFilter,
signal,
}: ValueSuggestionsGetFnArgs): Promise => {
const shouldSuggestValues = core!.uiSettings.get(
UI_SETTINGS.FILTERS_EDITOR_SUGGEST_VALUES
);
+ useTimeRange =
+ useTimeRange ?? core!.uiSettings.get(UI_SETTINGS.AUTOCOMPLETE_USE_TIMERANGE);
const { title } = indexPattern;
if (field.type === 'boolean') {
@@ -69,6 +86,9 @@ export const setupValueSuggestionProvider = (core: CoreSetup): ValueSuggestionsG
return [];
}
- return await requestSuggestions(title, field, query, boolFilter, signal);
+ const timeFilter = useTimeRange ? getAutocompleteTimefilter(indexPattern) : undefined;
+ const filterQuery = timeFilter ? buildQueryFromFilters([timeFilter], indexPattern).filter : [];
+ const filters = [...(boolFilter ? boolFilter : []), ...filterQuery];
+ return await requestSuggestions(title, field, query, filters, signal);
};
};
diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts
index ce020a9742399..129addf3de70e 100644
--- a/src/plugins/data/public/index.ts
+++ b/src/plugins/data/public/index.ts
@@ -338,6 +338,12 @@ export {
OptionedParamType,
OptionedValueProp,
ParsedInterval,
+ // expressions
+ ExecutionContextSearch,
+ ExpressionFunctionKibana,
+ ExpressionFunctionKibanaContext,
+ ExpressionValueSearchContext,
+ KibanaContext,
// tabify
TabbedAggColumn,
TabbedAggRow,
diff --git a/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.test.ts b/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.test.ts
index 37ee80c2c29e4..8c48ee44fba9c 100644
--- a/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.test.ts
+++ b/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.test.ts
@@ -32,7 +32,12 @@ describe('IndexPatternsApiClient', () => {
test('uses the right URI to fetch fields for time patterns', async function () {
const expectedPath = '/api/index_patterns/_fields_for_time_pattern';
- await indexPatternsApiClient.getFieldsForTimePattern();
+ await indexPatternsApiClient.getFieldsForTimePattern({
+ pattern: 'blah',
+ metaFields: [],
+ lookBack: 5,
+ interval: '',
+ });
expect(fetchSpy).toHaveBeenCalledWith(expectedPath, expect.any(Object));
});
@@ -40,15 +45,7 @@ describe('IndexPatternsApiClient', () => {
test('uses the right URI to fetch fields for wildcard', async function () {
const expectedPath = '/api/index_patterns/_fields_for_wildcard';
- await indexPatternsApiClient.getFieldsForWildcard();
-
- expect(fetchSpy).toHaveBeenCalledWith(expectedPath, expect.any(Object));
- });
-
- test('uses the right URI to fetch fields for wildcard given a type', async function () {
- const expectedPath = '/api/index_patterns/rollup/_fields_for_wildcard';
-
- await indexPatternsApiClient.getFieldsForWildcard({ type: 'rollup' });
+ await indexPatternsApiClient.getFieldsForWildcard({ pattern: 'blah' });
expect(fetchSpy).toHaveBeenCalledWith(expectedPath, expect.any(Object));
});
diff --git a/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.ts b/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.ts
index 377a3f7f91a50..ca0f35d6612b2 100644
--- a/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.ts
+++ b/src/plugins/data/public/index_patterns/index_patterns/index_patterns_api_client.ts
@@ -19,7 +19,11 @@
import { HttpSetup } from 'src/core/public';
import { IndexPatternMissingIndices } from '../../../common/index_patterns/lib';
-import { GetFieldsOptions, IIndexPatternsApiClient } from '../../../common/index_patterns/types';
+import {
+ GetFieldsOptions,
+ IIndexPatternsApiClient,
+ GetFieldsOptionsTimePattern,
+} from '../../../common/index_patterns/types';
const API_BASE_URL: string = `/api/index_patterns/`;
@@ -48,7 +52,7 @@ export class IndexPatternsApiClient implements IIndexPatternsApiClient {
return API_BASE_URL + path.filter(Boolean).map(encodeURIComponent).join('/');
}
- getFieldsForTimePattern(options: GetFieldsOptions = {}) {
+ getFieldsForTimePattern(options: GetFieldsOptionsTimePattern) {
const { pattern, lookBack, metaFields } = options;
const url = this._getUrl(['_fields_for_time_pattern']);
@@ -60,27 +64,12 @@ export class IndexPatternsApiClient implements IIndexPatternsApiClient {
}).then((resp: any) => resp.fields);
}
- getFieldsForWildcard(options: GetFieldsOptions = {}) {
- const { pattern, metaFields, type, params } = options;
-
- let url;
- let query;
-
- if (type) {
- url = this._getUrl([type, '_fields_for_wildcard']);
- query = {
- pattern,
- meta_fields: metaFields,
- params: JSON.stringify(params),
- };
- } else {
- url = this._getUrl(['_fields_for_wildcard']);
- query = {
- pattern,
- meta_fields: metaFields,
- };
- }
-
- return this._request(url, query).then((resp: any) => resp.fields);
+ getFieldsForWildcard({ pattern, metaFields, type, rollupIndex }: GetFieldsOptions) {
+ return this._request(this._getUrl(['_fields_for_wildcard']), {
+ pattern,
+ meta_fields: metaFields,
+ type,
+ rollup_index: rollupIndex,
+ }).then((resp: any) => resp.fields);
}
}
diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts
index 5abf4d3648af7..afa8d935f367b 100644
--- a/src/plugins/data/public/plugin.ts
+++ b/src/plugins/data/public/plugin.ts
@@ -72,6 +72,7 @@ import {
import { SavedObjectsClientPublicToCommon } from './index_patterns';
import { indexPatternLoad } from './index_patterns/expressions/load_index_pattern';
+import { UsageCollectionSetup } from '../../usage_collection/public';
declare module '../../ui_actions/public' {
export interface ActionContextMapping {
@@ -94,6 +95,7 @@ export class DataPublicPlugin
private readonly fieldFormatsService: FieldFormatsService;
private readonly queryService: QueryService;
private readonly storage: IStorageWrapper;
+ private usageCollection: UsageCollectionSetup | undefined;
constructor(initializerContext: PluginInitializerContext) {
this.searchService = new SearchService(initializerContext);
@@ -112,6 +114,8 @@ export class DataPublicPlugin
expressions.registerFunction(esaggs);
expressions.registerFunction(indexPatternLoad);
+ this.usageCollection = usageCollection;
+
const queryService = this.queryService.setup({
uiSettings: core.uiSettings,
storage: this.storage,
@@ -208,6 +212,7 @@ export class DataPublicPlugin
core,
data: dataServices,
storage: this.storage,
+ trackUiMetric: this.usageCollection?.reportUiStats.bind(this.usageCollection, 'data_plugin'),
});
return {
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index d52edbe5b11dd..78b974758f8c0 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -6,6 +6,7 @@
import { $Values } from '@kbn/utility-types';
import { Action } from 'history';
+import { Adapters as Adapters_2 } from 'src/plugins/inspector/common';
import { ApiResponse } from '@elastic/elasticsearch';
import { ApiResponse as ApiResponse_2 } from '@elastic/elasticsearch/lib/Transport';
import { ApplicationStart } from 'kibana/public';
@@ -16,6 +17,7 @@ import { CoreSetup } from 'src/core/public';
import { CoreSetup as CoreSetup_2 } from 'kibana/public';
import { CoreStart } from 'kibana/public';
import { CoreStart as CoreStart_2 } from 'src/core/public';
+import { Datatable as Datatable_2 } from 'src/plugins/expressions/common';
import { DatatableColumn as DatatableColumn_2 } from 'src/plugins/expressions';
import { Ensure } from '@kbn/utility-types';
import { EnvironmentMode } from '@kbn/config';
@@ -26,8 +28,12 @@ import { EuiComboBoxProps } from '@elastic/eui';
import { EuiConfirmModalProps } from '@elastic/eui';
import { EuiGlobalToastListToast } from '@elastic/eui';
import { ExclusiveUnion } from '@elastic/eui';
+import { ExecutionContext } from 'src/plugins/expressions/common';
import { ExpressionAstFunction } from 'src/plugins/expressions/common';
+import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
+import { ExpressionFunctionDefinition as ExpressionFunctionDefinition_2 } from 'src/plugins/expressions/public';
import { ExpressionsSetup } from 'src/plugins/expressions/public';
+import { ExpressionValueBoxed } from 'src/plugins/expressions/common';
import { History } from 'history';
import { Href } from 'history';
import { IconType } from '@elastic/eui';
@@ -65,7 +71,7 @@ import { Required } from '@kbn/utility-types';
import * as Rx from 'rxjs';
import { SavedObject } from 'src/core/server';
import { SavedObject as SavedObject_2 } from 'src/core/public';
-import { SavedObjectReference as SavedObjectReference_2 } from 'src/core/types';
+import { SavedObjectReference } from 'src/core/types';
import { SavedObjectsClientContract } from 'src/core/public';
import { Search } from '@elastic/elasticsearch/api/requestParams';
import { SearchResponse } from 'elasticsearch';
@@ -78,9 +84,9 @@ import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport';
import { TypeOf } from '@kbn/config-schema';
import { UiActionsSetup } from 'src/plugins/ui_actions/public';
import { UiActionsStart } from 'src/plugins/ui_actions/public';
+import { UiStatsMetricType } from '@kbn/analytics';
import { Unit } from '@elastic/datemath';
import { UnregisterCallback } from 'history';
-import { UnwrapPromiseOrReturn } from '@kbn/utility-types';
import { UserProvidedValues } from 'src/core/server/types';
// Warning: (ae-missing-release-tag) "ACTION_GLOBAL_APPLY_FILTER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -525,7 +531,6 @@ export enum ES_FIELD_TYPES {
// @public (undocumented)
export const ES_SEARCH_STRATEGY = "es";
-// Warning: (ae-forgotten-export) The symbol "ExpressionFunctionDefinition" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Input" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Output" needs to be exported by the entry point index.d.ts
@@ -541,7 +546,7 @@ export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'e
// Warning: (ae-missing-release-tag) "EsdslExpressionFunctionDefinition" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
-export type EsdslExpressionFunctionDefinition = ExpressionFunctionDefinition;
+export type EsdslExpressionFunctionDefinition = ExpressionFunctionDefinition_2;
// Warning: (ae-missing-release-tag) "esFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -647,6 +652,15 @@ export type EsQuerySortValue = Record;
+// Warning: (ae-missing-release-tag) "ExecutionContextSearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExecutionContextSearch = {
+ filters?: Filter[];
+ query?: Query | Query[];
+ timeRange?: TimeRange;
+};
+
// Warning: (ae-missing-release-tag) "ExistsFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -655,12 +669,28 @@ export type ExistsFilter = Filter & {
exists?: FilterExistsProperty;
};
+// Warning: (ae-missing-release-tag) "ExpressionFunctionKibana" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExpressionFunctionKibana = ExpressionFunctionDefinition<'kibana', ExpressionValueSearchContext | null, object, ExpressionValueSearchContext, ExecutionContext>;
+
+// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
+// Warning: (ae-missing-release-tag) "ExpressionFunctionKibanaContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExpressionFunctionKibanaContext = ExpressionFunctionDefinition<'kibana_context', KibanaContext | null, Arguments_2, Promise, ExecutionContext>;
+
+// Warning: (ae-missing-release-tag) "ExpressionValueSearchContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExpressionValueSearchContext = ExpressionValueBoxed<'kibana_context', ExecutionContextSearch>;
+
// Warning: (ae-missing-release-tag) "extractReferences" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const extractSearchSourceReferences: (state: SearchSourceFields) => [SearchSourceFields & {
indexRefName?: string;
-}, SavedObjectReference_2[]];
+}, SavedObjectReference[]];
// Warning: (ae-missing-release-tag) "FieldFormat" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -1338,9 +1368,9 @@ export class IndexPatternsService {
// (undocumented)
getCache: () => Promise[] | null | undefined>;
getDefault: () => Promise;
- getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions) => Promise;
+ getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise;
// Warning: (ae-forgotten-export) The symbol "GetFieldsOptions" needs to be exported by the entry point index.d.ts
- getFieldsForWildcard: (options?: GetFieldsOptions) => Promise;
+ getFieldsForWildcard: (options: GetFieldsOptions) => Promise;
getIds: (refresh?: boolean) => Promise;
getIdsWithTitle: (refresh?: boolean) => Promise SearchSourceFields;
+}, references: SavedObjectReference[]) => SearchSourceFields;
// Warning: (ae-missing-release-tag) "InputTimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -1510,6 +1540,11 @@ export enum KBN_FIELD_TYPES {
UNKNOWN = "unknown"
}
+// Warning: (ae-missing-release-tag) "KibanaContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type KibanaContext = ExpressionValueSearchContext;
+
// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -1806,6 +1841,8 @@ export interface QuerySuggestionGetFnArgs {
selectionStart: number;
// (undocumented)
signal?: AbortSignal;
+ // (undocumented)
+ useTimeRange?: boolean;
}
// Warning: (ae-missing-release-tag) "QuerySuggestionTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -1962,8 +1999,8 @@ export const search: {
// Warning: (ae-missing-release-tag) "SearchBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
-export const SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "timeHistory" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "indicateNoData" | "onFiltersUpdated">, any> & {
- WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>;
+export const SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & {
+ WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>;
};
// Warning: (ae-forgotten-export) The symbol "SearchBarOwnProps" needs to be exported by the entry point index.d.ts
@@ -2275,6 +2312,7 @@ export const UI_SETTINGS: {
readonly INDEXPATTERN_PLACEHOLDER: "indexPattern:placeholder";
readonly FILTERS_PINNED_BY_DEFAULT: "filters:pinnedByDefault";
readonly FILTERS_EDITOR_SUGGEST_VALUES: "filterEditor:suggestValues";
+ readonly AUTOCOMPLETE_USE_TIMERANGE: "autocomplete:useTimeRange";
};
@@ -2321,21 +2359,21 @@ export const UI_SETTINGS: {
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:387:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:387:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:387:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:387:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:406:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:407:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:410:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:411:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:414:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:393:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:393:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:393:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:393:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:405:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:406:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:407:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:408:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:412:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:413:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:416:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:417:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:420:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:45:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)
diff --git a/src/plugins/data/public/query/timefilter/timefilter.ts b/src/plugins/data/public/query/timefilter/timefilter.ts
index 49a8c68f6916f..7278ceaaddcce 100644
--- a/src/plugins/data/public/query/timefilter/timefilter.ts
+++ b/src/plugins/data/public/query/timefilter/timefilter.ts
@@ -24,9 +24,14 @@ import { PublicMethodsOf } from '@kbn/utility-types';
import { areRefreshIntervalsDifferent, areTimeRangesDifferent } from './lib/diff_time_picker_vals';
import { getForceNow } from './lib/get_force_now';
import { TimefilterConfig, InputTimeRange, TimeRangeBounds } from './types';
-import { calculateBounds, getTime, RefreshInterval, TimeRange } from '../../../common';
+import {
+ calculateBounds,
+ getTime,
+ IIndexPattern,
+ RefreshInterval,
+ TimeRange,
+} from '../../../common';
import { TimeHistoryContract } from './time_history';
-import { IndexPattern } from '../../index_patterns';
// TODO: remove!
@@ -170,7 +175,7 @@ export class Timefilter {
}
};
- public createFilter = (indexPattern: IndexPattern, timeRange?: TimeRange) => {
+ public createFilter = (indexPattern: IIndexPattern, timeRange?: TimeRange) => {
return getTime(indexPattern, timeRange ? timeRange : this._time, {
forceNow: this.getForceNow(),
});
diff --git a/src/plugins/data/public/search/errors/timeout_error.test.tsx b/src/plugins/data/public/search/errors/timeout_error.test.tsx
index ad3384c389fbf..2547ee41cbbd7 100644
--- a/src/plugins/data/public/search/errors/timeout_error.test.tsx
+++ b/src/plugins/data/public/search/errors/timeout_error.test.tsx
@@ -23,7 +23,7 @@ import { coreMock } from '../../../../../core/public/mocks';
const startMock = coreMock.createStart();
import { mount } from 'enzyme';
-import { AbortError } from 'src/plugins/data/common';
+import { AbortError } from '../../../../kibana_utils/public';
describe('SearchTimeoutError', () => {
beforeEach(() => {
diff --git a/src/plugins/data/public/search/expressions/esdsl.ts b/src/plugins/data/public/search/expressions/esdsl.ts
index 2efb21671b5b7..07e904928744f 100644
--- a/src/plugins/data/public/search/expressions/esdsl.ts
+++ b/src/plugins/data/public/search/expressions/esdsl.ts
@@ -18,15 +18,12 @@
*/
import { i18n } from '@kbn/i18n';
-import {
- KibanaContext,
- ExpressionFunctionDefinition,
-} from '../../../../../plugins/expressions/public';
+import { ExpressionFunctionDefinition } from 'src/plugins/expressions/public';
import { getSearchService, getUiSettings } from '../../services';
import { EsRawResponse } from './es_raw_response';
import { RequestStatistics, RequestAdapter } from '../../../../inspector/common';
-import { IEsSearchResponse } from '../../../common/search/es_search';
+import { IEsSearchResponse, KibanaContext } from '../../../common/search';
import { buildEsQuery, getEsQueryConfig } from '../../../common/es_query/es_query';
import { DataPublicPluginStart } from '../../types';
diff --git a/src/plugins/data/public/search/search_interceptor.test.ts b/src/plugins/data/public/search/search_interceptor.test.ts
index 472caa5e4f45f..60274261da25f 100644
--- a/src/plugins/data/public/search/search_interceptor.test.ts
+++ b/src/plugins/data/public/search/search_interceptor.test.ts
@@ -21,7 +21,7 @@ import { CoreSetup, CoreStart } from '../../../../core/public';
import { coreMock } from '../../../../core/public/mocks';
import { IEsSearchRequest } from '../../common/search';
import { SearchInterceptor } from './search_interceptor';
-import { AbortError } from '../../common';
+import { AbortError } from '../../../kibana_utils/public';
import { SearchTimeoutError, PainlessError, TimeoutErrorMode } from './errors';
import { searchServiceMock } from './mocks';
import { ISearchStart } from '.';
diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts
index 3584d75ab86bb..78e65802bcf99 100644
--- a/src/plugins/data/public/search/search_interceptor.ts
+++ b/src/plugins/data/public/search/search_interceptor.ts
@@ -24,13 +24,11 @@ import { PublicMethodsOf } from '@kbn/utility-types';
import { CoreStart, CoreSetup, ToastsSetup } from 'kibana/public';
import { i18n } from '@kbn/i18n';
import {
- AbortError,
IKibanaSearchRequest,
IKibanaSearchResponse,
ISearchOptions,
ES_SEARCH_STRATEGY,
ISessionService,
- getCombinedSignal,
} from '../../common';
import { SearchUsageCollector } from './collectors';
import {
@@ -43,6 +41,7 @@ import {
getHttpError,
} from './errors';
import { toMountPoint } from '../../../kibana_react/public';
+import { AbortError, getCombinedAbortSignal } from '../../../kibana_utils/public';
export interface SearchInterceptorDeps {
http: CoreSetup['http'];
@@ -170,7 +169,9 @@ export class SearchInterceptor {
...(abortSignal ? [abortSignal] : []),
];
- const { signal: combinedSignal, cleanup: cleanupCombinedSignal } = getCombinedSignal(signals);
+ const { signal: combinedSignal, cleanup: cleanupCombinedSignal } = getCombinedAbortSignal(
+ signals
+ );
const cleanup = () => {
subscription.unsubscribe();
combinedSignal.removeEventListener('abort', cleanup);
diff --git a/src/plugins/data/public/search/search_service.ts b/src/plugins/data/public/search/search_service.ts
index e5a50077518af..96fb3f91ea85f 100644
--- a/src/plugins/data/public/search/search_service.ts
+++ b/src/plugins/data/public/search/search_service.ts
@@ -23,10 +23,13 @@ import { ISearchSetup, ISearchStart, SearchEnhancements } from './types';
import { handleResponse } from './fetch';
import {
+ kibana,
+ kibanaContext,
+ kibanaContextFunction,
ISearchGeneric,
- SearchSourceService,
- SearchSourceDependencies,
ISessionService,
+ SearchSourceDependencies,
+ SearchSourceService,
} from '../../common/search';
import { getCallMsearch } from './legacy';
import { AggsService, AggsStartDependencies } from './aggs';
@@ -85,6 +88,10 @@ export class SearchService implements Plugin {
session: this.sessionService,
});
+ expressions.registerFunction(kibana);
+ expressions.registerFunction(kibanaContextFunction);
+ expressions.registerType(kibanaContext);
+
expressions.registerFunction(esdsl);
expressions.registerType(esRawResponse);
diff --git a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
index 8c009576ff280..194e253fd7b26 100644
--- a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
+++ b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
@@ -22,6 +22,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import classNames from 'classnames';
import React, { useState } from 'react';
+import { METRIC_TYPE, UiStatsMetricType } from '@kbn/analytics';
import { FilterEditor } from './filter_editor';
import { FILTER_EDITOR_WIDTH, FilterItem } from './filter_item';
import { FilterOptions } from './filter_options';
@@ -45,6 +46,9 @@ interface Props {
className: string;
indexPatterns: IIndexPattern[];
intl: InjectedIntl;
+ appName: string;
+ // Track UI Metrics
+ trackUiMetric?: (metricType: UiStatsMetricType, eventName: string | string[]) => void;
}
function FilterBarUI(props: Props) {
@@ -128,6 +132,9 @@ function FilterBarUI(props: Props) {
function onAdd(filter: Filter) {
setIsAddFilterPopoverOpen(false);
+ if (props.trackUiMetric) {
+ props.trackUiMetric(METRIC_TYPE.CLICK, `${props.appName}:filter_added`);
+ }
const filters = [...props.filters, filter];
onFiltersUpdated(filters);
}
@@ -139,6 +146,9 @@ function FilterBarUI(props: Props) {
}
function onUpdate(i: number, filter: Filter) {
+ if (props.trackUiMetric) {
+ props.trackUiMetric(METRIC_TYPE.CLICK, `${props.appName}:filter_edited`);
+ }
const filters = [...props.filters];
filters[i] = filter;
onFiltersUpdated(filters);
@@ -165,11 +175,17 @@ function FilterBarUI(props: Props) {
}
function onToggleAllNegated() {
+ if (props.trackUiMetric) {
+ props.trackUiMetric(METRIC_TYPE.CLICK, `${props.appName}:filter_invertInclusion`);
+ }
const filters = props.filters.map(toggleFilterNegated);
onFiltersUpdated(filters);
}
function onToggleAllDisabled() {
+ if (props.trackUiMetric) {
+ props.trackUiMetric(METRIC_TYPE.CLICK, `${props.appName}:filter_toggleAllDisabled`);
+ }
const filters = props.filters.map(toggleFilterDisabled);
onFiltersUpdated(filters);
}
diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx
index 719827a98cc63..c420734a43d41 100644
--- a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx
+++ b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx
@@ -85,6 +85,8 @@ export class PhraseSuggestorUI extends React.Com
field,
query,
signal: this.abortController.signal,
+ // Show all results in filter bar autocomplete
+ useTimeRange: false,
});
this.setState({ suggestions, isLoading: false });
diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
index 48e2e8dab7580..f120aae920774 100644
--- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
@@ -21,6 +21,7 @@ import _ from 'lodash';
import React, { useEffect, useRef } from 'react';
import { CoreStart } from 'src/core/public';
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
+import { UiStatsMetricType } from '@kbn/analytics';
import { KibanaContextProvider } from '../../../../kibana_react/public';
import { QueryStart, SavedQuery } from '../../query';
import { SearchBar, SearchBarOwnProps } from './';
@@ -35,6 +36,7 @@ interface StatefulSearchBarDeps {
core: CoreStart;
data: Omit;
storage: IStorageWrapper;
+ trackUiMetric?: (metricType: UiStatsMetricType, eventName: string | string[]) => void;
}
export type StatefulSearchBarProps = SearchBarOwnProps & {
@@ -119,7 +121,7 @@ const overrideDefaultBehaviors = (props: StatefulSearchBarProps) => {
return props.useDefaultBehaviors ? {} : props;
};
-export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) {
+export function createSearchBar({ core, storage, data, trackUiMetric }: StatefulSearchBarDeps) {
// App name should come from the core application service.
// Until it's available, we'll ask the user to provide it for the pre-wired component.
return (props: StatefulSearchBarProps) => {
@@ -197,6 +199,7 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps)
onClearSavedQuery={defaultOnClearSavedQuery(props, clearSavedQuery)}
onSavedQueryUpdated={defaultOnSavedQueryUpdated(props, setSavedQuery)}
onSaved={defaultOnSavedQueryUpdated(props, setSavedQuery)}
+ trackUiMetric={trackUiMetric}
{...overrideDefaultBehaviors(props)}
/>
diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx
index daa6fa0dd80ab..e77f58f572f33 100644
--- a/src/plugins/data/public/ui/search_bar/search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx
@@ -24,6 +24,7 @@ import React, { Component } from 'react';
import ResizeObserver from 'resize-observer-polyfill';
import { get, isEqual } from 'lodash';
+import { METRIC_TYPE, UiStatsMetricType } from '@kbn/analytics';
import { withKibana, KibanaReactContextValue } from '../../../../kibana_react/public';
import QueryBarTopRow from '../query_string_input/query_bar_top_row';
@@ -78,6 +79,8 @@ export interface SearchBarOwnProps {
onRefresh?: (payload: { dateRange: TimeRange }) => void;
indicateNoData?: boolean;
+ // Track UI Metrics
+ trackUiMetric?: (metricType: UiStatsMetricType, eventName: string | string[]) => void;
}
export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps;
@@ -331,6 +334,9 @@ class SearchBarUI extends Component {
},
});
}
+ if (this.props.trackUiMetric) {
+ this.props.trackUiMetric(METRIC_TYPE.CLICK, `${this.services.appName}:query_submitted`);
+ }
}
);
};
@@ -432,6 +438,8 @@ class SearchBarUI extends Component {
filters={this.props.filters!}
onFiltersUpdated={this.props.onFiltersUpdated}
indexPatterns={this.props.indexPatterns!}
+ appName={this.services.appName}
+ trackUiMetric={this.props.trackUiMetric}
/>
diff --git a/src/plugins/data/server/autocomplete/value_suggestions_route.ts b/src/plugins/data/server/autocomplete/value_suggestions_route.ts
index 6a5b7d1d5b414..89ee0995f4140 100644
--- a/src/plugins/data/server/autocomplete/value_suggestions_route.ts
+++ b/src/plugins/data/server/autocomplete/value_suggestions_route.ts
@@ -45,7 +45,7 @@ export function registerValueSuggestionsRoute(
{
field: schema.string(),
query: schema.string(),
- boolFilter: schema.maybe(schema.any()),
+ filters: schema.maybe(schema.any()),
},
{ unknowns: 'allow' }
),
@@ -53,7 +53,7 @@ export function registerValueSuggestionsRoute(
},
async (context, request, response) => {
const config = await config$.pipe(first()).toPromise();
- const { field: fieldName, query, boolFilter } = request.body;
+ const { field: fieldName, query, filters } = request.body;
const { index } = request.params;
const { client } = context.core.elasticsearch.legacy;
const signal = getRequestAbortedSignal(request.events.aborted$);
@@ -66,7 +66,7 @@ export function registerValueSuggestionsRoute(
const indexPattern = await findIndexPatternById(context.core.savedObjects.client, index);
const field = indexPattern && getFieldByName(fieldName, indexPattern);
- const body = await getBody(autocompleteSearchOptions, field || fieldName, query, boolFilter);
+ const body = await getBody(autocompleteSearchOptions, field || fieldName, query, filters);
try {
const result = await client.callAsCurrentUser('search', { index, body }, { signal });
@@ -88,7 +88,7 @@ async function getBody(
{ timeout, terminate_after }: Record,
field: IFieldType | string,
query: string,
- boolFilter: Filter[] = []
+ filters: Filter[] = []
) {
const isFieldObject = (f: any): f is IFieldType => Boolean(f && f.name);
@@ -108,7 +108,7 @@ async function getBody(
terminate_after,
query: {
bool: {
- filter: boolFilter,
+ filter: filters,
},
},
aggs: {
diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts
index 9a9b8b67730cc..e24869f5237ea 100644
--- a/src/plugins/data/server/index.ts
+++ b/src/plugins/data/server/index.ts
@@ -134,6 +134,8 @@ export {
FieldDescriptor as IndexPatternFieldDescriptor,
shouldReadFieldFromDocValues, // used only in logstash_fields fixture
FieldDescriptor,
+ mergeCapabilitiesWithFields,
+ getCapabilitiesForRollupIndices,
} from './index_patterns';
export {
@@ -206,6 +208,12 @@ export {
OptionedParamType,
OptionedValueProp,
ParsedInterval,
+ // expressions
+ ExecutionContextSearch,
+ ExpressionFunctionKibana,
+ ExpressionFunctionKibanaContext,
+ ExpressionValueSearchContext,
+ KibanaContext,
// search
ISearchOptions,
IEsSearchRequest,
diff --git a/src/plugins/data/server/index_patterns/fetcher/index.ts b/src/plugins/data/server/index_patterns/fetcher/index.ts
index 19306696885db..5d8ef62df9627 100644
--- a/src/plugins/data/server/index_patterns/fetcher/index.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/index.ts
@@ -18,4 +18,8 @@
*/
export * from './index_patterns_fetcher';
-export { shouldReadFieldFromDocValues } from './lib';
+export {
+ shouldReadFieldFromDocValues,
+ mergeCapabilitiesWithFields,
+ getCapabilitiesForRollupIndices,
+} from './lib';
diff --git a/src/plugins/data/server/index_patterns/fetcher/index_patterns_fetcher.ts b/src/plugins/data/server/index_patterns/fetcher/index_patterns_fetcher.ts
index e75b8761984ec..24dad39088b8f 100644
--- a/src/plugins/data/server/index_patterns/fetcher/index_patterns_fetcher.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/index_patterns_fetcher.ts
@@ -18,8 +18,15 @@
*/
import { ElasticsearchClient } from 'kibana/server';
+import { keyBy } from 'lodash';
-import { getFieldCapabilities, resolveTimePattern, createNoMatchingIndicesError } from './lib';
+import {
+ getFieldCapabilities,
+ resolveTimePattern,
+ createNoMatchingIndicesError,
+ getCapabilitiesForRollupIndices,
+ mergeCapabilitiesWithFields,
+} from './lib';
export interface FieldDescriptor {
aggregatable: boolean;
@@ -58,11 +65,44 @@ export class IndexPatternsFetcher {
pattern: string | string[];
metaFields?: string[];
fieldCapsOptions?: { allow_no_indices: boolean };
+ type?: string;
+ rollupIndex?: string;
}): Promise {
- const { pattern, metaFields, fieldCapsOptions } = options;
- return await getFieldCapabilities(this.elasticsearchClient, pattern, metaFields, {
- allow_no_indices: fieldCapsOptions ? fieldCapsOptions.allow_no_indices : this.allowNoIndices,
- });
+ const { pattern, metaFields, fieldCapsOptions, type, rollupIndex } = options;
+ const fieldCapsResponse = await getFieldCapabilities(
+ this.elasticsearchClient,
+ pattern,
+ metaFields,
+ {
+ allow_no_indices: fieldCapsOptions
+ ? fieldCapsOptions.allow_no_indices
+ : this.allowNoIndices,
+ }
+ );
+ if (type === 'rollup' && rollupIndex) {
+ const rollupFields: FieldDescriptor[] = [];
+ const rollupIndexCapabilities = getCapabilitiesForRollupIndices(
+ (
+ await this.elasticsearchClient.rollup.getRollupIndexCaps({
+ index: rollupIndex,
+ })
+ ).body
+ )[rollupIndex].aggs;
+ const fieldCapsResponseObj = keyBy(fieldCapsResponse, 'name');
+
+ // Keep meta fields
+ metaFields!.forEach(
+ (field: string) =>
+ fieldCapsResponseObj[field] && rollupFields.push(fieldCapsResponseObj[field])
+ );
+
+ return mergeCapabilitiesWithFields(
+ rollupIndexCapabilities,
+ fieldCapsResponseObj,
+ rollupFields
+ );
+ }
+ return fieldCapsResponse;
}
/**
diff --git a/src/legacy/server/i18n/constants.ts b/src/plugins/data/server/index_patterns/fetcher/lib/__tests__/fixtures/index.js
similarity index 95%
rename from src/legacy/server/i18n/constants.ts
rename to src/plugins/data/server/index_patterns/fetcher/lib/__tests__/fixtures/index.js
index a7a410dbcb5b3..d675702ae54e9 100644
--- a/src/legacy/server/i18n/constants.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/__tests__/fixtures/index.js
@@ -17,4 +17,4 @@
* under the License.
*/
-export const I18N_RC = '.i18nrc.json';
+export { jobs } from './jobs';
diff --git a/x-pack/plugins/rollup/server/lib/__tests__/fixtures/jobs.js b/src/plugins/data/server/index_patterns/fetcher/lib/__tests__/fixtures/jobs.js
similarity index 65%
rename from x-pack/plugins/rollup/server/lib/__tests__/fixtures/jobs.js
rename to src/plugins/data/server/index_patterns/fetcher/lib/__tests__/fixtures/jobs.js
index c03b7c33abe0a..39ebd9595eeaf 100644
--- a/x-pack/plugins/rollup/server/lib/__tests__/fixtures/jobs.js
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/__tests__/fixtures/jobs.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
export const jobs = [
diff --git a/x-pack/plugins/rollup/server/lib/__tests__/jobs_compatibility.js b/src/plugins/data/server/index_patterns/fetcher/lib/__tests__/jobs_compatibility.js
similarity index 81%
rename from x-pack/plugins/rollup/server/lib/__tests__/jobs_compatibility.js
rename to src/plugins/data/server/index_patterns/fetcher/lib/__tests__/jobs_compatibility.js
index a67f67de859f5..e3c93ac1f8616 100644
--- a/x-pack/plugins/rollup/server/lib/__tests__/jobs_compatibility.js
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/__tests__/jobs_compatibility.js
@@ -1,8 +1,22 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+
import expect from '@kbn/expect';
import { areJobsCompatible, mergeJobConfigurations } from '../jobs_compatibility';
import { jobs } from './fixtures';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/index.ts b/src/plugins/data/server/index_patterns/fetcher/lib/index.ts
index 20e74d2b1a579..b2fd3a1a09a25 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/index.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/index.ts
@@ -20,3 +20,5 @@
export { getFieldCapabilities, shouldReadFieldFromDocValues } from './field_capabilities';
export { resolveTimePattern } from './resolve_time_pattern';
export { createNoMatchingIndicesError } from './errors';
+export * from './merge_capabilities_with_fields';
+export * from './map_capabilities';
diff --git a/x-pack/plugins/rollup/server/lib/jobs_compatibility.ts b/src/plugins/data/server/index_patterns/fetcher/lib/jobs_compatibility.ts
similarity index 79%
rename from x-pack/plugins/rollup/server/lib/jobs_compatibility.ts
rename to src/plugins/data/server/index_patterns/fetcher/lib/jobs_compatibility.ts
index f5f54cf9a54e8..f21de8907ee24 100644
--- a/x-pack/plugins/rollup/server/lib/jobs_compatibility.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/jobs_compatibility.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { isEqual } from 'lodash';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/map_capabilities.ts b/src/plugins/data/server/index_patterns/fetcher/lib/map_capabilities.ts
new file mode 100644
index 0000000000000..6187174834012
--- /dev/null
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/map_capabilities.ts
@@ -0,0 +1,37 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { mergeJobConfigurations } from './jobs_compatibility';
+
+export function getCapabilitiesForRollupIndices(indices: { [key: string]: any }) {
+ const indexNames = Object.keys(indices);
+ const capabilities = {} as { [key: string]: any };
+
+ indexNames.forEach((index) => {
+ try {
+ capabilities[index] = mergeJobConfigurations(indices[index].rollup_jobs);
+ } catch (e) {
+ capabilities[index] = {
+ error: e.message,
+ };
+ }
+ });
+
+ return capabilities;
+}
diff --git a/x-pack/plugins/rollup/server/lib/merge_capabilities_with_fields.ts b/src/plugins/data/server/index_patterns/fetcher/lib/merge_capabilities_with_fields.ts
similarity index 70%
rename from x-pack/plugins/rollup/server/lib/merge_capabilities_with_fields.ts
rename to src/plugins/data/server/index_patterns/fetcher/lib/merge_capabilities_with_fields.ts
index 51111e9e45d0a..dd69f4b7ff007 100644
--- a/x-pack/plugins/rollup/server/lib/merge_capabilities_with_fields.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/merge_capabilities_with_fields.ts
@@ -1,20 +1,30 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
// Merge rollup capabilities information with field information
-export interface Field {
- name?: string;
- [key: string]: any;
-}
+import { FieldDescriptor } from '../index_patterns_fetcher';
export const mergeCapabilitiesWithFields = (
rollupIndexCapabilities: { [key: string]: any },
fieldsFromFieldCapsApi: { [key: string]: any },
- previousFields: Field[] = []
+ previousFields: FieldDescriptor[] = []
) => {
const rollupFields = [...previousFields];
const rollupFieldNames: string[] = [];
diff --git a/src/plugins/data/server/index_patterns/index.ts b/src/plugins/data/server/index_patterns/index.ts
index 683d1c445fd72..3305b1bb9a92f 100644
--- a/src/plugins/data/server/index_patterns/index.ts
+++ b/src/plugins/data/server/index_patterns/index.ts
@@ -17,5 +17,11 @@
* under the License.
*/
export * from './utils';
-export { IndexPatternsFetcher, FieldDescriptor, shouldReadFieldFromDocValues } from './fetcher';
+export {
+ IndexPatternsFetcher,
+ FieldDescriptor,
+ shouldReadFieldFromDocValues,
+ mergeCapabilitiesWithFields,
+ getCapabilitiesForRollupIndices,
+} from './fetcher';
export { IndexPatternsService, IndexPatternsServiceStart } from './index_patterns_service';
diff --git a/src/plugins/data/server/index_patterns/index_patterns_api_client.ts b/src/plugins/data/server/index_patterns/index_patterns_api_client.ts
index 2dc6f40c5a6f1..21a3bf6e73e61 100644
--- a/src/plugins/data/server/index_patterns/index_patterns_api_client.ts
+++ b/src/plugins/data/server/index_patterns/index_patterns_api_client.ts
@@ -17,13 +17,30 @@
* under the License.
*/
-import { GetFieldsOptions, IIndexPatternsApiClient } from '../../common/index_patterns/types';
+import { ElasticsearchClient } from 'kibana/server';
+import {
+ GetFieldsOptions,
+ IIndexPatternsApiClient,
+ GetFieldsOptionsTimePattern,
+} from '../../common/index_patterns/types';
+import { IndexPatternsFetcher } from './fetcher';
export class IndexPatternsApiServer implements IIndexPatternsApiClient {
- async getFieldsForTimePattern(options: GetFieldsOptions = {}) {
- throw new Error('IndexPatternsApiServer - getFieldsForTimePattern not defined');
+ esClient: ElasticsearchClient;
+ constructor(elasticsearchClient: ElasticsearchClient) {
+ this.esClient = elasticsearchClient;
}
- async getFieldsForWildcard(options: GetFieldsOptions = {}) {
- throw new Error('IndexPatternsApiServer - getFieldsForWildcard not defined');
+ async getFieldsForWildcard({ pattern, metaFields, type, rollupIndex }: GetFieldsOptions) {
+ const indexPatterns = new IndexPatternsFetcher(this.esClient);
+ return await indexPatterns.getFieldsForWildcard({
+ pattern,
+ metaFields,
+ type,
+ rollupIndex,
+ });
+ }
+ async getFieldsForTimePattern(options: GetFieldsOptionsTimePattern) {
+ const indexPatterns = new IndexPatternsFetcher(this.esClient);
+ return await indexPatterns.getFieldsForTimePattern(options);
}
}
diff --git a/src/plugins/data/server/index_patterns/index_patterns_service.ts b/src/plugins/data/server/index_patterns/index_patterns_service.ts
index d665e3715fa72..af2d4d6a73e0f 100644
--- a/src/plugins/data/server/index_patterns/index_patterns_service.ts
+++ b/src/plugins/data/server/index_patterns/index_patterns_service.ts
@@ -17,7 +17,14 @@
* under the License.
*/
-import { CoreSetup, CoreStart, Plugin, Logger, SavedObjectsClientContract } from 'kibana/server';
+import {
+ CoreSetup,
+ CoreStart,
+ Plugin,
+ Logger,
+ SavedObjectsClientContract,
+ ElasticsearchClient,
+} from 'kibana/server';
import { registerRoutes } from './routes';
import { indexPatternSavedObjectType } from '../saved_objects';
import { capabilitiesProvider } from './capabilities_provider';
@@ -29,7 +36,8 @@ import { SavedObjectsClientServerToCommon } from './saved_objects_client_wrapper
export interface IndexPatternsServiceStart {
indexPatternsServiceFactory: (
- savedObjectsClient: SavedObjectsClientContract
+ savedObjectsClient: SavedObjectsClientContract,
+ elasticsearchClient: ElasticsearchClient
) => Promise;
}
@@ -50,14 +58,17 @@ export class IndexPatternsService implements Plugin {
+ indexPatternsServiceFactory: async (
+ savedObjectsClient: SavedObjectsClientContract,
+ elasticsearchClient: ElasticsearchClient
+ ) => {
const uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient);
const formats = await fieldFormats.fieldFormatServiceFactory(uiSettingsClient);
return new IndexPatternsCommonService({
uiSettings: new UiSettingsServerToCommon(uiSettingsClient),
savedObjectsClient: new SavedObjectsClientServerToCommon(savedObjectsClient),
- apiClient: new IndexPatternsApiServer(),
+ apiClient: new IndexPatternsApiServer(elasticsearchClient),
fieldFormats: formats,
onError: (error) => {
logger.error(error);
diff --git a/src/plugins/data/server/index_patterns/routes.ts b/src/plugins/data/server/index_patterns/routes.ts
index 041eb235d01e0..f8af52954fc61 100644
--- a/src/plugins/data/server/index_patterns/routes.ts
+++ b/src/plugins/data/server/index_patterns/routes.ts
@@ -42,13 +42,15 @@ export function registerRoutes(http: HttpServiceSetup) {
meta_fields: schema.oneOf([schema.string(), schema.arrayOf(schema.string())], {
defaultValue: [],
}),
+ type: schema.maybe(schema.string()),
+ rollup_index: schema.maybe(schema.string()),
}),
},
},
async (context, request, response) => {
const { asCurrentUser } = context.core.elasticsearch.client;
const indexPatterns = new IndexPatternsFetcher(asCurrentUser);
- const { pattern, meta_fields: metaFields } = request.query;
+ const { pattern, meta_fields: metaFields, type, rollup_index: rollupIndex } = request.query;
let parsedFields: string[] = [];
try {
@@ -61,6 +63,8 @@ export function registerRoutes(http: HttpServiceSetup) {
const fields = await indexPatterns.getFieldsForWildcard({
pattern,
metaFields: parsedFields,
+ type,
+ rollupIndex,
});
return response.ok({
diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts
index 88f24b7ca5a70..3ec4e7e64e382 100644
--- a/src/plugins/data/server/plugin.ts
+++ b/src/plugins/data/server/plugin.ts
@@ -96,7 +96,7 @@ export class DataServerPlugin
core.uiSettings.register(getUiSettings());
const searchSetup = this.searchService.setup(core, {
- registerFunction: expressions.registerFunction,
+ expressions,
usageCollection,
});
diff --git a/src/plugins/data/server/search/aggs/aggs_service.test.ts b/src/plugins/data/server/search/aggs/aggs_service.test.ts
index cb4239cc339c4..e58420f6c2f07 100644
--- a/src/plugins/data/server/search/aggs/aggs_service.test.ts
+++ b/src/plugins/data/server/search/aggs/aggs_service.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { KibanaRequest } from 'src/core/server';
+import { KibanaRequest, ElasticsearchClient } from 'src/core/server';
import { coreMock } from '../../../../../core/server/mocks';
import { expressionsPluginMock } from '../../../../../plugins/expressions/server/mocks';
@@ -63,7 +63,8 @@ describe('AggsService - server', () => {
expect(start).toHaveProperty('asScopedToClient');
const contract = await start.asScopedToClient(
- savedObjects.getScopedClient({} as KibanaRequest)
+ savedObjects.getScopedClient({} as KibanaRequest),
+ {} as ElasticsearchClient
);
expect(contract).toHaveProperty('calculateAutoTimeExpression');
expect(contract).toHaveProperty('createAggConfigs');
@@ -74,7 +75,10 @@ describe('AggsService - server', () => {
service.setup(setupDeps);
const start = await service
.start(startDeps)
- .asScopedToClient(savedObjects.getScopedClient({} as KibanaRequest));
+ .asScopedToClient(
+ savedObjects.getScopedClient({} as KibanaRequest),
+ {} as ElasticsearchClient
+ );
expect(start.types.get('terms').name).toBe('terms');
});
@@ -83,7 +87,10 @@ describe('AggsService - server', () => {
service.setup(setupDeps);
const start = await service
.start(startDeps)
- .asScopedToClient(savedObjects.getScopedClient({} as KibanaRequest));
+ .asScopedToClient(
+ savedObjects.getScopedClient({} as KibanaRequest),
+ {} as ElasticsearchClient
+ );
const aggTypes = getAggTypes();
expect(start.types.getAll().buckets.length).toBe(aggTypes.buckets.length);
@@ -103,7 +110,10 @@ describe('AggsService - server', () => {
const start = await service
.start(startDeps)
- .asScopedToClient(savedObjects.getScopedClient({} as KibanaRequest));
+ .asScopedToClient(
+ savedObjects.getScopedClient({} as KibanaRequest),
+ {} as ElasticsearchClient
+ );
const aggTypes = getAggTypes();
expect(start.types.getAll().buckets.length).toBe(aggTypes.buckets.length + 1);
diff --git a/src/plugins/data/server/search/aggs/aggs_service.ts b/src/plugins/data/server/search/aggs/aggs_service.ts
index c805c8af6694c..c23f748b1eeb5 100644
--- a/src/plugins/data/server/search/aggs/aggs_service.ts
+++ b/src/plugins/data/server/search/aggs/aggs_service.ts
@@ -19,7 +19,11 @@
import { pick } from 'lodash';
-import { UiSettingsServiceStart, SavedObjectsClientContract } from 'src/core/server';
+import {
+ UiSettingsServiceStart,
+ SavedObjectsClientContract,
+ ElasticsearchClient,
+} from 'src/core/server';
import { ExpressionsServiceSetup } from 'src/plugins/expressions/common';
import {
AggsCommonService,
@@ -65,7 +69,10 @@ export class AggsService {
public start({ fieldFormats, uiSettings, indexPatterns }: AggsStartDependencies): AggsStart {
return {
- asScopedToClient: async (savedObjectsClient: SavedObjectsClientContract) => {
+ asScopedToClient: async (
+ savedObjectsClient: SavedObjectsClientContract,
+ elasticsearchClient: ElasticsearchClient
+ ) => {
const uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient);
const formats = await fieldFormats.fieldFormatServiceFactory(uiSettingsClient);
@@ -82,8 +89,9 @@ export class AggsService {
types,
} = this.aggsCommonService.start({
getConfig,
- getIndexPattern: (await indexPatterns.indexPatternsServiceFactory(savedObjectsClient))
- .get,
+ getIndexPattern: (
+ await indexPatterns.indexPatternsServiceFactory(savedObjectsClient, elasticsearchClient)
+ ).get,
isDefaultTimezone,
});
diff --git a/src/plugins/data/server/search/aggs/types.ts b/src/plugins/data/server/search/aggs/types.ts
index 1b21d948b25d9..2c28c970cbb84 100644
--- a/src/plugins/data/server/search/aggs/types.ts
+++ b/src/plugins/data/server/search/aggs/types.ts
@@ -17,11 +17,14 @@
* under the License.
*/
-import { SavedObjectsClientContract } from 'src/core/server';
+import { SavedObjectsClientContract, ElasticsearchClient } from 'src/core/server';
import { AggsCommonSetup, AggsStart as Start } from '../../../common';
export type AggsSetup = AggsCommonSetup;
export interface AggsStart {
- asScopedToClient: (savedObjectsClient: SavedObjectsClientContract) => Promise;
+ asScopedToClient: (
+ savedObjectsClient: SavedObjectsClientContract,
+ elasticsearchClient: ElasticsearchClient
+ ) => Promise;
}
diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts
index 2b513be147e9d..0700afd8d6c83 100644
--- a/src/plugins/data/server/search/search_service.test.ts
+++ b/src/plugins/data/server/search/search_service.test.ts
@@ -44,7 +44,10 @@ describe('Search service', () => {
it('exposes proper contract', async () => {
const setup = plugin.setup(mockCoreSetup, ({
packageInfo: { version: '8' },
- registerFunction: jest.fn(),
+ expressions: {
+ registerFunction: jest.fn(),
+ registerType: jest.fn(),
+ },
} as unknown) as SearchServiceSetupDependencies);
expect(setup).toHaveProperty('aggs');
expect(setup).toHaveProperty('registerSearchStrategy');
diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts
index c500c62914c0b..d8aa588719e3e 100644
--- a/src/plugins/data/server/search/search_service.ts
+++ b/src/plugins/data/server/search/search_service.ts
@@ -30,6 +30,7 @@ import {
StartServicesAccessor,
} from 'src/core/server';
import { first } from 'rxjs/operators';
+import { ExpressionsServerSetup } from 'src/plugins/expressions/server';
import {
ISearchSetup,
ISearchStart,
@@ -38,7 +39,7 @@ import {
SearchStrategyDependencies,
} from './types';
-import { AggsService, AggsSetupDependencies } from './aggs';
+import { AggsService } from './aggs';
import { FieldFormatsStart } from '../field_formats';
import { IndexPatternsServiceStart } from '../index_patterns';
@@ -50,15 +51,18 @@ import { registerUsageCollector } from './collectors/register';
import { usageProvider } from './collectors/usage';
import { searchTelemetry } from '../saved_objects';
import {
- IKibanaSearchRequest,
- IKibanaSearchResponse,
IEsSearchRequest,
IEsSearchResponse,
+ IKibanaSearchRequest,
+ IKibanaSearchResponse,
+ ISearchClient,
+ ISearchOptions,
+ kibana,
+ kibanaContext,
+ kibanaContextFunction,
SearchSourceDependencies,
- SearchSourceService,
searchSourceRequiredUiSettings,
- ISearchOptions,
- ISearchClient,
+ SearchSourceService,
} from '../../common/search';
import {
getShardDelayBucketAgg,
@@ -77,7 +81,7 @@ type StrategyMap = Record>;
/** @internal */
export interface SearchServiceSetupDependencies {
- registerFunction: AggsSetupDependencies['registerFunction'];
+ expressions: ExpressionsServerSetup;
usageCollection?: UsageCollectionSetup;
}
@@ -106,7 +110,7 @@ export class SearchService implements Plugin {
public setup(
core: CoreSetup<{}, DataPluginStart>,
- { registerFunction, usageCollection }: SearchServiceSetupDependencies
+ { expressions, usageCollection }: SearchServiceSetupDependencies
): ISearchSetup {
const usage = usageCollection ? usageProvider(core) : undefined;
@@ -137,7 +141,11 @@ export class SearchService implements Plugin {
registerUsageCollector(usageCollection, this.initializerContext);
}
- const aggs = this.aggsService.setup({ registerFunction });
+ expressions.registerFunction(kibana);
+ expressions.registerFunction(kibanaContextFunction);
+ expressions.registerType(kibanaContext);
+
+ const aggs = this.aggsService.setup({ registerFunction: expressions.registerFunction });
this.initializerContext.config
.create()
@@ -146,7 +154,7 @@ export class SearchService implements Plugin {
.then((value) => {
if (value.search.aggs.shardDelay.enabled) {
aggs.types.registerBucket(SHARD_DELAY_AGG_NAME, getShardDelayBucketAgg);
- registerFunction(aggShardDelay);
+ expressions.registerFunction(aggShardDelay);
}
});
@@ -169,7 +177,11 @@ export class SearchService implements Plugin {
const { elasticsearch, savedObjects, uiSettings } = core;
const asScoped = this.asScopedProvider(core);
return {
- aggs: this.aggsService.start({ fieldFormats, uiSettings, indexPatterns }),
+ aggs: this.aggsService.start({
+ fieldFormats,
+ uiSettings,
+ indexPatterns,
+ }),
getSearchStrategy: this.getSearchStrategy,
asScoped,
searchSource: {
@@ -177,7 +189,8 @@ export class SearchService implements Plugin {
const esClient = elasticsearch.client.asScoped(request);
const savedObjectsClient = savedObjects.getScopedClient(request);
const scopedIndexPatterns = await indexPatterns.indexPatternsServiceFactory(
- savedObjectsClient
+ savedObjectsClient,
+ esClient.asCurrentUser
);
const uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient);
diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md
index f62a70c9e4ce1..2984ca336819a 100644
--- a/src/plugins/data/server/server.api.md
+++ b/src/plugins/data/server/server.api.md
@@ -5,6 +5,7 @@
```ts
import { $Values } from '@kbn/utility-types';
+import { Adapters } from 'src/plugins/inspector/common';
import { ApiResponse } from '@elastic/elasticsearch';
import { Assign } from '@kbn/utility-types';
import { BehaviorSubject } from 'rxjs';
@@ -13,14 +14,19 @@ import { CoreSetup } from 'src/core/server';
import { CoreSetup as CoreSetup_2 } from 'kibana/server';
import { CoreStart } from 'src/core/server';
import { CoreStart as CoreStart_2 } from 'kibana/server';
+import { Datatable } from 'src/plugins/expressions/common';
import { DatatableColumn } from 'src/plugins/expressions';
import { Duration } from 'moment';
-import { ElasticsearchClient } from 'kibana/server';
+import { ElasticsearchClient } from 'src/core/server';
+import { ElasticsearchClient as ElasticsearchClient_2 } from 'kibana/server';
import { Ensure } from '@kbn/utility-types';
import { EnvironmentMode } from '@kbn/config';
import { ErrorToastOptions } from 'src/core/public/notifications';
+import { ExecutionContext } from 'src/plugins/expressions/common';
import { ExpressionAstFunction } from 'src/plugins/expressions/common';
+import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { ExpressionsServerSetup } from 'src/plugins/expressions/server';
+import { ExpressionValueBoxed } from 'src/plugins/expressions/common';
import { ISavedObjectsRepository } from 'kibana/server';
import { IScopedClusterClient } from 'src/core/server';
import { ISearchOptions as ISearchOptions_2 } from 'src/plugins/data/public';
@@ -55,7 +61,6 @@ import { ToastInputFields } from 'src/core/public/notifications';
import { Type } from '@kbn/config-schema';
import { TypeOf } from '@kbn/config-schema';
import { Unit } from '@elastic/datemath';
-import { UnwrapPromiseOrReturn } from '@kbn/utility-types';
// Warning: (ae-forgotten-export) The symbol "AggConfigSerialized" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "AggConfigOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -224,7 +229,6 @@ export enum ES_FIELD_TYPES {
// @public (undocumented)
export const ES_SEARCH_STRATEGY = "es";
-// Warning: (ae-forgotten-export) The symbol "ExpressionFunctionDefinition" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Input" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Output" needs to be exported by the entry point index.d.ts
@@ -285,6 +289,31 @@ export interface EsQueryConfig {
queryStringOptions: Record;
}
+// Warning: (ae-missing-release-tag) "ExecutionContextSearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExecutionContextSearch = {
+ filters?: Filter[];
+ query?: Query | Query[];
+ timeRange?: TimeRange;
+};
+
+// Warning: (ae-missing-release-tag) "ExpressionFunctionKibana" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExpressionFunctionKibana = ExpressionFunctionDefinition<'kibana', ExpressionValueSearchContext | null, object, ExpressionValueSearchContext, ExecutionContext>;
+
+// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
+// Warning: (ae-missing-release-tag) "ExpressionFunctionKibanaContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExpressionFunctionKibanaContext = ExpressionFunctionDefinition<'kibana_context', KibanaContext | null, Arguments_2, Promise, ExecutionContext>;
+
+// Warning: (ae-missing-release-tag) "ExpressionValueSearchContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type ExpressionValueSearchContext = ExpressionValueBoxed<'kibana_context', ExecutionContextSearch>;
+
// Warning: (ae-missing-release-tag) "FieldDescriptor" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -361,6 +390,15 @@ export type Filter = {
query?: any;
};
+// Warning: (ae-missing-release-tag) "getCapabilitiesForRollupIndices" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export function getCapabilitiesForRollupIndices(indices: {
+ [key: string]: any;
+}): {
+ [key: string]: any;
+};
+
// Warning: (ae-forgotten-export) The symbol "IUiSettingsClient" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "getDefaultSearchParams" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -660,7 +698,7 @@ export const indexPatterns: {
//
// @public (undocumented)
export class IndexPatternsFetcher {
- constructor(elasticsearchClient: ElasticsearchClient, allowNoIndices?: boolean);
+ constructor(elasticsearchClient: ElasticsearchClient_2, allowNoIndices?: boolean);
getFieldsForTimePattern(options: {
pattern: string;
metaFields: string[];
@@ -673,6 +711,8 @@ export class IndexPatternsFetcher {
fieldCapsOptions?: {
allow_no_indices: boolean;
};
+ type?: string;
+ rollupIndex?: string;
}): Promise;
}
@@ -687,7 +727,7 @@ export class IndexPatternsService implements Plugin_3 Promise;
+ indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract_2, elasticsearchClient: ElasticsearchClient_2) => Promise;
};
}
@@ -779,6 +819,11 @@ export enum KBN_FIELD_TYPES {
UNKNOWN = "unknown"
}
+// Warning: (ae-missing-release-tag) "KibanaContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export type KibanaContext = ExpressionValueSearchContext;
+
// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -791,6 +836,15 @@ export interface KueryNode {
type: keyof NodeTypes;
}
+// Warning: (ae-missing-release-tag) "mergeCapabilitiesWithFields" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export const mergeCapabilitiesWithFields: (rollupIndexCapabilities: {
+ [key: string]: any;
+}, fieldsFromFieldCapsApi: {
+ [key: string]: any;
+}, previousFields?: FieldDescriptor[]) => FieldDescriptor[];
+
// Warning: (ae-missing-release-tag) "METRIC_TYPES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -885,7 +939,7 @@ export class Plugin implements Plugin_2 void;
search: ISearchSetup;
fieldFormats: {
- register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number;
+ register: (customFieldFormat: import("../common").FieldFormatInstanceType) => number;
};
};
// (undocumented)
@@ -894,7 +948,7 @@ export class Plugin implements Plugin_2 Promise;
};
indexPatterns: {
- indexPatternsServiceFactory: (savedObjectsClient: Pick) => Promise;
+ indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: import("src/core/server").ElasticsearchClient) => Promise;
};
search: ISearchStart>;
};
@@ -1127,6 +1181,7 @@ export const UI_SETTINGS: {
readonly INDEXPATTERN_PLACEHOLDER: "indexPattern:placeholder";
readonly FILTERS_PINNED_BY_DEFAULT: "filters:pinnedByDefault";
readonly FILTERS_EDITOR_SUGGEST_VALUES: "filterEditor:suggestValues";
+ readonly AUTOCOMPLETE_USE_TIMERANGE: "autocomplete:useTimeRange";
};
// Warning: (ae-missing-release-tag) "usageProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -1162,22 +1217,22 @@ export function usageProvider(core: CoreSetup_2): SearchUsage;
// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts
// src/plugins/data/server/index.ts:127:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts
// src/plugins/data/server/index.ts:127:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:235:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:235:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:235:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:235:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:250:5 - (ae-forgotten-export) The symbol "getTotalLoaded" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:251:5 - (ae-forgotten-export) The symbol "toSnakeCase" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:255:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:256:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:265:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:266:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:267:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:271:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:276:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index.ts:279:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
-// src/plugins/data/server/index_patterns/index_patterns_service.ts:50:14 - (ae-forgotten-export) The symbol "IndexPatternsService" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:243:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:243:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:243:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:243:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:258:5 - (ae-forgotten-export) The symbol "getTotalLoaded" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:259:5 - (ae-forgotten-export) The symbol "toSnakeCase" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:263:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:273:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:274:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:275:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:279:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:280:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:284:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index.ts:287:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
+// src/plugins/data/server/index_patterns/index_patterns_service.ts:58:14 - (ae-forgotten-export) The symbol "IndexPatternsService" needs to be exported by the entry point index.d.ts
// src/plugins/data/server/plugin.ts:88:66 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts
// src/plugins/data/server/search/types.ts:104:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts
diff --git a/src/plugins/data/server/ui_settings.ts b/src/plugins/data/server/ui_settings.ts
index 763a086d7688d..9393700a0e771 100644
--- a/src/plugins/data/server/ui_settings.ts
+++ b/src/plugins/data/server/ui_settings.ts
@@ -684,5 +684,17 @@ export function getUiSettings(): Record> {
}),
schema: schema.boolean(),
},
+ [UI_SETTINGS.AUTOCOMPLETE_USE_TIMERANGE]: {
+ name: i18n.translate('data.advancedSettings.autocompleteIgnoreTimerange', {
+ defaultMessage: 'Use time range',
+ description: 'Restrict autocomplete results to the current time range',
+ }),
+ value: true,
+ description: i18n.translate('data.advancedSettings.autocompleteIgnoreTimerangeText', {
+ defaultMessage:
+ 'Disable this property to get autocomplete suggestions from your full dataset, rather than from the current time range.',
+ }),
+ schema: schema.boolean(),
+ },
};
}
diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js
index 389eda90e00a1..9319c58db3e33 100644
--- a/src/plugins/discover/public/application/angular/discover.js
+++ b/src/plugins/discover/public/application/angular/discover.js
@@ -65,6 +65,7 @@ const {
timefilter,
toastNotifications,
uiSettings: config,
+ trackUiMetric,
} = getServices();
import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../helpers/breadcrumbs';
@@ -81,6 +82,9 @@ import {
DOC_HIDE_TIME_COLUMN_SETTING,
MODIFY_COLUMNS_ON_SWITCH,
} from '../../../common';
+import { METRIC_TYPE } from '@kbn/analytics';
+import { SEARCH_SESSION_ID_QUERY_PARAM } from '../../url_generator';
+import { removeQueryParam, getQueryParams } from '../../../../kibana_utils/public';
const fetchStatuses = {
UNINITIALIZED: 'uninitialized',
@@ -89,6 +93,9 @@ const fetchStatuses = {
ERROR: 'error',
};
+const getSearchSessionIdFromURL = (history) =>
+ getQueryParams(history.location)[SEARCH_SESSION_ID_QUERY_PARAM];
+
const app = getAngularModule();
app.config(($routeProvider) => {
@@ -206,6 +213,8 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
};
const history = getHistory();
+ // used for restoring background session
+ let isInitialSearch = true;
const {
appStateContainer,
@@ -796,17 +805,30 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
if (abortController) abortController.abort();
abortController = new AbortController();
- const sessionId = data.search.session.start();
+ const searchSessionId = (() => {
+ const searchSessionIdFromURL = getSearchSessionIdFromURL(history);
+ if (searchSessionIdFromURL) {
+ if (isInitialSearch) {
+ data.search.session.restore(searchSessionIdFromURL);
+ isInitialSearch = false;
+ return searchSessionIdFromURL;
+ } else {
+ // navigating away from background search
+ removeQueryParam(history, SEARCH_SESSION_ID_QUERY_PARAM);
+ }
+ }
+ return data.search.session.start();
+ })();
$scope
.updateDataSource()
.then(setupVisualization)
.then(function () {
$scope.fetchStatus = fetchStatuses.LOADING;
- logInspectorRequest();
+ logInspectorRequest({ searchSessionId });
return $scope.searchSource.fetch({
abortSignal: abortController.signal,
- sessionId,
+ sessionId: searchSessionId,
});
})
.then(onResults)
@@ -898,7 +920,7 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
$scope.fetchStatus = fetchStatuses.COMPLETE;
}
- function logInspectorRequest() {
+ function logInspectorRequest({ searchSessionId = null } = { searchSessionId: null }) {
inspectorAdapters.requests.reset();
const title = i18n.translate('discover.inspectorRequestDataTitle', {
defaultMessage: 'data',
@@ -906,7 +928,7 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
const description = i18n.translate('discover.inspectorRequestDescription', {
defaultMessage: 'This request queries Elasticsearch to fetch the data for the search.',
});
- inspectorRequest = inspectorAdapters.requests.start(title, { description });
+ inspectorRequest = inspectorAdapters.requests.start(title, { description, searchSessionId });
inspectorRequest.stats(getRequestInspectorStats($scope.searchSource));
$scope.searchSource.getSearchRequestBody().then((body) => {
inspectorRequest.json(body);
@@ -990,6 +1012,9 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
operation,
$scope.indexPattern.id
);
+ if (trackUiMetric) {
+ trackUiMetric(METRIC_TYPE.CLICK, 'filter_added');
+ }
return filterManager.addFilters(newFilters);
};
diff --git a/src/plugins/discover/public/url_generator.test.ts b/src/plugins/discover/public/url_generator.test.ts
index a18ee486ab007..98b7625e63c72 100644
--- a/src/plugins/discover/public/url_generator.test.ts
+++ b/src/plugins/discover/public/url_generator.test.ts
@@ -212,6 +212,15 @@ describe('Discover url generator', () => {
});
});
+ test('can specify a search session id', async () => {
+ const { generator } = await setup();
+ const url = await generator.createUrl({
+ searchSessionId: '__test__',
+ });
+ expect(url).toMatchInlineSnapshot(`"xyz/app/discover#/?_g=()&_a=()&searchSessionId=__test__"`);
+ expect(url).toContain('__test__');
+ });
+
describe('useHash property', () => {
describe('when default useHash is set to false', () => {
test('when using default, sets index pattern ID in the generated URL', async () => {
diff --git a/src/plugins/discover/public/url_generator.ts b/src/plugins/discover/public/url_generator.ts
index c7f2e2147e819..df9b16a4627ec 100644
--- a/src/plugins/discover/public/url_generator.ts
+++ b/src/plugins/discover/public/url_generator.ts
@@ -67,6 +67,11 @@ export interface DiscoverUrlGeneratorState {
* whether to hash the data in the url to avoid url length issues.
*/
useHash?: boolean;
+
+ /**
+ * Background search session id
+ */
+ searchSessionId?: string;
}
interface Params {
@@ -74,6 +79,8 @@ interface Params {
useHash: boolean;
}
+export const SEARCH_SESSION_ID_QUERY_PARAM = 'searchSessionId';
+
export class DiscoverUrlGenerator
implements UrlGeneratorsDefinition {
constructor(private readonly params: Params) {}
@@ -88,6 +95,7 @@ export class DiscoverUrlGenerator
savedSearchId,
timeRange,
useHash = this.params.useHash,
+ searchSessionId,
}: DiscoverUrlGeneratorState): Promise => {
const savedSearchPath = savedSearchId ? encodeURIComponent(savedSearchId) : '';
const appState: {
@@ -111,6 +119,10 @@ export class DiscoverUrlGenerator
url = setStateToKbnUrl('_g', queryState, { useHash }, url);
url = setStateToKbnUrl('_a', appState, { useHash }, url);
+ if (searchSessionId) {
+ url = `${url}&${SEARCH_SESSION_ID_QUERY_PARAM}=${searchSessionId}`;
+ }
+
return url;
};
}
diff --git a/src/plugins/embeddable/public/public.api.md b/src/plugins/embeddable/public/public.api.md
index 4406dded98547..6a2565edf2f67 100644
--- a/src/plugins/embeddable/public/public.api.md
+++ b/src/plugins/embeddable/public/public.api.md
@@ -80,6 +80,7 @@ import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport';
import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport';
import { TypeOf } from '@kbn/config-schema';
import { UiComponent } from 'src/plugins/kibana_utils/public';
+import { UiStatsMetricType } from '@kbn/analytics';
import { UnregisterCallback } from 'history';
import { UserProvidedValues } from 'src/core/server/types';
diff --git a/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.test.ts b/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.test.ts
index 15750c7667800..6654611faa18b 100644
--- a/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.test.ts
+++ b/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.test.ts
@@ -19,14 +19,51 @@
import { attemptToURIDecode } from './attempt_to_uri_decode';
+// this function doesn't work for % with other special chars or sequence %25
+// known issue https://github.com/elastic/kibana/issues/82440
test('decodes an encoded string', () => {
- const encodedString = 'test%3F';
- expect(attemptToURIDecode(encodedString)).toBe('test?');
+ const originalName = 'test;,/?:@&=+$#';
+ const encodedName = encodeURIComponent(originalName);
+ // react router v5 automatically decodes route match params
+ const reactRouterDecoded = decodeURI(encodedName);
+
+ expect(attemptToURIDecode(encodedName)).toBe(originalName);
+ expect(attemptToURIDecode(reactRouterDecoded)).toBe(originalName);
});
-// react router partially decodes %25 sequence to % in match params
-// https://github.com/elastic/kibana/pull/81664
test('ignores the error if a string is already decoded', () => {
- const decodedString = 'test%';
- expect(attemptToURIDecode(decodedString)).toBe(decodedString);
+ const originalName = 'test%';
+
+ const encodedName = encodeURIComponent(originalName);
+ // react router v5 automatically decodes route match params
+ const reactRouterDecoded = decodeURI(encodedName);
+
+ expect(attemptToURIDecode(encodedName)).toBe(originalName);
+ expect(attemptToURIDecode(reactRouterDecoded)).toBe(originalName);
+});
+
+test('returns wrong decoded value for %25 sequence', () => {
+ const originalName = 'test%25';
+
+ const encodedName = encodeURIComponent(originalName);
+ // react router v5 automatically decodes route match params
+ const reactRouterDecoded = decodeURI(encodedName);
+
+ expect(attemptToURIDecode(encodedName)).toBe(originalName);
+ expect(attemptToURIDecode(reactRouterDecoded)).not.toBe(originalName);
+});
+
+test('returns wrong decoded value for % with other escaped characters', () => {
+ const originalName = 'test%?#';
+
+ const encodedName = encodeURIComponent(originalName);
+ // react router v5 automatically decodes route match params
+ const reactRouterDecoded = decodeURI(encodedName);
+
+ expect(attemptToURIDecode(encodedName)).toBe(originalName);
+ expect(attemptToURIDecode(reactRouterDecoded)).not.toBe(originalName);
+});
+
+test("doesn't convert undefined to a string", () => {
+ expect(attemptToURIDecode(undefined)).toBeUndefined();
});
diff --git a/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.ts b/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.ts
index 65444b83f77bb..37e4761106e44 100644
--- a/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.ts
+++ b/src/plugins/es_ui_shared/public/url/attempt_to_uri_decode.ts
@@ -19,12 +19,14 @@
/*
* Use this function with any match params coming from react router to safely decode values.
- * https://github.com/elastic/kibana/pull/81664
+ * After an update to react router v6, this functions should be deprecated.
+ * Known issue for navigation with special characters in paths
+ * https://github.com/elastic/kibana/issues/82440
*/
-export const attemptToURIDecode = (value: string) => {
+export const attemptToURIDecode = (value?: string): string | undefined => {
let result = value;
try {
- result = decodeURIComponent(value);
+ result = value ? decodeURIComponent(value) : value;
} catch (e) {
// do nothing
}
diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts
index ba115a7538604..50a469c338d73 100644
--- a/src/plugins/expressions/common/execution/execution.ts
+++ b/src/plugins/expressions/common/execution/execution.ts
@@ -22,8 +22,7 @@ import { keys, last, mapValues, reduce, zipObject } from 'lodash';
import { Executor } from '../executor';
import { createExecutionContainer, ExecutionContainer } from './container';
import { createError } from '../util';
-import { Defer, now } from '../../../kibana_utils/common';
-import { toPromise } from '../../../data/common/utils/abort_utils';
+import { abortSignalToPromise, Defer, now } from '../../../kibana_utils/common';
import { RequestAdapter, DataAdapter, Adapters } from '../../../inspector/common';
import { isExpressionValueError, ExpressionValueError } from '../expression_types/specs/error';
import {
@@ -93,7 +92,7 @@ export class Execution<
/**
* Promise that rejects if/when abort controller sends "abort" signal.
*/
- private readonly abortRejection = toPromise(this.abortController.signal);
+ private readonly abortRejection = abortSignalToPromise(this.abortController.signal);
/**
* Races a given promise against the "abort" event of `abortController`.
diff --git a/src/plugins/expressions/common/execution/types.ts b/src/plugins/expressions/common/execution/types.ts
index 50475c3bd94ae..abe3e08fc20c2 100644
--- a/src/plugins/expressions/common/execution/types.ts
+++ b/src/plugins/expressions/common/execution/types.ts
@@ -17,16 +17,18 @@
* under the License.
*/
-import { ExpressionType } from '../expression_types';
+import { ExpressionType, SerializableState } from '../expression_types';
import { Adapters, DataAdapter, RequestAdapter } from '../../../inspector/common';
-import { TimeRange, Query, Filter } from '../../../data/common';
import { SavedObject, SavedObjectAttributes } from '../../../../core/public';
/**
* `ExecutionContext` is an object available to all functions during a single execution;
* it provides various methods to perform side-effects.
*/
-export interface ExecutionContext {
+export interface ExecutionContext<
+ InspectorAdapters extends Adapters = Adapters,
+ ExecutionContextSearch extends SerializableState = SerializableState
+> {
/**
* Get search context of the expression.
*/
@@ -79,9 +81,3 @@ export interface DefaultInspectorAdapters extends Adapters {
requests: RequestAdapter;
data: DataAdapter;
}
-
-export interface ExecutionContextSearch {
- filters?: Filter[];
- query?: Query | Query[];
- timeRange?: TimeRange;
-}
diff --git a/src/plugins/expressions/common/expression_functions/index.ts b/src/plugins/expressions/common/expression_functions/index.ts
index b29e6b78b8f4d..094fbe83efd22 100644
--- a/src/plugins/expressions/common/expression_functions/index.ts
+++ b/src/plugins/expressions/common/expression_functions/index.ts
@@ -22,3 +22,4 @@ export * from './arguments';
export * from './expression_function_parameter';
export * from './expression_function';
export * from './specs';
+export * from './series_calculation_helpers';
diff --git a/src/plugins/expressions/common/expression_functions/specs/series_calculation_helpers.ts b/src/plugins/expressions/common/expression_functions/series_calculation_helpers.ts
similarity index 97%
rename from src/plugins/expressions/common/expression_functions/specs/series_calculation_helpers.ts
rename to src/plugins/expressions/common/expression_functions/series_calculation_helpers.ts
index 8ba9d527d4c59..99ad2098ab10a 100644
--- a/src/plugins/expressions/common/expression_functions/specs/series_calculation_helpers.ts
+++ b/src/plugins/expressions/common/expression_functions/series_calculation_helpers.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { Datatable, DatatableRow } from '../../expression_types';
+import { Datatable, DatatableRow } from '../expression_types';
/**
* Returns a string identifying the group of a row by a list of columns to group by
diff --git a/src/plugins/expressions/common/expression_functions/specs/cumulative_sum.ts b/src/plugins/expressions/common/expression_functions/specs/cumulative_sum.ts
index 672abadd3c016..0d9547f70dd3b 100644
--- a/src/plugins/expressions/common/expression_functions/specs/cumulative_sum.ts
+++ b/src/plugins/expressions/common/expression_functions/specs/cumulative_sum.ts
@@ -20,7 +20,7 @@
import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from '../types';
import { Datatable } from '../../expression_types';
-import { buildResultColumns, getBucketIdentifier } from './series_calculation_helpers';
+import { buildResultColumns, getBucketIdentifier } from '../series_calculation_helpers';
export interface CumulativeSumArgs {
by?: string[];
diff --git a/src/plugins/expressions/common/expression_functions/specs/derivative.ts b/src/plugins/expressions/common/expression_functions/specs/derivative.ts
index 44ac198e2d17c..320a254bf94a9 100644
--- a/src/plugins/expressions/common/expression_functions/specs/derivative.ts
+++ b/src/plugins/expressions/common/expression_functions/specs/derivative.ts
@@ -20,7 +20,7 @@
import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from '../types';
import { Datatable } from '../../expression_types';
-import { buildResultColumns, getBucketIdentifier } from './series_calculation_helpers';
+import { buildResultColumns, getBucketIdentifier } from '../series_calculation_helpers';
export interface DerivativeArgs {
by?: string[];
diff --git a/src/plugins/expressions/common/expression_functions/specs/index.ts b/src/plugins/expressions/common/expression_functions/specs/index.ts
index 11706f65dbd32..10ccd014fd7bd 100644
--- a/src/plugins/expressions/common/expression_functions/specs/index.ts
+++ b/src/plugins/expressions/common/expression_functions/specs/index.ts
@@ -19,8 +19,6 @@
import { clog } from './clog';
import { font } from './font';
-import { kibana } from './kibana';
-import { kibanaContextFunction } from './kibana_context';
import { variableSet } from './var_set';
import { variable } from './var';
import { AnyExpressionFunctionDefinition } from '../types';
@@ -32,8 +30,6 @@ import { movingAverage } from './moving_average';
export const functionSpecs: AnyExpressionFunctionDefinition[] = [
clog,
font,
- kibana,
- kibanaContextFunction,
variableSet,
variable,
theme,
@@ -44,8 +40,6 @@ export const functionSpecs: AnyExpressionFunctionDefinition[] = [
export * from './clog';
export * from './font';
-export * from './kibana';
-export * from './kibana_context';
export * from './var_set';
export * from './var';
export * from './theme';
diff --git a/src/plugins/expressions/common/expression_functions/specs/moving_average.ts b/src/plugins/expressions/common/expression_functions/specs/moving_average.ts
index 00a4d8c45839e..c4887e0240ec0 100644
--- a/src/plugins/expressions/common/expression_functions/specs/moving_average.ts
+++ b/src/plugins/expressions/common/expression_functions/specs/moving_average.ts
@@ -20,7 +20,7 @@
import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from '../types';
import { Datatable } from '../../expression_types';
-import { buildResultColumns, getBucketIdentifier } from './series_calculation_helpers';
+import { buildResultColumns, getBucketIdentifier } from '../series_calculation_helpers';
export interface MovingAverageArgs {
by?: string[];
diff --git a/src/plugins/expressions/common/expression_functions/specs/tests/var.test.ts b/src/plugins/expressions/common/expression_functions/specs/tests/var.test.ts
index 762f34e3f5566..efcb5555cc63b 100644
--- a/src/plugins/expressions/common/expression_functions/specs/tests/var.test.ts
+++ b/src/plugins/expressions/common/expression_functions/specs/tests/var.test.ts
@@ -20,12 +20,11 @@
import { functionWrapper } from './utils';
import { variable } from '../var';
import { ExecutionContext } from '../../../execution/types';
-import { KibanaContext } from '../../../expression_types';
describe('expression_functions', () => {
describe('var', () => {
const fn = functionWrapper(variable);
- let input: Partial;
+ let input: Partial>;
let context: ExecutionContext;
beforeEach(() => {
diff --git a/src/plugins/expressions/common/expression_functions/specs/tests/var_set.test.ts b/src/plugins/expressions/common/expression_functions/specs/tests/var_set.test.ts
index 365ae5b89baea..17d9c4ab98c1a 100644
--- a/src/plugins/expressions/common/expression_functions/specs/tests/var_set.test.ts
+++ b/src/plugins/expressions/common/expression_functions/specs/tests/var_set.test.ts
@@ -20,12 +20,11 @@
import { functionWrapper } from './utils';
import { variableSet } from '../var_set';
import { ExecutionContext } from '../../../execution/types';
-import { KibanaContext } from '../../../expression_types';
describe('expression_functions', () => {
describe('var_set', () => {
const fn = functionWrapper(variableSet);
- let input: Partial;
+ let input: Partial>;
let context: ExecutionContext;
let variables: Record;
diff --git a/src/plugins/expressions/common/expression_functions/types.ts b/src/plugins/expressions/common/expression_functions/types.ts
index 4a93cfa9211ff..52e4b4d9facf3 100644
--- a/src/plugins/expressions/common/expression_functions/types.ts
+++ b/src/plugins/expressions/common/expression_functions/types.ts
@@ -24,8 +24,6 @@ import { ExecutionContext } from '../execution/types';
import {
ExpressionFunctionClog,
ExpressionFunctionFont,
- ExpressionFunctionKibanaContext,
- ExpressionFunctionKibana,
ExpressionFunctionVarSet,
ExpressionFunctionVar,
ExpressionFunctionTheme,
@@ -129,8 +127,6 @@ export type AnyExpressionFunctionDefinition = ExpressionFunctionDefinition<
export interface ExpressionFunctionDefinitions {
clog: ExpressionFunctionClog;
font: ExpressionFunctionFont;
- kibana_context: ExpressionFunctionKibanaContext;
- kibana: ExpressionFunctionKibana;
var_set: ExpressionFunctionVarSet;
var: ExpressionFunctionVar;
theme: ExpressionFunctionTheme;
diff --git a/src/plugins/expressions/common/expression_types/specs/index.ts b/src/plugins/expressions/common/expression_types/specs/index.ts
index 00c52a2545cd6..ec8dee1f7fc52 100644
--- a/src/plugins/expressions/common/expression_types/specs/index.ts
+++ b/src/plugins/expressions/common/expression_types/specs/index.ts
@@ -22,7 +22,6 @@ import { datatable } from './datatable';
import { error } from './error';
import { filter } from './filter';
import { image } from './image';
-import { kibanaContext } from './kibana_context';
import { nullType } from './null';
import { num } from './num';
import { number } from './number';
@@ -40,7 +39,6 @@ export const typeSpecs: AnyExpressionTypeDefinition[] = [
error,
filter,
image,
- kibanaContext,
nullType,
num,
number,
@@ -57,7 +55,6 @@ export * from './datatable';
export * from './error';
export * from './filter';
export * from './image';
-export * from './kibana_context';
export * from './null';
export * from './num';
export * from './number';
diff --git a/src/plugins/expressions/common/service/expressions_services.ts b/src/plugins/expressions/common/service/expressions_services.ts
index 01289ca1ae57a..c9cc0680360bb 100644
--- a/src/plugins/expressions/common/service/expressions_services.ts
+++ b/src/plugins/expressions/common/service/expressions_services.ts
@@ -26,7 +26,6 @@ import { AnyExpressionFunctionDefinition } from '../expression_functions';
import { SavedObjectReference } from '../../../../core/types';
import { PersistableStateService, SerializableState } from '../../../kibana_utils/common';
import { Adapters } from '../../../inspector/common/adapters';
-import { ExecutionContextSearch } from '../execution';
/**
* The public contract that `ExpressionsService` provides to other plugins
@@ -48,7 +47,7 @@ export type ExpressionsServiceSetup = Pick<
>;
export interface ExpressionExecutionParams {
- searchContext?: ExecutionContextSearch;
+ searchContext?: SerializableState;
variables?: Record;
diff --git a/src/plugins/expressions/kibana.json b/src/plugins/expressions/kibana.json
index 67bbf4b6e5454..23c7fe722fdb3 100644
--- a/src/plugins/expressions/kibana.json
+++ b/src/plugins/expressions/kibana.json
@@ -6,7 +6,6 @@
"extraPublicDirs": ["common", "common/fonts"],
"requiredBundles": [
"kibanaUtils",
- "inspector",
- "data"
+ "inspector"
]
}
diff --git a/src/plugins/expressions/public/index.ts b/src/plugins/expressions/public/index.ts
index 893d68238747d..385055bc2fdc2 100644
--- a/src/plugins/expressions/public/index.ts
+++ b/src/plugins/expressions/public/index.ts
@@ -66,7 +66,6 @@ export {
ExpressionFunction,
ExpressionFunctionDefinition,
ExpressionFunctionDefinitions,
- ExpressionFunctionKibana,
ExpressionFunctionParameter,
ExpressionImage,
ExpressionRenderDefinition,
@@ -81,7 +80,6 @@ export {
ExpressionValueError,
ExpressionValueNum,
ExpressionValueRender,
- ExpressionValueSearchContext,
ExpressionValueUnboxed,
ExpressionValueFilter,
Font,
@@ -96,8 +94,6 @@ export {
InterpreterErrorType,
IRegistry,
isExpressionAstBuilder,
- KIBANA_CONTEXT_NAME,
- KibanaContext,
KnownTypeToString,
Overflow,
parse,
diff --git a/src/plugins/expressions/public/plugin.test.ts b/src/plugins/expressions/public/plugin.test.ts
index d9dde1f6def68..0b21fe354d3d3 100644
--- a/src/plugins/expressions/public/plugin.test.ts
+++ b/src/plugins/expressions/public/plugin.test.ts
@@ -50,14 +50,6 @@ describe('ExpressionsPublicPlugin', () => {
const bar = await setup.run('var_set name="foo" value="bar" | var name="foo"', null);
expect(bar).toBe('bar');
});
-
- test('kibana_context function is available', async () => {
- const { setup } = await expressionsPluginMock.createPlugin();
- const result = await setup.run('kibana_context', null);
- expect(result).toMatchObject({
- type: 'kibana_context',
- });
- });
});
});
@@ -81,15 +73,6 @@ describe('ExpressionsPublicPlugin', () => {
}
`);
});
-
- test('"kibana" function return value of type "kibana_context"', async () => {
- const { doStart } = await expressionsPluginMock.createPlugin();
- const start = await doStart();
- const execution = start.execute('kibana', null);
- const result = await execution.getData();
-
- expect((result as any).type).toBe('kibana_context');
- });
});
});
});
diff --git a/src/plugins/expressions/public/public.api.md b/src/plugins/expressions/public/public.api.md
index 773d61ebe2e28..17f8e6255f6bb 100644
--- a/src/plugins/expressions/public/public.api.md
+++ b/src/plugins/expressions/public/public.api.md
@@ -130,15 +130,15 @@ export class Execution = StateContainer, ExecutionPureTransitions