Commit b24c5392 by Torkel Ödegaard

feat(elasticsearch): began work on supporting extended stats metric agg, it…

feat(elasticsearch): began work on supporting extended stats metric agg, it gives you standard deviation and more
parent 52eeefa6
......@@ -213,6 +213,15 @@ function (angular, _, config, kbn, moment, ElasticQueryBuilder) {
}
break;
}
case 'extended_stats': {
var stats = bucket[metric.id];
for (var statIndex in metric.stats) {
var statName = metric.stats[statIndex];
addMetricPoint(seriesName + ' ' + statName, stats[statName], bucket.key)
}
break;
}
default: {
seriesName += ' ' + metric.field + ' ' + metric.type;
value = bucket[metric.id].value;
......
......@@ -20,22 +20,29 @@ function (angular, _, queryDef) {
$rootScope.onAppEvent('elastic-query-updated', function() {
$scope.index = _.indexOf(metricAggs, $scope.agg);
$scope.isFirst = $scope.index === 0;
$scope.isSingle = metricAggs.length === 1;
$scope.validateModel();
});
$scope.validateModel = function() {
$scope.isFirst = $scope.index === 0;
$scope.isSingle = metricAggs.length === 1;
$scope.settingsLinkText = '';
if (!$scope.agg.field) {
$scope.agg.field = 'select field';
}
if ($scope.agg.type === 'percentiles') {
switch($scope.agg.type) {
case 'percentiles': {
$scope.agg.settings.percents = $scope.agg.settings.percents || [25,50,75,95,99];
$scope.settingsLinkText = 'values: ' + $scope.agg.settings.percents.join(',');
break;
}
case 'extended_stats': {
$scope.agg.stats = $scope.agg.stats || ['std_deviation'];
$scope.settingsLinkText = 'stats: ' + $scope.agg.stats.join(',');
}
}
}
......@@ -57,6 +64,7 @@ function (angular, _, queryDef) {
}, 0);
metricAggs.splice(addIndex, 0, {type: "count", field: "select field", id: (id+1).toString()});
$scope.onChange();
};
$scope.removeMetricAgg = function() {
......
......@@ -11,7 +11,7 @@ function (_) {
{text: "Sum of", value: 'sum' },
{text: "Max of", value: 'max' },
{text: "Min of", value: 'min' },
{text: "Standard Deviations", value: 'std_dev' },
{text: "Extended Stats", value: 'extended_stats' },
{text: "Percentiles", value: 'percentiles' },
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment