[DOCS] Rewrite 'rewrite' parameter docs#42018
[DOCS] Rewrite 'rewrite' parameter docs#42018jrodewig merged 2 commits intoelastic:masterfrom jrodewig:multi-term-query-rewrite
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.
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.
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.
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.
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.
I don't think constant_score uses scoring_boolean
mayya-sharipova
left a comment
There was a problem hiding this comment.
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.
Please confirm that this constant_score definition is accurate.
mayya-sharipova
left a comment
There was a problem hiding this comment.
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