Skip to content

Conversation

@wdongyu
Copy link

@wdongyu wdongyu commented Jan 28, 2026

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

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link

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.

@wdongyu
Copy link
Author

wdongyu commented Jan 28, 2026

@heemin32 The document pr is here, could you help me with completing it? I am not so familiar with the procedure.

Copy link
Collaborator

@kolchfa-aws kolchfa-aws left a 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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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.

@kolchfa-aws
Copy link
Collaborator

@heemin32 Could you review this PR?

@kolchfa-aws kolchfa-aws added Tech review PR: Tech review in progress backport 3.4 labels Jan 28, 2026
@heemin32
Copy link
Contributor

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>
@wdongyu wdongyu force-pushed the support_min_score_with_hybrid branch from ec25449 to 673f1d7 Compare January 29, 2026 08:33
@wdongyu
Copy link
Author

wdongyu commented Jan 29, 2026

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/?

@heemin32 Done

`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
Copy link
Contributor

@heemin32 heemin32 Jan 29, 2026

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>
Copy link
Contributor

@heemin32 heemin32 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 3.4 Tech review PR: Tech review in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Add min_score in hybrid query

3 participants