Disable missing terms for non string fields (#17455)
* Disable missing terms for non string fields * Disable setting instead of hiding them
This commit is contained in:
parent
622d3f333b
commit
3a30d0bf76
|
@ -152,6 +152,12 @@ export function AggTypesBucketsTermsProvider(Private) {
|
|||
return aggFilter.includes(`!${agg.type.name}`);
|
||||
};
|
||||
|
||||
$scope.$watch('agg.params.field.type', (type) => {
|
||||
if (type !== 'string') {
|
||||
$scope.agg.params.missingBucket = false;
|
||||
}
|
||||
});
|
||||
|
||||
function updateOrderAgg() {
|
||||
// abort until we get the responseValueAggs
|
||||
if (!$scope.responseValueAggs) return;
|
||||
|
@ -201,7 +207,7 @@ export function AggTypesBucketsTermsProvider(Private) {
|
|||
output.params.valueType = agg.getField().type === 'number' ? 'float' : agg.getField().type;
|
||||
}
|
||||
|
||||
if (agg.params.missingBucket) {
|
||||
if (agg.params.missingBucket && agg.params.field.type === 'string') {
|
||||
output.params.missing = '__missing__';
|
||||
}
|
||||
|
||||
|
|
|
@ -63,11 +63,12 @@
|
|||
class="kuiCheckBox"
|
||||
name="showMissing"
|
||||
ng-model="agg.params.missingBucket"
|
||||
ng-disabled="agg.params.field.type !== 'string'"
|
||||
>
|
||||
Show missing values
|
||||
<icon-tip
|
||||
position="'right'"
|
||||
content="'When enabled, include documents with missing values in the search. If this bucket is in the top N, it appears in the chart. If not in the top N, and you enable \'Group other values in separate bucket\', Elasticsearch adds the missing values to the \'other\' bucket.'"
|
||||
content="'Only works for fields of type \'string\'. When enabled, include documents with missing values in the search. If this bucket is in the top N, it appears in the chart. If not in the top N, and you enable \'Group other values in separate bucket\', Elasticsearch adds the missing values to the \'other\' bucket.'"
|
||||
></icon-tip>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -82,6 +83,7 @@
|
|||
type="text"
|
||||
ng-model="agg.params.missingBucketLabel"
|
||||
class="form-control kuiSideBarInput"
|
||||
ng-disabled="agg.params.field.type !== 'string'"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue