-
Notifications
You must be signed in to change notification settings - Fork 640
add min_score usage with sort #11811
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
base: main
Are you sure you want to change the base?
add min_score usage with sort #11811
Conversation
|
Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged. Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer. When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review. |
|
@heemin32 The document pr is here, could you help me with completing it? I am not so familiar with the procedure. |
kolchfa-aws
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.
Thank you, @wdongyu! One rewording suggestion.
| By default, hybrid search returns results ordered by scores in descending order. You can apply sorting to hybrid query results by providing the `sort` criteria in the search request. For more information about sort criteria, see [Sort results]({{site.url}}{{site.baseurl}}/search-plugins/searching-data/sort/). | ||
| When sorting is applied to a hybrid search, results are fetched from the shards based on the specified sort criteria. As a result, the search results are sorted accordingly, and the document scores are `null`. Scores are only present in the hybrid search sorting results if documents are sorted by `_score`. | ||
|
|
||
| The `min_score` parameter can only use to filter out hybrid search results if documents are sorted by `_score` or no sorting criteria, otherwise search will throw an exception. |
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.
| The `min_score` parameter can only use to filter out hybrid search results if documents are sorted by `_score` or no sorting criteria, otherwise search will throw an exception. | |
| You can use the `min_score` parameter to filter hybrid search results only if documents are sorted by `_score` or if no sorting is applied. Using any other sorting criteria causes the search to fail. |
|
@heemin32 Could you review this PR? |
|
Can we mention the different behavior of min_score in hybrid query before and after 3.5 in https://docs.opensearch.org/latest/query-dsl/compound/hybrid/? |
Signed-off-by: wangdongyu.danny <wangdongyu.danny@bytedance.com>
Signed-off-by: wangdongyu.danny <wangdongyu.danny@bytedance.com>
ec25449 to
673f1d7
Compare
@heemin32 Done |
_query-dsl/compound/hybrid.md
Outdated
| `queries` | An array of one or more query clauses that are used to match documents. A document must match at least one query clause in order to be returned in the results. The documents' relevance scores from all query clauses are combined into one score by applying a [search pipeline]({{site.url}}{{site.baseurl}}/search-plugins/search-pipelines/index/). The maximum number of query clauses is 5. Required. | ||
| `filter` | A filter to apply to all the subqueries of the hybrid query. | ||
|
|
||
| ### Behavior with min_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.
Talked with @martin-gaievski. It would be better not to talk about behavior before 3.5 because it was not a correct behavior and we are fixing it in 3.5.
min_score Support for Hybrid Queries
From version 3.5 onward, the min_score parameter is applied after score normalization and combination. It can be used only when sorting by _score or when no sorting is specified; using it with any other sorting criteria will result in an exception.
Signed-off-by: wangdongyu.danny <wangdongyu.danny@bytedance.com>
heemin32
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.
LGTM. Thanks!
Description
apply min_score in hybrid query
Issues Resolved
Closes #11810
Version
all
Frontend features
If you're submitting documentation for an OpenSearch Dashboards feature, add a video that shows how a user will interact with the UI step by step. A voiceover is optional.
Checklist
For more information on following Developer Certificate of Origin and signing off your commits, please check here.