Query rewrite refactoring #96280
Labels
>refactoring
:Search/Search
Search-related issues that do not fall into other categories
Team:Search
Meta label for search team
v8.9.0
Description
This refactoring is a prerequisite for #96161. The idea is to cleanup the code in order to make sure we have a better structure around the way we use
QueryRewriteContext
andSearchExecutionContext
. Both of them are used by the rewrite logic to simplify queries and improve query execution latency and resource usage.We would like to enable the following three scenarios:
QueryRewriteContext
and a few more information but not requiring aSearchExecutionContext
. This is the case for rewrite operations which happen entirely on the coordinator node and spare us from executing the query on the data node.QueryRewriteContext
and some information available in theSearchExecutionContext
. In some scenarios anIndexSearcher
is not required. Not using it saves us a few unnecessary IO operations and allows us to complete query execution before we even need to read the index.QueryRewriteContext
and the fullSearchExecutionContext
. In this scenario anIndexSearcher
is required for the rewrite logic to be fully exploited.For this reason we will refactor the
SearchExecutionContext
pulling up into theQueryRewriteContext
a few fields/methods (likegetFieldType
andgetIndexSettings
). Moreover, we will need to revisit the implementation ofdoRewrite
for subclasses ofAbstractQueryBuilder
in such a way to enable the three rewrite logic branches described above.The text was updated successfully, but these errors were encountered: