Skip to content

Commit

Permalink
[Timelion ]Remove usage of ignore_throttled unless targeting frozen i…
Browse files Browse the repository at this point in the history
…ndices to avoid deprecation warning (elastic#118022)

* [Timelion ]Remove usage of ignore_throttled unless targeting frozen indices to avoid deprecation warning

Part of: elastic#117980

* add tests
  • Loading branch information
alexwizp authored and kibanamachine committed Nov 10, 2021
1 parent b9d33ce commit 809a905
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 809a905

Please sign in to comment.