Skip to content

Commit

Permalink
Add batched_reduce_size
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson committed Jul 30, 2020
1 parent 5ad75a7 commit a9496c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ async function asyncSearch(
const method = request.id ? 'GET' : 'POST';
const path = encodeURI(request.id ? `/_async_search/${request.id}` : `/${index}/_async_search`);

// Wait up to 1s for the response to return
const query = toSnakeCase({ waitForCompletionTimeout: '100ms', keepAlive: '1m', ...queryParams });
// Only report partial results every 64 shards; this should be reduced when we actually display partial results
const batchedReduceSize = request.id ? undefined : 64;

const query = toSnakeCase({
waitForCompletionTimeout: '100ms', // Wait up to 100ms for the response to return
keepAlive: '1m', // Extend the TTL for this search request by one minute
...(batchedReduceSize && { batchedReduceSize }),
...queryParams,
});

const { id, response, is_partial, is_running } = (await caller(
'transport.request',
Expand Down

0 comments on commit a9496c8

Please sign in to comment.