neural-search
neural-search copied to clipboard
[FEATURE] Results returned from Hybrid Search should respect sorting applied
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.
Sub issues:
Moving this to neural search repo, as the hybrid query clause is in Neural Search repo.
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.
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?
@vibrantvarun can we close this issue as the feature is merged?