From c36a0b7aa018cd0eee1904d4c17582e93ec524e0 Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Tue, 3 Jul 2018 12:52:41 +0200 Subject: [PATCH] Don't create nested search source per postflightrequest (#20373) --- src/ui/public/agg_types/buckets/terms.js | 3 ++- src/ui/public/vis/request_handlers/courier.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/public/agg_types/buckets/terms.js b/src/ui/public/agg_types/buckets/terms.js index 459adf279f70f..e03a590efc151 100644 --- a/src/ui/public/agg_types/buckets/terms.js +++ b/src/ui/public/agg_types/buckets/terms.js @@ -92,7 +92,8 @@ export const termsBucketAgg = new BucketAggType({ }; }, createFilter: createFilterTerms, - postFlightRequest: async (resp, aggConfigs, aggConfig, nestedSearchSource) => { + postFlightRequest: async (resp, aggConfigs, aggConfig, searchSource) => { + const nestedSearchSource = searchSource.makeChild(); if (aggConfig.params.otherBucket) { const filterAgg = buildOtherBucketAgg(aggConfigs, aggConfig, resp); nestedSearchSource.set('aggs', filterAgg); diff --git a/src/ui/public/vis/request_handlers/courier.js b/src/ui/public/vis/request_handlers/courier.js index 057de01f7008c..812c3e9d3f8a5 100644 --- a/src/ui/public/vis/request_handlers/courier.js +++ b/src/ui/public/vis/request_handlers/courier.js @@ -140,8 +140,7 @@ const CourierRequestHandlerProvider = function () { }).then(async resp => { for (const agg of aggs) { if (_.has(agg, 'type.postFlightRequest')) { - const nestedSearchSource = requestSearchSource.makeChild(); - resp = await agg.type.postFlightRequest(resp, aggs, agg, nestedSearchSource); + resp = await agg.type.postFlightRequest(resp, aggs, agg, requestSearchSource); } }