Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.7] Fix csv generation when search:includeFrozen is enabled (#152354) #152901

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -819,11 +819,20 @@ it('can override ignoring frozen indices', async () => {

await generateCsv.generateData();

expect(mockEsClient.asCurrentUser.openPointInTime).toHaveBeenCalledWith(
{
ignore_unavailable: true,
ignore_throttled: false,
index: 'logstash-*',
keep_alive: '30s',
},
{ maxRetries: 0, requestTimeout: '30s' }
);

expect(mockDataClient.search).toBeCalledWith(
{
params: {
body: {},
ignore_throttled: false,
},
},
{ strategy: 'es', transport: { maxRetries: 0, requestTimeout: '30s' } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export class CsvGenerator {
index: indexPatternTitle,
keep_alive: duration,
ignore_unavailable: true,
// TODO: currently this doesn't do anything as es has a bug that throttled indices are always included when using PIT api
// if es fixes the issue, everything should work as expected. Just needs to be tested and this comment removed
// if es decides to not fix, then we can close the issue and remove the `ignore_throttled` code from here
// https://github.com/elastic/kibana/issues/152884
// @ts-expect-error ignore_throttled is not in the type definition, but it is accepted by es
ignore_throttled: settings.includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
},
{
requestTimeout: duration,
Expand All @@ -91,7 +97,7 @@ export class CsvGenerator {
settings: CsvExportSettings,
searchAfter?: estypes.SortResults
) {
const { scroll: scrollSettings, includeFrozen } = settings;
const { scroll: scrollSettings } = settings;
searchSource.setField('size', scrollSettings.size);

if (searchAfter) {
Expand All @@ -112,7 +118,6 @@ export class CsvGenerator {
const searchParams = {
params: {
body: searchBody,
ignore_throttled: includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
},
};

Expand Down