mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Merge pull request #4751 from lukasolson/issues/4696
Fix issue with mislabeled scripted field filters from histogram
This commit is contained in:
commit
6cb7fec4e1
4 changed files with 29 additions and 7 deletions
|
@ -38,8 +38,7 @@ describe('AggConfig Filters', function () {
|
|||
expect(filter.range).to.have.property('bytes');
|
||||
expect(filter.range.bytes).to.have.property('gte', 2048);
|
||||
expect(filter.range.bytes).to.have.property('lt', 3072);
|
||||
|
||||
expect(filter.meta).to.have.property('formattedValue', '2,048');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,7 +41,7 @@ describe('AggConfig Filters', function () {
|
|||
expect(filter.range).to.have.property('bytes');
|
||||
expect(filter.range.bytes).to.have.property('gte', 1024.0);
|
||||
expect(filter.range.bytes).to.have.property('lt', 2048.0);
|
||||
expect(filter.meta).to.have.property('formattedValue', '1,024 to 2,048');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,10 +5,12 @@ define(function (require) {
|
|||
return function (aggConfig, key) {
|
||||
var value = parseInt(key, 10);
|
||||
|
||||
return buildRangeFilter(aggConfig.params.field, {
|
||||
gte: value,
|
||||
lt: value + aggConfig.params.interval
|
||||
}, aggConfig.vis.indexPattern);
|
||||
return buildRangeFilter(
|
||||
aggConfig.params.field,
|
||||
{gte: value, lt: value + aggConfig.params.interval},
|
||||
aggConfig.vis.indexPattern,
|
||||
aggConfig.fieldFormatter()(key)
|
||||
);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -42,5 +42,26 @@ describe('Filter Bar Directive', function () {
|
|||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return a value for a range/histogram filter from a scripted field', (done) => {
|
||||
let filter = {
|
||||
meta: {
|
||||
index: 'logstash-*',
|
||||
formattedValue: '1,000.00 to 2,000.00',
|
||||
field: 'script number'
|
||||
},
|
||||
script: {
|
||||
params: {
|
||||
gte: 1000,
|
||||
lt: 2000,
|
||||
value: '>=1,000.00 <2,000.00'
|
||||
}
|
||||
}
|
||||
};
|
||||
mapScript(filter).then((result) => {
|
||||
expect(result).to.have.property('value', filter.meta.formattedValue);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue