fix pipeline aggregations on doc count

This commit is contained in:
Marcus Efraimsson
2018-11-15 19:06:47 +01:00
parent cbd4125e69
commit 9a8ad70013
6 changed files with 145 additions and 5 deletions

View File

@@ -266,7 +266,14 @@ export class ElasticQueryBuilder {
if (queryDef.isPipelineAgg(metric.type)) {
if (metric.pipelineAgg && /^\d*$/.test(metric.pipelineAgg)) {
metricAgg = { buckets_path: metric.pipelineAgg };
const appliedAgg = queryDef.findMetricById(target.metrics, metric.pipelineAgg);
if (appliedAgg) {
if (appliedAgg.type === 'count') {
metricAgg = { buckets_path: '_count' };
} else {
metricAgg = { buckets_path: metric.pipelineAgg };
}
}
} else {
continue;
}