Commit 8ad10149 by Carl Bergquist

adds basic support for moving avg in es queries

parent 07310643
......@@ -78,6 +78,23 @@ function (angular, _, queryDef) {
return $scope.getFields({$fieldType: 'number'});
};
$scope.getMetrics = function() {
console.log($scope.target.metrics);
var mets = _.filter($scope.target.metrics, function(x) {
return x.type !== 'moving_avg';
});
mets = _.map(mets, function(m) {
return { text: m.type, type: m.id };
});
console.log(mets);
return $q.when(mets)
.then(uiSegmentSrv.transformToSegments(false));
};
$scope.addMetricAgg = function() {
var addIndex = metricAggs.length;
......
......@@ -7,7 +7,10 @@
<metric-segment-model property="agg.type" options="metricAggTypes" on-change="onTypeChange()" custom="false" css-class="tight-form-item-large"></metric-segment-model>
</li>
<li ng-if="aggDef.requiresField">
<metric-segment-model property="agg.field" get-options="getFieldsInternal()" on-change="onChange()" css-class="tight-form-item-xxlarge"></metric-segment>
<metric-segment-model property="agg.field" get-options="getFieldsInternal()" on-change="onChange()" css-class="tight-form-item-xxlarge"></metric-segment-model>
</li>
<li ng-if="aggDef.requiresBucketsPath">
<metric-segment-model property="agg.field" get-options="getMetrics()" on-change="onChange()" css-class="tight-form-item-xxlarge"></metric-segment-model>
</li>
<li class="tight-form-item last" ng-if="settingsLinkText">
<a ng-click="toggleOptions()">{{settingsLinkText}}</a>
......
......@@ -13,6 +13,7 @@ function (_) {
{text: "Min", value: 'min', requiresField: true},
{text: "Extended Stats", value: 'extended_stats', requiresField: true},
{text: "Percentiles", value: 'percentiles', requiresField: true},
{text: "Moving Avg", value: 'moving_avg', requiresField: false, requiresBucketsPath: true},
{text: "Unique Count", value: "cardinality", requiresField: true},
{text: "Raw Document", value: "raw_document", requiresField: false}
],
......
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