mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Don't request field stats more than once for the same index pattern
This commit is contained in:
parent
96af3ea647
commit
9a02e5b349
1 changed files with 7 additions and 1 deletions
|
@ -15,6 +15,8 @@ export default function FetchStrategyForSearch(Private, Promise, timefilter, kbn
|
|||
* @return {Promise} - a promise that is fulfilled by the request body
|
||||
*/
|
||||
reqsFetchParamsToBody: function (reqsFetchParams) {
|
||||
const indexToListMapping = {};
|
||||
|
||||
return Promise.map(reqsFetchParams, function (fetchParams) {
|
||||
return Promise.resolve(fetchParams.index)
|
||||
.then(function (indexList) {
|
||||
|
@ -23,7 +25,11 @@ export default function FetchStrategyForSearch(Private, Promise, timefilter, kbn
|
|||
}
|
||||
|
||||
const timeBounds = timefilter.getBounds();
|
||||
return indexList.toIndexList(timeBounds.min, timeBounds.max);
|
||||
|
||||
if (!indexToListMapping[indexList.id]) {
|
||||
indexToListMapping[indexList.id] = indexList.toIndexList(timeBounds.min, timeBounds.max);
|
||||
}
|
||||
return indexToListMapping[indexList.id];
|
||||
})
|
||||
.then(function (indexList) {
|
||||
let body = fetchParams.body || {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue