diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js index de8469adfb8a73..f6530eb22332a8 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js +++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/index_pattern.js @@ -206,6 +206,7 @@ export const IndexPattern = ({ fields, prefix, onChange, disabled, model: _model })} > { const { name } = props; return () => { @@ -38,6 +38,7 @@ export function YesNo(props) {
{ await comboBox.clearInputField('metricsIndexPatternFieldsSelect'); diff --git a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js b/x-pack/legacy/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js index 7a944c5e9a5c0e..42c950f0b0d74a 100644 --- a/x-pack/legacy/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js +++ b/x-pack/legacy/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js @@ -13,7 +13,7 @@ export const RollupPrompt = () => (

Kibana's support for rollup index patterns is in beta. You might encounter issues using these patterns in saved searches, visualizations, and dashboards. They are not supported in - advanced features, such as TSVB, Timelion, and Machine Learning. + some advanced features, such as Timelion, and Machine Learning.

You can match a rollup index pattern against one rollup index and zero or more regular diff --git a/x-pack/test/functional/apps/rollup_job/index.js b/x-pack/test/functional/apps/rollup_job/index.js index 146cc4e8dbdf00..055b239058eac0 100644 --- a/x-pack/test/functional/apps/rollup_job/index.js +++ b/x-pack/test/functional/apps/rollup_job/index.js @@ -10,5 +10,6 @@ export default function({ loadTestFile }) { loadTestFile(require.resolve('./rollup_jobs')); loadTestFile(require.resolve('./hybrid_index_pattern')); + loadTestFile(require.resolve('./tsvb')); }); } diff --git a/x-pack/test/functional/apps/rollup_job/tsvb.js b/x-pack/test/functional/apps/rollup_job/tsvb.js new file mode 100644 index 00000000000000..f3782c4c916449 --- /dev/null +++ b/x-pack/test/functional/apps/rollup_job/tsvb.js @@ -0,0 +1,105 @@ +/* + * 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. + */ + +import datemath from '@elastic/datemath'; +import expect from '@kbn/expect'; +import mockRolledUpData from './hybrid_index_helper'; + +export default function({ getService, getPageObjects }) { + const es = getService('legacyEs'); + const esArchiver = getService('esArchiver'); + const retry = getService('retry'); + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects([ + 'common', + 'settings', + 'visualize', + 'visualBuilder', + 'timePicker', + ]); + + describe('tsvb integration', function() { + //Since rollups can only be created once with the same name (even if you delete it), + //we add the Date.now() to avoid name collision if you run the tests locally back to back. + const rollupJobName = `tsvb-test-rollup-job-${Date.now()}`; + const rollupSourceIndexName = 'rollup-source-data'; + const rollupTargetIndexName = `rollup-target-data`; + const now = new Date(); + const pastDates = [ + datemath.parse('now-1m', { forceNow: now }), + datemath.parse('now-2m', { forceNow: now }), + datemath.parse('now-3m', { forceNow: now }), + ]; + + before(async () => { + // load visualize to have an index pattern ready, otherwise visualize will redirect + await esArchiver.load('visualize/default'); + }); + + it('create rollup tsvb', async () => { + //Create data for rollup job so it doesn't fail + await es.index({ + index: rollupSourceIndexName, + body: { + '@timestamp': new Date().toISOString(), + }, + }); + + await retry.try(async () => { + //Create a rollup for kibana to recognize + await es.transport.request({ + path: `/_rollup/job/${rollupJobName}`, + method: 'PUT', + body: { + index_pattern: rollupSourceIndexName, + rollup_index: rollupTargetIndexName, + cron: '*/10 * * * * ?', + groups: { + date_histogram: { + fixed_interval: '1000ms', + field: '@timestamp', + time_zone: 'UTC', + }, + }, + timeout: '20s', + page_size: 1000, + }, + }); + }); + + await pastDates.map(async day => { + await es.index(mockRolledUpData(rollupJobName, rollupTargetIndexName, day)); + }); + + await PageObjects.visualize.navigateToNewVisualization(); + await PageObjects.visualize.clickVisualBuilder(); + await PageObjects.visualBuilder.checkVisualBuilderIsPresent(); + await PageObjects.timePicker.openQuickSelectTimeMenu(); + await testSubjects.click('superDatePickerCommonlyUsed_Last_24 hours'); + await PageObjects.visualBuilder.clickMetric(); + await PageObjects.visualBuilder.checkMetricTabIsPresent(); + await PageObjects.visualBuilder.clickPanelOptions('metric'); + await PageObjects.visualBuilder.setIndexPatternValue(rollupTargetIndexName); + await PageObjects.visualBuilder.setIntervalValue('1d'); + await PageObjects.visualBuilder.setDropLastBucket(false); + await PageObjects.common.sleep(3000); + const newValue = await PageObjects.visualBuilder.getMetricValue(); + expect(newValue).to.eql('3'); + }); + + after(async () => { + // Delete the rollup job. + await es.transport.request({ + path: `/_rollup/job/${rollupJobName}`, + method: 'DELETE', + }); + + await es.indices.delete({ index: rollupTargetIndexName }); + await es.indices.delete({ index: rollupSourceIndexName }); + await esArchiver.load('empty_kibana'); + }); + }); +}