diff --git a/src/plugins/vis_types/timelion/server/series_functions/es/es.test.js b/src/plugins/vis_types/timelion/server/series_functions/es/es.test.js index f55ee31f39799..9c0dac6f6975a 100644 --- a/src/plugins/vis_types/timelion/server/series_functions/es/es.test.js +++ b/src/plugins/vis_types/timelion/server/series_functions/es/es.test.js @@ -256,12 +256,20 @@ describe('es', () => { sandbox.restore(); }); - test('sets ignore_throttled=true on the request', () => { + test('sets ignore_throttled=false on the request', () => { + config.index = 'beer'; + tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN] = true; + const request = fn(config, tlConfig, emptyScriptFields); + + expect(request.params.ignore_throttled).toEqual(false); + }); + + test('sets no ignore_throttled if SEARCH_INCLUDE_FROZEN is false', () => { config.index = 'beer'; tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN] = false; const request = fn(config, tlConfig, emptyScriptFields); - expect(request.params.ignore_throttled).toEqual(true); + expect(request.params).not.toHaveProperty('ignore_throttled'); }); test('sets no timeout if elasticsearch.shardTimeout is set to 0', () => { diff --git a/src/plugins/vis_types/timelion/server/series_functions/es/lib/build_request.js b/src/plugins/vis_types/timelion/server/series_functions/es/lib/build_request.js index 20e3f71801854..99b5d0bacd858 100644 --- a/src/plugins/vis_types/timelion/server/series_functions/es/lib/build_request.js +++ b/src/plugins/vis_types/timelion/server/series_functions/es/lib/build_request.js @@ -66,9 +66,10 @@ export default function buildRequest(config, tlConfig, scriptFields, runtimeFiel _.assign(aggCursor, createDateAgg(config, tlConfig, scriptFields)); + const includeFrozen = Boolean(tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN]); const request = { index: config.index, - ignore_throttled: !tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN], + ...(includeFrozen ? { ignore_throttled: false } : {}), body: { query: { bool: bool,