mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[TSVB] Add support for Math Aggregation to tables (#14553)
* Add support for Math Aggregation to tables * Removing the range reduction for dropping the last bucket
This commit is contained in:
parent
79fdf95612
commit
e765e3b967
5 changed files with 25 additions and 7 deletions
|
@ -7,7 +7,7 @@ import { calculateAggRoot } from './calculate_agg_root';
|
|||
export default function dateHistogram(req, panel) {
|
||||
return next => doc => {
|
||||
const { timeField, interval } = getIntervalAndTimefield(panel);
|
||||
const { bucketSize, intervalString } = getBucketSize(req, interval);
|
||||
const { intervalString } = getBucketSize(req, interval);
|
||||
const { from, to } = getTimerange(req);
|
||||
panel.series.forEach(column => {
|
||||
const aggRoot = calculateAggRoot(doc, column);
|
||||
|
@ -17,7 +17,7 @@ export default function dateHistogram(req, panel) {
|
|||
min_doc_count: 0,
|
||||
extended_bounds: {
|
||||
min: from.valueOf(),
|
||||
max: to.valueOf() - (bucketSize * 1000)
|
||||
max: to.valueOf()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import getBucketSize from '../../helpers/get_bucket_size';
|
||||
import getTimerange from '../../helpers/get_timerange';
|
||||
import getIntervalAndTimefield from '../../get_interval_and_timefield';
|
||||
export default function query(req, panel) {
|
||||
return next => doc => {
|
||||
const { timeField, interval } = getIntervalAndTimefield(panel);
|
||||
const { bucketSize } = getBucketSize(req, interval);
|
||||
const { timeField } = getIntervalAndTimefield(panel);
|
||||
const { from, to } = getTimerange(req);
|
||||
|
||||
doc.size = 0;
|
||||
|
@ -18,7 +16,7 @@ export default function query(req, panel) {
|
|||
range: {
|
||||
[timeField]: {
|
||||
gte: from.valueOf(),
|
||||
lte: to.valueOf() - (bucketSize * 1000),
|
||||
lte: to.valueOf(),
|
||||
format: 'epoch_millis',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import { dropLastBucket } from '../series/drop_last_bucket';
|
||||
|
||||
export function dropLastBucketFn(bucket, panel, series) {
|
||||
return next => results => {
|
||||
const fn = dropLastBucket({ aggregations: bucket }, panel, series);
|
||||
return fn(next)(results);
|
||||
};
|
||||
}
|
|
@ -2,11 +2,15 @@
|
|||
import stdMetric from './std_metric';
|
||||
import stdSibling from './std_sibling';
|
||||
import seriesAgg from './series_agg';
|
||||
import { math } from './math';
|
||||
import { dropLastBucketFn } from './drop_last_bucket';
|
||||
|
||||
export default [
|
||||
// percentile,
|
||||
stdMetric,
|
||||
stdSibling,
|
||||
seriesAgg
|
||||
math,
|
||||
seriesAgg,
|
||||
dropLastBucketFn
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import { mathAgg } from '../series/math';
|
||||
|
||||
export function math(bucket, panel, series) {
|
||||
return next => results => {
|
||||
const mathFn = mathAgg({ aggregations: bucket }, panel, series);
|
||||
return mathFn(next)(results);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue