[data.search] Send ccs_minimize_roundtrips=true for async search requests (#159848)

## Summary

Resolves https://github.com/elastic/kibana/issues/159706. Sends
`ccs_minimize_roundtrips=true` for async search requests to decrease
network delays when cross-cluster search is at play.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Lukas Olson 2023-06-20 15:42:54 -07:00 committed by GitHub
parent a4d5209a9f
commit 69849ee03b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -111,6 +111,19 @@ describe('request utils', () => {
});
expect(params).toHaveProperty('keep_on_completion', false);
});
test('Sets `batched_reduce_size` and `ccs_minimize_roundtrips`', async () => {
const mockUiSettingsClient = getMockUiSettingsClient({
[UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: false,
});
const batchedReduceSize = Math.floor(Math.random() * 64);
const mockConfig = getMockSearchConfig({
asyncSearch: { batchedReduceSize },
});
const params = await getDefaultAsyncSubmitParams(mockUiSettingsClient, mockConfig, {});
expect(params).toHaveProperty('batched_reduce_size', batchedReduceSize);
expect(params).toHaveProperty('ccs_minimize_roundtrips', true);
});
});
describe('getDefaultAsyncGetParams', () => {

View file

@ -38,6 +38,7 @@ export async function getDefaultAsyncSubmitParams(
Pick<
AsyncSearchSubmitRequest,
| 'batched_reduce_size'
| 'ccs_minimize_roundtrips'
| 'keep_alive'
| 'wait_for_completion_timeout'
| 'ignore_throttled'
@ -50,6 +51,8 @@ export async function getDefaultAsyncSubmitParams(
return {
// TODO: adjust for partial results
batched_reduce_size: searchConfig.asyncSearch.batchedReduceSize,
// Decreases delays due to network when using CCS
ccs_minimize_roundtrips: true,
...getCommonDefaultAsyncSubmitParams(searchConfig, options),
...(await getIgnoreThrottled(uiSettingsClient)),
...(await getDefaultSearchParams(uiSettingsClient)),