Merge pull request #4359 from jbudz/issues/3687
Add median aggregation. Closes #3687
This commit is contained in:
commit
c8e16fafdb
|
@ -12,7 +12,7 @@ define(function (require) {
|
|||
group: 'none',
|
||||
name: 'orderAgg',
|
||||
title: 'Order Agg',
|
||||
aggFilter: ['!percentiles', '!std_dev']
|
||||
aggFilter: ['!percentiles', '!median', '!std_dev']
|
||||
}
|
||||
])).all[0];
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ define(function (require) {
|
|||
Private(require('components/agg_types/metrics/count')),
|
||||
Private(require('components/agg_types/metrics/avg')),
|
||||
Private(require('components/agg_types/metrics/sum')),
|
||||
Private(require('components/agg_types/metrics/median')),
|
||||
Private(require('components/agg_types/metrics/min')),
|
||||
Private(require('components/agg_types/metrics/max')),
|
||||
Private(require('components/agg_types/metrics/std_deviation')),
|
||||
|
|
29
src/kibana/components/agg_types/metrics/median.js
Normal file
29
src/kibana/components/agg_types/metrics/median.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
define(function (require) {
|
||||
return function AggTypeMetricMaxProvider(Private) {
|
||||
var _ = require('lodash');
|
||||
var MetricAggType = Private(require('components/agg_types/metrics/_metric_agg_type'));
|
||||
var getResponseAggConfig = Private(require('components/agg_types/metrics/_get_response_agg_config'));
|
||||
var percentiles = Private(require('components/agg_types/metrics/percentiles'));
|
||||
|
||||
return new MetricAggType({
|
||||
name: 'median',
|
||||
dslName: 'percentiles',
|
||||
title: 'Median',
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Median ' + aggConfig.params.field.displayName;
|
||||
},
|
||||
params: [
|
||||
{
|
||||
name: 'field',
|
||||
filterFieldTypes: 'number'
|
||||
},
|
||||
{
|
||||
name: 'percents',
|
||||
default: [50]
|
||||
}
|
||||
],
|
||||
getResponseAggs: percentiles.getResponseAggs,
|
||||
getValue: percentiles.getValue
|
||||
});
|
||||
};
|
||||
});
|
Loading…
Reference in a new issue