Skip to content

Conversation

@jimczi
Copy link
Contributor

@jimczi jimczi commented Feb 6, 2020

Backport of #51708

…elastic#51708)

This change ensures that the rewrite of the shard request is executed in the network thread or in the refresh listener when waiting for an active shard. This allows queries that rewrite to match_no_docs to bypass the search thread pool entirely even if the can_match phase was skipped (pre_filter_shard_size > number of shards). Coordinating nodes don't have the ability to create empty responses so this change also ensures that at least one shard creates a full empty response while the other can return null ones. This is needed since creating true empty responses on shards require to create concrete aggregators which would be too costly to build on a network thread. We should move this functionality to aggregation builders in a follow up but that would be a much bigger change.
This change is also important for elastic#49601 since we want to add the ability to use the result of other shards to rewrite the request of subsequent ones. For instance if the first M shards have their top N computed, the top worst document in the global queue can be pass to subsequent shards that can then rewrite to match_no_docs if they can guarantee that they don't have any document better than the provided one.
@jimczi jimczi added :Search/Search Search-related issues that do not fall into other categories backport labels Feb 6, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@jimczi jimczi merged commit 0f333c8 into elastic:7.x Feb 6, 2020
@jimczi jimczi deleted the backport_rewrite_search_pool branch February 6, 2020 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Search/Search Search-related issues that do not fall into other categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants