From ac3532e4bed08e786585cdb4ecd70117439298ed Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 21 Nov 2018 13:00:53 +0100 Subject: [PATCH 01/11] Use buildEsQuery for table, series and annotations --- .../metrics/public/components/_error.scss | 2 +- .../public/kbn_vis_types/request_handler.js | 8 +-- .../lib/vis_data/build_annotation_request.js | 4 +- .../server/lib/vis_data/get_annotations.js | 44 +++++++------ .../server/lib/vis_data/get_panel_data.js | 4 +- .../server/lib/vis_data/get_series_data.js | 63 +++++++++++-------- .../server/lib/vis_data/get_table_data.js | 15 +++-- .../get_es_query_uisettings.js} | 24 +++---- .../get_index_pattern.js} | 33 +++++----- .../request_processors/annotations/query.js | 25 +++----- .../request_processors/series/query.js | 17 ++--- .../request_processors/table/query.js | 20 +++--- .../lib/vis_data/series/build_request_body.js | 4 +- .../lib/vis_data/series/get_request_params.js | 29 ++++----- .../lib/vis_data/table/build_request_body.js | 4 +- .../lib/vis_data/table/get_column_data.js | 56 ----------------- 16 files changed, 150 insertions(+), 202 deletions(-) rename src/core_plugins/metrics/server/lib/vis_data/{table/get_request_params.js => helpers/get_es_query_uisettings.js} (67%) rename src/core_plugins/metrics/server/lib/vis_data/{table/handle_response_body.js => helpers/get_index_pattern.js} (52%) delete mode 100644 src/core_plugins/metrics/server/lib/vis_data/table/get_column_data.js diff --git a/src/core_plugins/metrics/public/components/_error.scss b/src/core_plugins/metrics/public/components/_error.scss index 607863ccbf0480..b9905c10113632 100644 --- a/src/core_plugins/metrics/public/components/_error.scss +++ b/src/core_plugins/metrics/public/components/_error.scss @@ -5,7 +5,7 @@ display: flex; align-items: center; justify-content: center; - + flex-direction: column; // Calculate colors similar to EuiCallout $tempBackgroundColor: tintOrShade($euiColorDanger, 90%, 70%); background-color: $tempBackgroundColor; diff --git a/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js b/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js index 810828f0885d4d..08ec1d627fe1cf 100644 --- a/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js +++ b/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js @@ -20,7 +20,6 @@ import { validateInterval } from '../lib/validate_interval'; import { timezoneProvider } from 'ui/vis/lib/timezone'; import { timefilter } from 'ui/timefilter'; -import { buildEsQuery } from '@kbn/es-query'; const MetricsRequestHandlerProvider = function (Private, Notifier, config, $http, i18n) { const notify = new Notifier({ location: i18n('tsvb.requestHandler.notifier.locationNameTitle', { defaultMessage: 'Metrics' }) }); @@ -35,14 +34,11 @@ const MetricsRequestHandlerProvider = function (Private, Notifier, config, $http const parsedTimeRange = timefilter.calculateBounds(timeRange); const scaledDataFormat = config.get('dateFormat:scaled'); const dateFormat = config.get('dateFormat'); - const esQueryConfigs = { - allowLeadingWildcards: config.get('query:allowLeadingWildcards'), - queryStringOptions: config.get('query:queryString:options'), - }; if (panel && panel.id) { const params = { timerange: { timezone, ...parsedTimeRange }, - filters: [buildEsQuery(undefined, [query], filters, esQueryConfigs)], + query, + filters, panels: [panel], state: uiStateObj }; diff --git a/src/core_plugins/metrics/server/lib/vis_data/build_annotation_request.js b/src/core_plugins/metrics/server/lib/vis_data/build_annotation_request.js index 92902a999b43fc..1796f3a0a7927b 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/build_annotation_request.js +++ b/src/core_plugins/metrics/server/lib/vis_data/build_annotation_request.js @@ -20,8 +20,8 @@ import buildProcessorFunction from './build_processor_function'; import processors from './request_processors/annotations'; -export default function buildAnnotationRequest(req, panel, annotation) { - const processor = buildProcessorFunction(processors, req, panel, annotation); +export default function buildAnnotationRequest(req, panel, annotation, esQueryConfig, indexPattern) { + const processor = buildProcessorFunction(processors, req, panel, annotation, esQueryConfig, indexPattern); const doc = processor({}); return doc; } diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js b/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js index 513cf9ba40d7a2..566757cb40b2a0 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js @@ -19,6 +19,7 @@ import buildAnnotationRequest from './build_annotation_request'; import handleAnnotationResponse from './handle_annotation_response'; +import { getIndexPatternObject } from './helpers/get_index_pattern'; function validAnnotation(annotation) { return annotation.index_pattern && @@ -28,28 +29,19 @@ function validAnnotation(annotation) { annotation.template; } -export default async (req, panel) => { +export default async (req, panel, esQueryConfig) => { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('data'); - const bodies = panel.annotations + const bodiesPromises = panel.annotations .filter(validAnnotation) .map(annotation => { - - const indexPattern = annotation.index_pattern; - const bodies = []; - - bodies.push({ - index: indexPattern, - ignore: [404], - timeout: '90s', - requestTimeout: 90000, - ignoreUnavailable: true, - }); - - bodies.push(buildAnnotationRequest(req, panel, annotation)); - return bodies; + return getAnnotationBody(req, panel, annotation, esQueryConfig); }); - - if (!bodies.length) return { responses: [] }; + const bodies = await Promise.all(bodiesPromises); + if (!bodies.length) { + return { + responses: [], + }; + } try { const resp = await callWithRequest(req, 'msearch', { body: bodies.reduce((acc, item) => acc.concat(item), []) @@ -66,6 +58,20 @@ export default async (req, panel) => { if (error.message === 'missing-indices') return { responses: [] }; throw error; } - }; +async function getAnnotationBody(req, panel, annotation, esQueryConfig) { + const indexPatternString = annotation.index_pattern; + const indexPatternObject = await getIndexPatternObject(req, indexPatternString); + const request = buildAnnotationRequest(req, panel, annotation, esQueryConfig, indexPatternObject); + return [ + { + index: indexPatternString, + ignore: [404], + timeout: '90s', + requestTimeout: 90000, + ignoreUnavailable: true, + }, + request, + ]; +} \ No newline at end of file diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js b/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js index d22ca5e2ff4d9a..865e97f370288c 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js @@ -21,7 +21,9 @@ import { getTableData } from './get_table_data'; import { getSeriesData } from './get_series_data'; export default function getPanelData(req) { return panel => { - if (panel.type === 'table') return getTableData(req, panel); + if (panel.type === 'table') { + return getTableData(req, panel); + } return getSeriesData(req, panel); }; } diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js b/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js index 4dd8b609b8ee1b..5f74f09a24ff5d 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js @@ -21,33 +21,44 @@ import getRequestParams from './series/get_request_params'; import handleResponseBody from './series/handle_response_body'; import handleErrorResponse from './handle_error_response'; import getAnnotations from './get_annotations'; -export function getSeriesData(req, panel) { +import { getEsQueryConfig } from './helpers/get_es_query_uisettings'; + +export async function getSeriesData(req, panel) { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('data'); - const bodies = panel.series.map(series => getRequestParams(req, panel, series)); - const params = { - body: bodies.reduce((acc, items) => acc.concat(items), []) - }; - return callWithRequest(req, 'msearch', params) - .then(resp => { - const series = resp.responses.map(handleResponseBody(panel)); - return { - [panel.id]: { - id: panel.id, - series: series.reduce((acc, series) => acc.concat(series), []) - } - }; - }) - .then(resp => { - if (!panel.annotations || panel.annotations.length === 0) return resp; - return getAnnotations(req, panel).then(annotations => { - resp[panel.id].annotations = annotations; + const esQueryConfig = await getEsQueryConfig(req); + + try { + const bodiesPromises = panel.series.map(series => getRequestParams(req, panel, series, esQueryConfig)); + const bodies = await Promise.all(bodiesPromises); + const params = { + body: bodies.reduce((acc, items) => acc.concat(items), []) + }; + return callWithRequest(req, 'msearch', params) + .then(resp => { + const series = resp.responses.map(handleResponseBody(panel)); + return { + [panel.id]: { + id: panel.id, + series: series.reduce((acc, series) => acc.concat(series), []) + } + }; + }) + .then(resp => { + if (!panel.annotations || panel.annotations.length === 0) return resp; + return getAnnotations(req, panel, esQueryConfig).then(annotations => { + resp[panel.id].annotations = annotations; + return resp; + }); + }) + .then(resp => { + resp.type = panel.type; return resp; - }); - }) - .then(resp => { - resp.type = panel.type; - return resp; - }) - .catch(handleErrorResponse(panel)); + }) + .catch(handleErrorResponse(panel)); + } catch(e) { + console.error(e); + // TODO handle kql query errors + return handleErrorResponse(e); + } } diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_table_data.js b/src/core_plugins/metrics/server/lib/vis_data/get_table_data.js index ea202a94af41ed..e894b989b77ba3 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_table_data.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_table_data.js @@ -16,16 +16,23 @@ * specific language governing permissions and limitations * under the License. */ - +import { get } from 'lodash'; import buildRequestBody from './table/build_request_body'; import handleErrorResponse from './handle_error_response'; -import { get } from 'lodash'; import processBucket from './table/process_bucket'; +import { getIndexPatternObject } from './helpers/get_index_pattern'; +import { getEsQueryConfig } from './helpers/get_es_query_uisettings'; + + export async function getTableData(req, panel) { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('data'); + const indexPatternString = panel.index_pattern; + + const esQueryConfig = await getEsQueryConfig(req); + const indexPatternObject = await getIndexPatternObject(req, indexPatternString); const params = { - index: panel.index_pattern, - body: buildRequestBody(req, panel) + index: indexPatternString, + body: buildRequestBody(req, panel, esQueryConfig, indexPatternObject) }; try { const resp = await callWithRequest(req, 'search', params); diff --git a/src/core_plugins/metrics/server/lib/vis_data/table/get_request_params.js b/src/core_plugins/metrics/server/lib/vis_data/helpers/get_es_query_uisettings.js similarity index 67% rename from src/core_plugins/metrics/server/lib/vis_data/table/get_request_params.js rename to src/core_plugins/metrics/server/lib/vis_data/helpers/get_es_query_uisettings.js index c24d812c263fb7..f5ee2335cd121f 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/table/get_request_params.js +++ b/src/core_plugins/metrics/server/lib/vis_data/helpers/get_es_query_uisettings.js @@ -17,18 +17,12 @@ * under the License. */ -import buildRequestBody from './build_request_body'; -export default (req, panel, entities) => { - const bodies = []; - entities.forEach(entity => { - bodies.push({ - index: panel.index_pattern, - ignore: [404], - timeout: '90s', - requestTimeout: 90000, - ignoreUnavailable: true, - }); - bodies.push(buildRequestBody(req, panel, entity)); - }); - return bodies; -}; +export async function getEsQueryConfig(req) { + const uiSettings = req.getUiSettingsService(); + const allowLeadingWildcards = await uiSettings.get('query:allowLeadingWildcards'); + const queryStringOptions = await uiSettings.get('query:queryString:options'); + return { + allowLeadingWildcards, + queryStringOptions: JSON.parse(queryStringOptions), + }; +} diff --git a/src/core_plugins/metrics/server/lib/vis_data/table/handle_response_body.js b/src/core_plugins/metrics/server/lib/vis_data/helpers/get_index_pattern.js similarity index 52% rename from src/core_plugins/metrics/server/lib/vis_data/table/handle_response_body.js rename to src/core_plugins/metrics/server/lib/vis_data/helpers/get_index_pattern.js index 106dda20f0e0c3..391f36cd439ba4 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/table/handle_response_body.js +++ b/src/core_plugins/metrics/server/lib/vis_data/helpers/get_index_pattern.js @@ -17,20 +17,25 @@ * under the License. */ -import buildProcessorFunction from '../build_processor_function'; -import _ from 'lodash'; -import processors from '../response_processors/table'; +export async function getIndexPatternObject(req, indexPatternString) { + // getting the matching index pattern + const savedObjectClient = req.getSavedObjectsClient(); + const indexPatternObjects = await savedObjectClient.find({ + type: 'index-pattern', + fields: ['title', 'fields'], + search: `"${indexPatternString}"`, + search_fields: ['title'], + }); -export default function handleResponseBody(panel) { - return resp => { - if (resp.error) { - const err = new Error(resp.error.type); - err.response = JSON.stringify(resp); - throw err; - } - return panel.columns.map(column => { - const processor = buildProcessorFunction(processors, resp, panel, column); - return _.first(processor([])); + // getting the index pattern fields + const indexPatterns = indexPatternObjects.saved_objects + .filter(obj => obj.attributes.title === indexPatternString) + .map(indexPattern => { + const { title, fields } = indexPattern.attributes; + return { + title, + fields: JSON.parse(fields), + }; }); - }; + return indexPatterns.length === 1 ? indexPatterns[0] : null; } diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js index 922a945883dd09..3cb5a3940f14f8 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js @@ -19,21 +19,19 @@ import getBucketSize from '../../helpers/get_bucket_size'; import getTimerange from '../../helpers/get_timerange'; -export default function query(req, panel, annotation) { +import { buildEsQuery } from '@kbn/es-query'; + +export default function query(req, panel, annotation, esQueryConfig, indexPattern) { return next => doc => { const timeField = annotation.time_field; - const { - bucketSize - } = getBucketSize(req, 'auto'); + const { bucketSize } = getBucketSize(req, 'auto'); const { from, to } = getTimerange(req); doc.size = 0; - doc.query = { - bool: { - must: [] - } - }; - + const queries = req.payload.query ? [req.payload.query] : []; + console.log(JSON.stringify(annotation, null, 2)); + const filters = !annotation.ignore_global_filters ? req.payload.filters : []; + doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); const timerange = { range: { [timeField]: { @@ -54,11 +52,6 @@ export default function query(req, panel, annotation) { }); } - const globalFilters = req.payload.filters; - if (!annotation.ignore_global_filters) { - doc.query.bool.must = doc.query.bool.must.concat(globalFilters); - } - if (!annotation.ignore_panel_filters && panel.filter) { doc.query.bool.must.push({ query_string: { @@ -76,7 +69,5 @@ export default function query(req, panel, annotation) { } return next(doc); - }; } - diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js index 65813ff42a8088..e5cdc0a45800ba 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js @@ -19,17 +19,17 @@ import offsetTime from '../../offset_time'; import getIntervalAndTimefield from '../../get_interval_and_timefield'; -export default function query(req, panel, series) { +import { buildEsQuery } from '@kbn/es-query'; + +export default function query(req, panel, series, esQueryConfig, indexPattern) { return next => doc => { const { timeField } = getIntervalAndTimefield(panel, series); const { from, to } = offsetTime(req, series.offset_time); doc.size = 0; - doc.query = { - bool: { - must: [] - } - }; + const queries = req.payload.query ? [req.payload.query] : []; + const filters = !panel.ignore_global_filter ? req.payload.filters : []; + doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); const timerange = { range: { @@ -42,11 +42,6 @@ export default function query(req, panel, series) { }; doc.query.bool.must.push(timerange); - const globalFilters = req.payload.filters; - if (globalFilters && !panel.ignore_global_filter) { - doc.query.bool.must = doc.query.bool.must.concat(globalFilters); - } - if (panel.filter) { doc.query.bool.must.push({ query_string: { diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js index 77a970003d93ca..c12579625e5491 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js @@ -16,20 +16,21 @@ * specific language governing permissions and limitations * under the License. */ - +import { buildEsQuery } from '@kbn/es-query'; import getTimerange from '../../helpers/get_timerange'; import getIntervalAndTimefield from '../../get_interval_and_timefield'; -export default function query(req, panel) { + +export default function query(req, panel, esQueryConfig, indexPattern) { return next => doc => { const { timeField } = getIntervalAndTimefield(panel); const { from, to } = getTimerange(req); doc.size = 0; - doc.query = { - bool: { - must: [] - } - }; + + const queries = req.payload.query ? [req.payload.query] : []; + const filters = !panel.ignore_global_filter ? req.payload.filters : []; + doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); + const timerange = { range: { @@ -42,11 +43,6 @@ export default function query(req, panel) { }; doc.query.bool.must.push(timerange); - const globalFilters = req.payload.filters; - if (globalFilters && !panel.ignore_global_filter) { - doc.query.bool.must = doc.query.bool.must.concat(globalFilters); - } - if (panel.filter) { doc.query.bool.must.push({ query_string: { diff --git a/src/core_plugins/metrics/server/lib/vis_data/series/build_request_body.js b/src/core_plugins/metrics/server/lib/vis_data/series/build_request_body.js index 0afe2869b72fa5..c25127b68a6bcd 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/series/build_request_body.js +++ b/src/core_plugins/metrics/server/lib/vis_data/series/build_request_body.js @@ -20,8 +20,8 @@ import buildProcessorFunction from '../build_processor_function'; import processors from '../request_processors/series'; -function buildRequestBody(req, panel, series) { - const processor = buildProcessorFunction(processors, req, panel, series); +function buildRequestBody(req, panel, series, esQueryConfig, indexPattern) { + const processor = buildProcessorFunction(processors, req, panel, series, esQueryConfig, indexPattern); const doc = processor({}); return doc; } diff --git a/src/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js b/src/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js index 5196ef7ead1975..d68ebeb7b9f92e 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js +++ b/src/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js @@ -18,19 +18,20 @@ */ import buildRequestBody from './build_request_body'; +import { getIndexPatternObject } from '../helpers/get_index_pattern'; -export default (req, panel, series) => { - const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; - const bodies = []; - - bodies.push({ - index: indexPattern, - ignore: [404], - timeout: '90s', - requestTimeout: 90000, - ignoreUnavailable: true, - }); - - bodies.push(buildRequestBody(req, panel, series)); - return bodies; +export default async (req, panel, series, esQueryConfig) => { + const indexPatternString = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; + const indexPatternObject = await getIndexPatternObject(req, indexPatternString); + const request = buildRequestBody(req, panel, series, esQueryConfig, indexPatternObject); + return [ + { + index: indexPatternString, + ignore: [404], + timeout: '90s', + requestTimeout: 90000, + ignoreUnavailable: true, + }, + request, + ]; }; diff --git a/src/core_plugins/metrics/server/lib/vis_data/table/build_request_body.js b/src/core_plugins/metrics/server/lib/vis_data/table/build_request_body.js index 8a71a7ba79f0a3..7e509a5ebf2e5e 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/table/build_request_body.js +++ b/src/core_plugins/metrics/server/lib/vis_data/table/build_request_body.js @@ -20,8 +20,8 @@ import buildProcessorFunction from '../build_processor_function'; import processors from '../request_processors/table'; -function buildRequestBody(req, panel) { - const processor = buildProcessorFunction(processors, req, panel); +function buildRequestBody(req, panel, esQueryConfig, indexPattern) { + const processor = buildProcessorFunction(processors, req, panel, esQueryConfig, indexPattern); const doc = processor({}); return doc; } diff --git a/src/core_plugins/metrics/server/lib/vis_data/table/get_column_data.js b/src/core_plugins/metrics/server/lib/vis_data/table/get_column_data.js deleted file mode 100644 index 6e5a2d0d544eb6..00000000000000 --- a/src/core_plugins/metrics/server/lib/vis_data/table/get_column_data.js +++ /dev/null @@ -1,56 +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 getRequestParams from './get_request_params'; -import handleResponseBody from './handle_response_body'; -import handleErrorResponse from '../handle_error_response'; -import getLastValue from '../../../../common/get_last_value'; -import _ from 'lodash'; -import regression from 'regression'; -export function getColumnData(req, panel, entities, client) { - const elasticsearch = _.get(req, 'server.plugins.elasticsearch'); - if (elasticsearch) { - const { callWithRequest } = elasticsearch.getCluster('data'); - if (!client) { - client = callWithRequest.bind(null, req); - } - } - const params = { - body: getRequestParams(req, panel, entities) - }; - return client('msearch', params) - .then(resp => { - const handler = handleResponseBody(panel); - return entities.map((entity, index) => { - entity.data = {}; - handler(resp.responses[index]).forEach(row => { - const linearRegression = regression('linear', row.data); - entity.data[row.id] = { - last: getLastValue(row.data), - slope: linearRegression.equation[0], - yIntercept: linearRegression.equation[1], - label: row.label - }; - }); - return entity; - }); - }) - .catch(handleErrorResponse(panel)); -} - From 7f1464b8caca8af4fc0ade490a098b4e4f37569c Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 21 Nov 2018 17:52:38 +0100 Subject: [PATCH 02/11] Fix query test. Using the buildEsQuery changed a bit the order of the must.bool array on the query --- .../series/__tests__/query.js | 90 ++++++++++++------- .../series/__tests__/build_request_body.js | 31 ++++--- 2 files changed, 75 insertions(+), 46 deletions(-) diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/query.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/query.js index a889c8b3e96b64..dd18d1c865e1bb 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/query.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/query.js @@ -26,6 +26,10 @@ describe('query(req, panel, series)', () => { let panel; let series; let req; + const config = { + allowLeadingWildcards: true, + queryStringOptions: {}, + }; beforeEach(() => { req = { payload: { @@ -45,17 +49,18 @@ describe('query(req, panel, series)', () => { it('calls next when finished', () => { const next = sinon.spy(); - query(req, panel, series)(next)({}); + query(req, panel, series, config)(next)({}); expect(next.calledOnce).to.equal(true); }); it('returns doc with query for timerange', () => { const next = doc => doc; - const doc = query(req, panel, series)(next)({}); + const doc = query(req, panel, series, config)(next)({}); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ { range: { @@ -66,7 +71,9 @@ describe('query(req, panel, series)', () => { } } } - ] + ], + must_not: [], + should: [], } } }); @@ -75,11 +82,12 @@ describe('query(req, panel, series)', () => { it('returns doc with query for timerange (offset by 1h)', () => { series.offset_time = '1h'; const next = doc => doc; - const doc = query(req, panel, series)(next)({}); + const doc = query(req, panel, series, config)(next)({}); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ { range: { @@ -90,7 +98,9 @@ describe('query(req, panel, series)', () => { } } } - ] + ], + must_not: [], + should: [], } } }); @@ -111,21 +121,13 @@ describe('query(req, panel, series)', () => { } ]; const next = doc => doc; - const doc = query(req, panel, series)(next)({}); + const doc = query(req, panel, series, config)(next)({}); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ - { - range: { - timestamp: { - gte: 1483228800000, - lte: 1483232400000, - format: 'epoch_millis' - } - } - }, { bool: { must: [ @@ -136,8 +138,19 @@ describe('query(req, panel, series)', () => { } ] } - } - ] + }, + { + range: { + timestamp: { + gte: 1483228800000, + lte: 1483232400000, + format: 'epoch_millis' + } + } + }, + ], + must_not: [], + should: [], } } }); @@ -146,11 +159,12 @@ describe('query(req, panel, series)', () => { it('returns doc with series filter', () => { series.filter = 'host:web-server'; const next = doc => doc; - const doc = query(req, panel, series)(next)({}); + const doc = query(req, panel, series, config)(next)({}); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ { range: { @@ -166,8 +180,10 @@ describe('query(req, panel, series)', () => { query: series.filter, analyze_wildcard: true } - } - ] + }, + ], + must_not: [], + should: [], } } }); @@ -188,21 +204,13 @@ describe('query(req, panel, series)', () => { ]; panel.filter = 'host:web-server'; const next = doc => doc; - const doc = query(req, panel, series)(next)({}); + const doc = query(req, panel, series, config)(next)({}); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ - { - range: { - timestamp: { - gte: 1483228800000, - lte: 1483232400000, - format: 'epoch_millis' - } - } - }, { bool: { must: [ @@ -214,13 +222,24 @@ describe('query(req, panel, series)', () => { ] } }, + { + range: { + timestamp: { + gte: 1483228800000, + lte: 1483232400000, + format: 'epoch_millis' + } + } + }, { query_string: { query: panel.filter, analyze_wildcard: true } } - ] + ], + must_not: [], + should: [], } } }); @@ -243,11 +262,12 @@ describe('query(req, panel, series)', () => { panel.filter = 'host:web-server'; panel.ignore_global_filter = true; const next = doc => doc; - const doc = query(req, panel, series)(next)({}); + const doc = query(req, panel, series, config)(next)({}); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ { range: { @@ -263,8 +283,10 @@ describe('query(req, panel, series)', () => { query: panel.filter, analyze_wildcard: true } - } - ] + }, + ], + must_not: [], + should: [], } } }); diff --git a/src/core_plugins/metrics/server/lib/vis_data/series/__tests__/build_request_body.js b/src/core_plugins/metrics/server/lib/vis_data/series/__tests__/build_request_body.js index 31699e3c418313..cb944bb8363fae 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/series/__tests__/build_request_body.js +++ b/src/core_plugins/metrics/server/lib/vis_data/series/__tests__/build_request_body.js @@ -82,21 +82,17 @@ describe('buildRequestBody(req)', () => { it('returns a valid body', () => { const panel = body.panels[0]; const series = panel.series[0]; - const doc = buildRequestBody({ payload: body }, panel, series); + const config = { + allowLeadingWildcards: true, + queryStringOptions: {}, + }; + const doc = buildRequestBody({ payload: body }, panel, series, config); expect(doc).to.eql({ size: 0, query: { bool: { + filter: [], must: [ - { - range: { - '@timestamp': { - gte: 1485463055881, - lte: 1485463955881, - format: 'epoch_millis' - } - } - }, { bool: { must: [ @@ -109,8 +105,19 @@ describe('buildRequestBody(req)', () => { ], must_not: [] } - } - ] + }, + { + range: { + '@timestamp': { + gte: 1485463055881, + lte: 1485463955881, + format: 'epoch_millis' + } + } + }, + ], + must_not: [], + should: [], } }, aggs: { From 9db9e9d3e26590c9dab813573a3af06440f66637 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 28 Nov 2018 10:42:59 +0100 Subject: [PATCH 03/11] Remove console.log --- .../server/lib/vis_data/request_processors/annotations/query.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js index 3cb5a3940f14f8..c40f9f29b2dee7 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js @@ -29,7 +29,6 @@ export default function query(req, panel, annotation, esQueryConfig, indexPatter doc.size = 0; const queries = req.payload.query ? [req.payload.query] : []; - console.log(JSON.stringify(annotation, null, 2)); const filters = !annotation.ignore_global_filters ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); const timerange = { From 15125bd7ac0c15429473d8f40d5c9aa567583102 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 28 Nov 2018 10:46:06 +0100 Subject: [PATCH 04/11] Remove console.error and comment --- src/core_plugins/metrics/server/lib/vis_data/get_series_data.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js b/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js index 5f74f09a24ff5d..c1c1bc882e7d77 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_series_data.js @@ -56,8 +56,6 @@ export async function getSeriesData(req, panel) { }) .catch(handleErrorResponse(panel)); } catch(e) { - console.error(e); - // TODO handle kql query errors return handleErrorResponse(e); } } From b4a570fdc2195ba1e5561fa2975ff9a4a45edcb7 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 5 Dec 2018 16:57:16 +0100 Subject: [PATCH 05/11] Fix wrong merge of PR #26510 --- .../metrics/server/lib/vis_data/get_annotations.js | 4 +--- .../metrics/server/lib/vis_data/series/get_request_params.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/get_annotations.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/get_annotations.js index 566757cb40b2a0..9a5cb00a2cd4e4 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/get_annotations.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/get_annotations.js @@ -64,12 +64,10 @@ async function getAnnotationBody(req, panel, annotation, esQueryConfig) { const indexPatternString = annotation.index_pattern; const indexPatternObject = await getIndexPatternObject(req, indexPatternString); const request = buildAnnotationRequest(req, panel, annotation, esQueryConfig, indexPatternObject); + request.timeout = '90s'; return [ { index: indexPatternString, - ignore: [404], - timeout: '90s', - requestTimeout: 90000, ignoreUnavailable: true, }, request, diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js index d68ebeb7b9f92e..598ebed73b94cd 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/series/get_request_params.js @@ -24,12 +24,10 @@ export default async (req, panel, series, esQueryConfig) => { const indexPatternString = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; const indexPatternObject = await getIndexPatternObject(req, indexPatternString); const request = buildRequestBody(req, panel, series, esQueryConfig, indexPatternObject); + request.timeout = '90s'; return [ { index: indexPatternString, - ignore: [404], - timeout: '90s', - requestTimeout: 90000, ignoreUnavailable: true, }, request, From a61214e6870e87579aca0dce0e1397e57fb0e123 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Mon, 17 Dec 2018 17:44:27 +0100 Subject: [PATCH 06/11] Fix default/empty index_pattern When the user save the visualization without configuring manually an index_pattern, a default empty string is used instead of the default pattern. This leads to an empty visualization after the refactoring done in #24832. Now it will update the index_pattern field with the default index pattern in visualize editor and on dashboard. --- .../public/kbn_vis_types/editor_controller.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js b/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js index 89c859fdd421c7..68f388deeccbbd 100644 --- a/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js +++ b/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js @@ -20,6 +20,7 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; +import chrome from 'ui/chrome'; function ReactEditorControllerProvider(Private, config) { class ReactEditorController { @@ -31,6 +32,7 @@ function ReactEditorControllerProvider(Private, config) { async render(params) { const Component = this.vis.type.editorConfig.component; + await this.setDefaultIndexPattern(params.appState); render( , this.el); } + setDefaultIndexPattern = async (appState) => { + if (this.vis.params.index_pattern === '') { + // set the default index pattern if none is defined. + const savedObjectsClient = chrome.getSavedObjectsClient(); + const indexPattern = await savedObjectsClient.get('index-pattern', config.get('defaultIndex')); + this.vis.params.index_pattern = indexPattern.attributes.title; + appState.vis.params.index_pattern = indexPattern.attributes.title; + } + } + resize() { if (this.visData) { this.render(this.visData); From 85b81fc1c35ef260e2eaeee4a6f25b2a90490989 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Tue, 8 Jan 2019 12:24:51 +0100 Subject: [PATCH 07/11] Remove unnecessary wrapping query in an array --- .../server/lib/vis_data/request_processors/annotations/query.js | 2 +- .../server/lib/vis_data/request_processors/series/query.js | 2 +- .../server/lib/vis_data/request_processors/table/query.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js index c40f9f29b2dee7..d61894dc0112df 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js @@ -28,7 +28,7 @@ export default function query(req, panel, annotation, esQueryConfig, indexPatter const { from, to } = getTimerange(req); doc.size = 0; - const queries = req.payload.query ? [req.payload.query] : []; + const queries = req.payload.query || []; const filters = !annotation.ignore_global_filters ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); const timerange = { diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js index e5cdc0a45800ba..a549888b1478e7 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js @@ -27,7 +27,7 @@ export default function query(req, panel, series, esQueryConfig, indexPattern) { const { from, to } = offsetTime(req, series.offset_time); doc.size = 0; - const queries = req.payload.query ? [req.payload.query] : []; + const queries = req.payload.query || []; const filters = !panel.ignore_global_filter ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js index c12579625e5491..6bf9ff823a5970 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js @@ -27,7 +27,7 @@ export default function query(req, panel, esQueryConfig, indexPattern) { doc.size = 0; - const queries = req.payload.query ? [req.payload.query] : []; + const queries = req.payload.query || []; const filters = !panel.ignore_global_filter ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); From 0c431f31c174ad08a1bb70df5ea496db8109e022 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Tue, 8 Jan 2019 12:37:25 +0100 Subject: [PATCH 08/11] Enable query bar on tsvb --- src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js b/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js index 27793e22e6cffb..717d0e04ba3af1 100644 --- a/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js +++ b/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js @@ -77,7 +77,7 @@ export default function MetricsVisProvider(Private, i18n) { component: require('../components/vis_editor') }, options: { - showQueryBar: false, + showQueryBar: true, showFilterBar: false, showIndexSelection: false }, From 5e78ee9142ca3df70f77d4360b33fcabda88e0e9 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Fri, 18 Jan 2019 11:06:03 +0100 Subject: [PATCH 09/11] Remove unnecessary setDefaultIndexPattern After fixing the null index pattern issue in kql there is no need to use set the default index pattern before rendering. --- .../public/kbn_vis_types/editor_controller.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js b/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js index 68f388deeccbbd..af40856fb20df9 100644 --- a/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js +++ b/src/legacy/core_plugins/metrics/public/kbn_vis_types/editor_controller.js @@ -20,7 +20,6 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; -import chrome from 'ui/chrome'; function ReactEditorControllerProvider(Private, config) { class ReactEditorController { @@ -32,7 +31,6 @@ function ReactEditorControllerProvider(Private, config) { async render(params) { const Component = this.vis.type.editorConfig.component; - await this.setDefaultIndexPattern(params.appState); render( - , this.el); - } - - setDefaultIndexPattern = async (appState) => { - if (this.vis.params.index_pattern === '') { - // set the default index pattern if none is defined. - const savedObjectsClient = chrome.getSavedObjectsClient(); - const indexPattern = await savedObjectsClient.get('index-pattern', config.get('defaultIndex')); - this.vis.params.index_pattern = indexPattern.attributes.title; - appState.vis.params.index_pattern = indexPattern.attributes.title; - } + , + this.el); } resize() { From 9384a2d1d69fc9fefdf638d5caec5579a76e45c2 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 23 Jan 2019 19:10:33 +0100 Subject: [PATCH 10/11] fix(tsvb-server): Ignore query bar search on ignore_global_filters param This commit mimic the behaviour of the ignore_global_filters currently used with lucene syntax: if you enable the ignore_global_filter option on data or on annotations, data or annotations are filtered out when using the filter bar and the search bar --- .../request_processors/annotations/query.js | 16 ++++++++-------- .../vis_data/request_processors/series/query.js | 15 +++++++-------- .../vis_data/request_processors/table/query.js | 12 +++++------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js index d61894dc0112df..2e4f765b213213 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/query.js @@ -28,17 +28,17 @@ export default function query(req, panel, annotation, esQueryConfig, indexPatter const { from, to } = getTimerange(req); doc.size = 0; - const queries = req.payload.query || []; + const queries = !annotation.ignore_global_filters ? req.payload.query : []; const filters = !annotation.ignore_global_filters ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); const timerange = { range: { [timeField]: { gte: from.valueOf(), - lte: to.valueOf() - (bucketSize * 1000), + lte: to.valueOf() - bucketSize * 1000, format: 'epoch_millis', - } - } + }, + }, }; doc.query.bool.must.push(timerange); @@ -46,8 +46,8 @@ export default function query(req, panel, annotation, esQueryConfig, indexPatter doc.query.bool.must.push({ query_string: { query: annotation.query_string, - analyze_wildcard: true - } + analyze_wildcard: true, + }, }); } @@ -55,8 +55,8 @@ export default function query(req, panel, annotation, esQueryConfig, indexPatter doc.query.bool.must.push({ query_string: { query: panel.filter, - analyze_wildcard: true - } + analyze_wildcard: true, + }, }); } diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js index a549888b1478e7..9a08aec011cc57 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/series/query.js @@ -27,7 +27,7 @@ export default function query(req, panel, series, esQueryConfig, indexPattern) { const { from, to } = offsetTime(req, series.offset_time); doc.size = 0; - const queries = req.payload.query || []; + const queries = !panel.ignore_global_filter ? req.payload.query : []; const filters = !panel.ignore_global_filter ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); @@ -37,8 +37,8 @@ export default function query(req, panel, series, esQueryConfig, indexPattern) { gte: from.valueOf(), lte: to.valueOf(), format: 'epoch_millis', - } - } + }, + }, }; doc.query.bool.must.push(timerange); @@ -46,8 +46,8 @@ export default function query(req, panel, series, esQueryConfig, indexPattern) { doc.query.bool.must.push({ query_string: { query: panel.filter, - analyze_wildcard: true - } + analyze_wildcard: true, + }, }); } @@ -55,12 +55,11 @@ export default function query(req, panel, series, esQueryConfig, indexPattern) { doc.query.bool.must.push({ query_string: { query: series.filter, - analyze_wildcard: true - } + analyze_wildcard: true, + }, }); } return next(doc); - }; } diff --git a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js index 6bf9ff823a5970..ece96f19c36070 100644 --- a/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js +++ b/src/legacy/core_plugins/metrics/server/lib/vis_data/request_processors/table/query.js @@ -27,19 +27,18 @@ export default function query(req, panel, esQueryConfig, indexPattern) { doc.size = 0; - const queries = req.payload.query || []; + const queries = !panel.ignore_global_filter ? req.payload.query : []; const filters = !panel.ignore_global_filter ? req.payload.filters : []; doc.query = buildEsQuery(indexPattern, queries, filters, esQueryConfig); - const timerange = { range: { [timeField]: { gte: from.valueOf(), lte: to.valueOf(), format: 'epoch_millis', - } - } + }, + }, }; doc.query.bool.must.push(timerange); @@ -47,12 +46,11 @@ export default function query(req, panel, esQueryConfig, indexPattern) { doc.query.bool.must.push({ query_string: { query: panel.filter, - analyze_wildcard: true - } + analyze_wildcard: true, + }, }); } return next(doc); - }; } From 940aba6e25fde527ec2d67aa37ff527aa16f78eb Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 30 Jan 2019 18:13:13 +0100 Subject: [PATCH 11/11] Disable showQueryBar --- src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js b/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js index 717d0e04ba3af1..27793e22e6cffb 100644 --- a/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js +++ b/src/legacy/core_plugins/metrics/public/kbn_vis_types/index.js @@ -77,7 +77,7 @@ export default function MetricsVisProvider(Private, i18n) { component: require('../components/vis_editor') }, options: { - showQueryBar: true, + showQueryBar: false, showFilterBar: false, showIndexSelection: false },