-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[DOCS] Rewrite dis max query #43586
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 dis max query #43586
Conversation
|
Pinging @elastic/es-search |
|
Pinging @elastic/es-docs |
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.
@jrodewig Thanks! This is indeed a nice restructuring. But we lost the use case for this query. Do we plan to put the use case somewhere else in the documentation?
| clauses. | ||
|
|
||
| If a returned document matches multiple query clauses, the `dis_max` query | ||
| assigns the document the highest relevance score from any matching clause. |
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 think it is important to add here "plus a tie breaking increment for any additional matching subqueries".
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.
Re-added with 6fa3e0c.
| If a document matches multiple clauses, the `dis_max` query calculates the | ||
| relevance score for the document as follows: | ||
|
|
||
| . Take the highest relevance score from a matching clause. |
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 think this is a little bit more clear: "take the score from a matching clause with the highest relevance score"
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.
Added with 6fa3e0c.
|
|
||
| . Take the highest relevance score from a matching clause. | ||
| . Multiply the score from any other matching clauses by the `tie_breaker` value. | ||
| . Add the highest score to the multiplied scores and normalize. |
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.
what is normalize here?
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.
Removed this with 6fa3e0c.
|
Thanks for the review @mayya-sharipova! I may have gotten carried away with edits so I re-added some context for the use case and example with 6fa3e0c. |
| factors. If the query is "albino elephant," this ensures that "albino" matching | ||
| one field and "elephant" matching another gets a higher score than "albino" | ||
| matching both fields. | ||
|
|
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.
@jrodewig Thanks for quickly addressing the feedback.
One small comment, the way information is presented now looks like the query in the example will address what you described before it: " If the query is "albino elephant" this ensures that "albino" matching one field and "elephant" matching another gets a higher score than "albino" matching both fields.". But for this, we need a slightly different query: bool with two should dismax clauses for each field.
May be better, would be to remove this sentence about "albino elephant" all together? WDYT?
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.
@mayya-sharipova Thanks again for your kind review!
I think you're right about removing the sentence. I also updated the example request to fit the use case without introducing a more complex bool query.
mayya-sharipova
left a comment
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.
@jrodewig Thanks for your patience on this.
|
@elasticmachine run elasticsearch-ci/oss-distro-docs |
Rewrites the
dis_maxquery to use the new query format.This is part of #40977, an effort to standardize documentation for query types.
Before
Before image
After
After image