[data.search] Do not send ignore_throttled when search:includeFrozen is disabled (#112755)

* Do not send ignore_throttled when search:includeFrozen is disabled

* Fix tests
This commit is contained in:
Lukas Olson 2021-09-22 13:36:17 -07:00 committed by GitHub
parent 1b93b00212
commit 791fed5b82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View file

@ -132,7 +132,6 @@ describe('EQL search strategy', () => {
expect(request).toEqual(
expect.objectContaining({
ignore_unavailable: true,
ignore_throttled: true,
})
);
});

View file

@ -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 () => {

View file

@ -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 } : {};
}
/**