opensearch-project / neural-search

Plugin that adds dense neural retrieval into the OpenSearch ecosytem
Apache License 2.0
57 stars 58 forks source link

Enable Multi Field Sorting in Hybrid Search #742

Open vibrantvarun opened 1 month ago

vibrantvarun commented 1 month ago

While executing Hybrid search enable multi field sort to apply on the results.

{
    "query": {
         "hybrid": {
             "queries": [
                           {
                                 "match": {
                                     "passage_text": "goodies"
                                 }
                            },
                            {
                                     "term": {
                                         "passage_text": {
                                             "value": "containers"
                                        }
                                     }
                             },
                             {
                                 "range": {
                                   "stock": {
                                           "gte": 40,
                                          "lte": 60
                                     }
                                 }
                             }
                         ]
                    }
           }
    },
    "sort": [
        {
            "stock": {
                "order": "asc"
            }
        },
        {
            "imdb":{
               "order":"asc"
            }
        }
    ],
    "track_scores": true
}