diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js index 60670f6810fbf..09f6cb11a2c73 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js @@ -69,7 +69,6 @@ describe('dateHistogram(req, panel, series)', () => { field: '@timestamp', interval: '10s', min_doc_count: 0, - time_zone: 'UTC', offset: '-10s', extended_bounds: { min: 1483228800000, @@ -111,7 +110,6 @@ describe('dateHistogram(req, panel, series)', () => { field: '@timestamp', interval: '10s', min_doc_count: 0, - time_zone: 'UTC', offset: '-10s', extended_bounds: { min: 1483225200000, @@ -156,7 +154,6 @@ describe('dateHistogram(req, panel, series)', () => { field: 'timestamp', interval: '20s', min_doc_count: 0, - time_zone: 'UTC', offset: '-20s', extended_bounds: { min: 1483228800000, diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js index a5d86763efc1c..f905bc359b57f 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js @@ -30,7 +30,6 @@ export default function dateHistogram(req, panel, series) { const { timeField, interval } = getIntervalAndTimefield(panel, series); const { bucketSize, intervalString } = getBucketSize(req, interval); const { from, to } = offsetTime(req, series.offset_time, panel); - const { timezone } = req.payload.timerange; const offset = getBucketOffset(from.valueOf(), bucketSize * 1000); const offsetString = `${Math.floor(offset / 1000)}s`; @@ -45,7 +44,6 @@ export default function dateHistogram(req, panel, series) { field: timeField, interval: intervalString, min_doc_count: 0, - time_zone: timezone, offset: offsetString, extended_bounds: { min: boundsMin.valueOf(), diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/date_histogram.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/date_histogram.js index d958425156f6c..6043dd41ecf13 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/date_histogram.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/table/date_histogram.js @@ -24,12 +24,16 @@ import getTimerange from '../../helpers/get_timerange'; import { calculateAggRoot } from './calculate_agg_root'; import { isMetric } from '../../../../../common/metric_types'; import { hasSiblingAggs } from '../../helpers/has_sibling_aggs'; +import { getBucketOffset } from '../../helpers/get_bucket_offset'; export default function dateHistogram(req, panel) { return next => doc => { const { timeField, interval } = getIntervalAndTimefield(panel); const { bucketSize, intervalString } = getBucketSize(req, interval); const { from, to } = getTimerange(req); + const offset = getBucketOffset(from.valueOf(), bucketSize * 1000); + const offsetString = `${Math.floor(offset / 1000)}s`; + panel.series.forEach(column => { const aggRoot = calculateAggRoot(doc, column); if (isMetric(panel.type) && panel.timerange_mode === 'all') { @@ -42,6 +46,7 @@ export default function dateHistogram(req, panel) { field: timeField, interval: intervalString, min_doc_count: 0, + offset: offsetString, extended_bounds: { min: boundsMin.valueOf(), max: to.valueOf() @@ -53,7 +58,8 @@ export default function dateHistogram(req, panel) { from: from.toISOString(), timeField, intervalString, - bucketSize + bucketSize, + offset: offsetString }); }); return next(doc); 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 95191b0650bbc..22dd8569087bc 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 @@ -132,7 +132,6 @@ describe('buildRequestBody(req)', () => { field: '@timestamp', interval: '10s', min_doc_count: 0, - time_zone: 'UTC', offset: '-5s', extended_bounds: { min: 1485463055881,