Skip to content

Don't always rewrite the Lucene query in search phases#79358

Merged
jimczi merged 2 commits intoelastic:masterfrom
jimczi:lucene_query_search_rewrite
Oct 18, 2021
Merged

Don't always rewrite the Lucene query in search phases#79358
jimczi merged 2 commits intoelastic:masterfrom
jimczi:lucene_query_search_rewrite

Conversation

@jimczi
Copy link
Copy Markdown
Contributor

@jimczi jimczi commented Oct 18, 2021

Today the Lucene query is rewritten eagerly in the dfs, query and fetch search phases.
While this is needed in dfs and search, most of the fetch phases could avoid this cost.
This change adds an explicit accessor for SearchContext that rewrites the original query
once and returns its rewritten form. That allows to rewrite the Lucene query only when
it's required.

Today the Lucene query is rewritten eagerly in the dfs, query and fetch search phases.
While this is needed in dfs and search, most of the fetch phases could avoid this cost.
This change adds an explicit accessor for SearchContext that rewrites the original query
once and returns its rewritten form. That allows to rewrite the Lucene query only when
it's required.
@jimczi jimczi added >enhancement :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.16.0 labels Oct 18, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Oct 18, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I left a couple of suggestions.

Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jimczi jimczi merged commit 060976a into elastic:master Oct 18, 2021
@jimczi jimczi deleted the lucene_query_search_rewrite branch October 18, 2021 14:45
jimczi added a commit that referenced this pull request Oct 18, 2021
Today the Lucene query is rewritten eagerly in the dfs, query and fetch search phases.
While this is needed in dfs and search, most of the fetch phases could avoid this cost.
This change adds an explicit accessor for SearchContext that rewrites the original query
once and returns its rewritten form. That allows to rewrite the Lucene query only when
it's required.
@jtibshirani jtibshirani mentioned this pull request Oct 27, 2021
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.16.0 v8.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants