[aggParams/field] support aggParamType#scriptable

This commit is contained in:
spalger 2016-10-17 15:40:04 -07:00
parent 2dbb462bc1
commit 95d704c37c
3 changed files with 6 additions and 2 deletions

View file

@ -16,6 +16,7 @@ export default function SignificantTermsAggDefinition(Private) {
params: [
{
name: 'field',
scriptable: false,
filterFieldTypes: 'string'
},
{

View file

@ -43,7 +43,6 @@ export default function TermsAggDefinition(Private) {
params: [
{
name: 'field',
scriptable: true,
filterFieldTypes: ['number', 'boolean', 'date', 'ip', 'string']
},
{

View file

@ -14,7 +14,7 @@ export default function FieldAggParamFactory(Private, $filter) {
}
FieldAggParam.prototype.editor = editorHtml;
FieldAggParam.prototype.scriptable = false;
FieldAggParam.prototype.scriptable = true;
FieldAggParam.prototype.filterFieldTypes = '*';
/**
@ -36,6 +36,10 @@ export default function FieldAggParamFactory(Private, $filter) {
fields = fields.filter(f => f.aggregatable);
if (!this.scriptable) {
fields = fields.filter(field => !field.scripted);
}
if (this.filterFieldTypes) {
fields = $filter('fieldType')(fields, this.filterFieldTypes);
}