Skip to content

Commit

Permalink
[Reporting] do not pass a deprecated param by default (#120671) (#120848
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tsullivan authored Dec 8, 2021
1 parent eb25004 commit b425b06
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ it('uses the scrollId to page all the data', async () => {

expect(mockDataClient.search).toHaveBeenCalledTimes(1);
expect(mockDataClient.search).toBeCalledWith(
{ params: { ignore_throttled: true, scroll: '30s', size: 500 } },
{ params: { ignore_throttled: undefined, scroll: '30s', size: 500 } },
{ strategy: 'es' }
);

Expand Down Expand Up @@ -814,3 +814,30 @@ describe('formulas', () => {
expect(csvResult.csv_contains_formulas).toBe(true);
});
});

it('can override ignoring frozen indices', async () => {
const originalGet = uiSettingsClient.get;
uiSettingsClient.get = jest.fn().mockImplementation((key): any => {
if (key === 'search:includeFrozen') {
return true;
}
return originalGet(key);
});

const generateCsv = new CsvGenerator(
createMockJob({}),
mockConfig,
{ es: mockEsClient, data: mockDataClient, uiSettings: uiSettingsClient },
{ searchSourceStart: mockSearchSourceService, fieldFormatsRegistry: mockFieldFormatsRegistry },
new CancellationToken(),
logger,
stream
);

await generateCsv.generateData();

expect(mockDataClient.search).toBeCalledWith(
{ params: { ignore_throttled: false, scroll: '30s', size: 500 } },
{ strategy: 'es' }
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class CsvGenerator {
index: index.title,
scroll: scrollSettings.duration,
size: scrollSettings.size,
ignore_throttled: !includeFrozen,
ignore_throttled: includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
},
};

Expand Down

0 comments on commit b425b06

Please sign in to comment.