mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.8`: - [[Controls] Add query settings to ES query (#157923)](https://github.com/elastic/kibana/pull/157923) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Hannah Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-05-17T18:49:49Z","message":"[Controls] Add query settings to ES query (#157923)\n\nCloses https://github.com/elastic/kibana/issues/157411\r\n\r\n## Summary\r\n\r\nThis PR sends the Kibana query settings to the controls ES query so that\r\nthings like leading wildcard queries in the query bar no longer break\r\nthem.\r\n\r\n**Before:**\r\n\r\n\r\n\r\nAs a follow up, we need to address\r\nhttps://github.com/elastic/kibana/issues/156430 so that, if a user has\r\nthe wrong query setting and ends up in an error state from something\r\nlike a leading wildcard query, they can recover without hard refreshing\r\nthe page.\r\n\r\n### Checklist\r\n\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"70407d6b19c6092427d9af10b48a183209dc682d","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","loe:hours","impact:high","Project:Controls","backport:prev-minor","v8.9.0"],"number":157923,"url":"https://github.com/elastic/kibana/pull/157923","mergeCommit":{"message":"[Controls] Add query settings to ES query (#157923)\n\nCloses https://github.com/elastic/kibana/issues/157411\r\n\r\n## Summary\r\n\r\nThis PR sends the Kibana query settings to the controls ES query so that\r\nthings like leading wildcard queries in the query bar no longer break\r\nthem.\r\n\r\n**Before:**\r\n\r\n\r\n\r\nAs a follow up, we need to address\r\nhttps://github.com/elastic/kibana/issues/156430 so that, if a user has\r\nthe wrong query setting and ends up in an error state from something\r\nlike a leading wildcard query, they can recover without hard refreshing\r\nthe page.\r\n\r\n### Checklist\r\n\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"70407d6b19c6092427d9af10b48a183209dc682d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/157923","number":157923,"mergeCommit":{"message":"[Controls] Add query settings to ES query (#157923)\n\nCloses https://github.com/elastic/kibana/issues/157411\r\n\r\n## Summary\r\n\r\nThis PR sends the Kibana query settings to the controls ES query so that\r\nthings like leading wildcard queries in the query bar no longer break\r\nthem.\r\n\r\n**Before:**\r\n\r\n\r\n\r\nAs a follow up, we need to address\r\nhttps://github.com/elastic/kibana/issues/156430 so that, if a user has\r\nthe wrong query setting and ends up in an error state from something\r\nlike a leading wildcard query, they can recover without hard refreshing\r\nthe page.\r\n\r\n### Checklist\r\n\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"70407d6b19c6092427d9af10b48a183209dc682d"}}]}] BACKPORT--> Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
This commit is contained in:
parent
0d0bf8afc4
commit
7117cc902c
1 changed files with 8 additions and 3 deletions
|
@ -9,6 +9,8 @@
|
|||
import { memoize } from 'lodash';
|
||||
|
||||
import dateMath from '@kbn/datemath';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { getEsQueryConfig } from '@kbn/data-plugin/common';
|
||||
import { buildEsQuery, type TimeRange } from '@kbn/es-query';
|
||||
import { KibanaPluginServiceFactory } from '@kbn/presentation-util-plugin/public';
|
||||
|
||||
|
@ -24,10 +26,12 @@ import { ControlsPluginStartDeps } from '../../types';
|
|||
import { ControlsOptionsListService } from './types';
|
||||
|
||||
class OptionsListService implements ControlsOptionsListService {
|
||||
private core: CoreStart;
|
||||
private data: ControlsDataService;
|
||||
private http: ControlsHTTPService;
|
||||
|
||||
constructor(requiredServices: OptionsListServiceRequiredServices) {
|
||||
constructor(core: CoreStart, requiredServices: OptionsListServiceRequiredServices) {
|
||||
this.core = core;
|
||||
({ data: this.data, http: this.http } = requiredServices);
|
||||
}
|
||||
|
||||
|
@ -85,7 +89,8 @@ class OptionsListService implements ControlsOptionsListService {
|
|||
const { query, filters, dataView, timeRange, field, ...passThroughProps } = request;
|
||||
const timeFilter = timeRange ? timeService.createFilter(dataView, timeRange) : undefined;
|
||||
const filtersToUse = [...(filters ?? []), ...(timeFilter ? [timeFilter] : [])];
|
||||
const esFilters = [buildEsQuery(dataView, query ?? [], filtersToUse ?? [])];
|
||||
const config = getEsQueryConfig(this.core.uiSettings);
|
||||
const esFilters = [buildEsQuery(dataView, query ?? [], filtersToUse ?? [], config)];
|
||||
|
||||
return {
|
||||
...passThroughProps,
|
||||
|
@ -145,5 +150,5 @@ export type OptionsListServiceFactory = KibanaPluginServiceFactory<
|
|||
>;
|
||||
|
||||
export const optionsListServiceFactory: OptionsListServiceFactory = (core, requiredServices) => {
|
||||
return new OptionsListService(requiredServices);
|
||||
return new OptionsListService(core.coreStart, requiredServices);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue