mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
fix agg name in test, throw exception when aggrigations are defined but the key can't be found
This commit is contained in:
parent
5c3ca1cc08
commit
a30249c08c
2 changed files with 4 additions and 2 deletions
|
@ -304,6 +304,8 @@ define(function (require) {
|
|||
return key.substr(0, 4) === 'agg_';
|
||||
});
|
||||
|
||||
if (!aggKey) throw new Error('aggKey not found in response: ' + Object.keys(resp.aggregations));
|
||||
|
||||
// start merging aggregations
|
||||
if (!requestStats.aggregations) {
|
||||
requestStats.aggregations = {};
|
||||
|
|
|
@ -171,7 +171,7 @@ define(function (require) {
|
|||
max_score: score
|
||||
},
|
||||
aggregations: {
|
||||
'_agg_test': {
|
||||
'agg_test': {
|
||||
buckets: [{
|
||||
doc_count: hits.length,
|
||||
key: aggKey
|
||||
|
@ -213,7 +213,7 @@ define(function (require) {
|
|||
function eachHandler(resp, req) {
|
||||
// check results from mergeRequestStats
|
||||
expect(segmentedFetch.requestStats).to.have.property('aggregations');
|
||||
expect(segmentedFetch.requestStats.aggregations['_agg_test'].buckets.length).to.be(aggregationKeys.length);
|
||||
expect(segmentedFetch.requestStats.aggregations['agg_test'].buckets.length).to.be(aggregationKeys.length);
|
||||
expect(segmentedFetch.requestStats.took).to.be(totalTime);
|
||||
expect(segmentedFetch.requestStats.hits.hits.length).to.be(totalHits);
|
||||
expect(segmentedFetch.requestStats.hits.total).to.be(maxHits);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue