Skip to content
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

[FEATURE] Sorting support for Hybrid Search #507

Closed
ankitas3 opened this issue Nov 3, 2023 · 4 comments
Closed

[FEATURE] Sorting support for Hybrid Search #507

ankitas3 opened this issue Nov 3, 2023 · 4 comments

Comments

@ankitas3
Copy link

ankitas3 commented Nov 3, 2023

Is your feature request related to a problem?
Hybrid Search always returns results in the descending order of score. Applying sorting as below has no affect on the results

{
  "query": {
    "hybrid":{
      "queries": [
        <text query>,
        <kNN query>
      ]
    }
  }
  "sort": [
    {
      "title.keyword": {
        "order": "desc"
      }
    }
  ]
}

What solution would you like?
Sorting should work as it does with other boolean queries. Results matching the Hybrid query should later be sorted on the basis of sorting applied.

@navneet1v
Copy link
Collaborator

Moving this to neural search repo, as the hybrid query clause is in Neural Search repo.

@navneet1v navneet1v transferred this issue from opensearch-project/k-NN Dec 5, 2023
@vamshin vamshin removed the untriaged label Dec 7, 2023
@vibrantvarun vibrantvarun self-assigned this Feb 23, 2024
@vibrantvarun vibrantvarun moved this from Backlog (Hot) to 2.14.0 in Vector Search RoadMap Apr 1, 2024
@vibrantvarun vibrantvarun moved this from 2.14.0 to 2.15.0 in Vector Search RoadMap Apr 9, 2024
@vibrantvarun
Copy link
Member

Hey @ankitas3 Can you share the use case of this problem? We are doing some brainstorming and we need to understand how sorting fits in your usecase.

@tsilvafsl
Copy link

I am experiencing a problem that might be related.

When performing a hybrid search query with a search_pipeline, the sort tag does not work as expected.

In other words, the sort is being bypassed by search_pipeline and if you remove the search pipeline, the sort works fine in a hybrid query.

In this issue I describe the problem and a reproducible example.
https://forum.opensearch.org/t/unable-to-sort-query-results-with-search-pipeline-hybrid-query/19726

Is it possible to make it work with current opensearch?

@vamshin vamshin changed the title [FEATURE] Results returned from Hybrid Search should respect sorting applied [FEATURE] Sorting support for Hybrid Search Jul 15, 2024
@navneet1v
Copy link
Collaborator

@vibrantvarun can we close this issue as the feature is merged?

@vamshin vamshin closed this as completed Jul 29, 2024
@github-project-automation github-project-automation bot moved this from 2.16.0 to ✅ Done in Vector Search RoadMap Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 2.16 (First RC 07/23, Release 08/06)
Status: Done
Development

No branches or pull requests

5 participants