-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOCS] Rewrite 'rewrite' parameter docs #42018
Conversation
Pinging @elastic/es-search |
WARNING: This parameter is for expert users only. Changing the value of this | ||
parameter can impact search performance and relevance. | ||
|
||
To improve performance, {es} rewrites the following queries: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if rewrite
happens to improve performance. I think it happens just to break up complex queries into term based queries that Lucene can execute
|
||
* <<query-dsl-prefix-query, `prefix`>> | ||
* <<query-dsl-query-string-query, `query_string`>> | ||
* <<query-dsl-wildcard-query, `wildcard`>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other queries as well that get rewritten. For example, regexp
, fuzzy
, prefix
can also be rewritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mayya-sharipova. I added these queries with 50505e6.
In their original form, these queries are expensive. {es} changes the | ||
original query to a less expensive <<query-dsl-bool-query, `bool` query>>. This | ||
`bool` query contains a `should` clause and <<query-dsl-term-query, `term` | ||
query>> for each matching term. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this is always the case, but may be @jimczi can confirm here. As I understood it, sometimes for constant_score
instead of a boolean query, we just use a document bit set. And the rewrite is done by Lucene, not ES
=== Valid values | ||
|
||
`constant_score` (Default):: | ||
Automatically uses the `constant_score_boolean` or `scoring_boolean` method, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think constant_score
uses scoring_boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jrodewig. Very nice work, we just to need to clarify several items.
Thanks so much for your thorough feedback, @mayya-sharipova! I made several changes you suggested with 50505e6:
Please let me know if you see any other needed changes. |
`constant_score` (Default):: | ||
Uses the `constant_score_boolean` method for fewer matching terms. Otherwise, | ||
this method finds all matching terms in sequence and returns matching documents | ||
using a bit set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please confirm that this constant_score
definition is accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jrodewig. The final version looks good to me!
Changes
This is part of #40977, an effort to standardize documentation for query types.
Any and all feedback welcome!
Before
Before image
After
After image