Commit cf9790fc by lpic Committed by Torkel Ödegaard

ES - Support for min_doc_count on group by terms (#7324)

parent a0c8380b
......@@ -82,12 +82,17 @@ function (angular, _, queryDef) {
case 'terms': {
settings.order = settings.order || "asc";
settings.size = settings.size || "10";
settings.min_doc_count = settings.min_doc_count || 0;
settings.orderBy = settings.orderBy || "_term";
if (settings.size !== '0') {
settingsLinkText = queryDef.describeOrder(settings.order) + ' ' + settings.size + ', ';
}
if (settings.min_doc_count > 0) {
settingsLinkText += 'Min Doc Count: ' + settings.min_doc_count + ', ';
}
settingsLinkText += 'Order by: ' + queryDef.describeOrderBy(settings.orderBy, $scope.target);
if (settings.size === '0') {
......
......@@ -62,6 +62,10 @@
<metric-segment-model property="agg.settings.size" options="sizeOptions" on-change="onChangeInternal()" css-class="width-12"></metric-segment-model>
</div>
<div class="gf-form offset-width-7">
<label class="gf-form-label width-10">Min Doc Count</label>
<input type="number" class="gf-form-input max-width-12" ng-model="agg.settings.min_doc_count" ng-blur="onChangeInternal()">
</div>
<div class="gf-form offset-width-7">
<label class="gf-form-label width-10">Order By</label>
<metric-segment-model property="agg.settings.orderBy" options="orderByOptions" on-change="onChangeInternal()" css-class="width-12"></metric-segment-model>
</div>
......
......@@ -49,6 +49,10 @@ function (queryDef) {
}
}
if (aggDef.settings.min_doc_count !== void 0) {
queryNode.terms.min_doc_count = parseInt(aggDef.settings.min_doc_count, 10);
}
if (aggDef.settings.missing) {
queryNode.terms.missing = aggDef.settings.missing;
}
......
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