Skip to content

Commit

Permalink
[data.search] Do not send ignore_throttled when search:includeFrozen …
Browse files Browse the repository at this point in the history
…is disabled (elastic#112755) (elastic#112889)

* Do not send ignore_throttled when search:includeFrozen is disabled

* Fix tests

Co-authored-by: Lukas Olson <[email protected]>
  • Loading branch information
kibanamachine and lukasolson authored Sep 22, 2021
1 parent df80b63 commit 08143c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ describe('EQL search strategy', () => {
expect(request).toEqual(
expect.objectContaining({
ignore_unavailable: true,
ignore_throttled: true,
})
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const getMockSearchSessionsConfig = ({

describe('request utils', () => {
describe('getIgnoreThrottled', () => {
test('returns `ignore_throttled` as `true` when `includeFrozen` is `false`', async () => {
test('does not return `ignore_throttled` when `includeFrozen` is `false`', async () => {
const mockUiSettingsClient = getMockUiSettingsClient({
[UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: false,
});
const result = await getIgnoreThrottled(mockUiSettingsClient);
expect(result.ignore_throttled).toBe(true);
expect(result).not.toHaveProperty('ignore_throttled');
});

test('returns `ignore_throttled` as `false` when `includeFrozen` is `true`', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function getIgnoreThrottled(
uiSettingsClient: IUiSettingsClient
): Promise<Pick<Search, 'ignore_throttled'>> {
const includeFrozen = await uiSettingsClient.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN);
return { ignore_throttled: !includeFrozen };
return includeFrozen ? { ignore_throttled: false } : {};
}

/**
Expand Down

0 comments on commit 08143c7

Please sign in to comment.