0

I am using hybrid search in Elastic search. Below is an example from ES docs. So what I found in hybrid results term-based results come at the top, and I wanted to know how the scoring works in each type. For example

  • do team-based results get scores from 0- 20?
  • do semantic search results get scores from 0- 10?
  • what is the maximum ranking score of each method? So that I can scale and give more weight to semantic search in a way that semantic search results come in top.
  • Or I should not do this at all. What is the best practice?
POST image-index/_search
{
  "query": {
    "match": {
      "title": {
        "query": "mountain lake",
      }
    }
  },
  "knn": {
    "field": "image-vector",
    "query_vector": [54, 10, -2],
    "k": 5,
    "num_candidates": 50,
  },
  "size": 10
}

Sazzad
  • 773
  • 11
  • 22
  • Why not simply using the boost factors as shown on the documentation that you referenced? – Val May 16 '23 at 10:48
  • Yes, I can. I am curious to know the scaling method of term-based and semantic search. If two scales differ, we can not get what we want from Boost, right? Or to be precise, We will not be sure how much we should boost. Please correct me if I am wrong here – Sazzad May 16 '23 at 12:04
  • 1
    Well, both scales are open scales. Depending on which similarity you picked for your `dense_vector` fields, the [scoring formula](https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html#dense-vector-similarity) will be different. For normal text matching, the similarity used is [BM25](https://www.elastic.co/guide/en/elasticsearch/reference/current/similarity.html) – Val May 16 '23 at 12:23
  • Unfortunately, I still do not understand. If both are open scales, how ES sorts hybrid search results? so far, I see term-based one can give a score of 29.03 for the top one, and semantic gives 7.82 for the top result. So the semantic one will never get a higher ranking in the hybrid search unless I implement an arbitrary boosting. – Sazzad May 16 '23 at 15:28

0 Answers0