The exact matching result not coming in the top


(Gaurav Kumar) #1

This is the what I am trying with but I am getting Angular Js in the last and Js in the first. I want to give priority to Angular Js then Angular and so on. I also implemented the order.

{
  "sort": [
    {
      "threshold": {
        "order": "desc"
      }
    },
    {
      "last_login": {
        "order": "desc"
      }
    },
    {
      "_score": {
        "order": "desc"
      }
    }
  ],
  "from": 0,
  "track_scores": true,
  "aggs": {},
  "query": {
    "multi_match": {
      "must": [
        {
          "query_string": {
            "use_dis_max": true,
            "fields": [
              "course_name^2",
              "course_type",
              "skills^10"
            ],
            "query": "\"Angular Js\" OR \"Angular\" OR \"Js\""
          }
        }
      ]
    }
  },
  "size": 50
}

Is there any way to achieve the result what I am expecting?


(David Pilato) #2

You can combine different types of search like phrase match, match in a bool query.

I wrote a demo gist about this:


(Mark Harwood) #3

You made relevance score the lowest sort priority. The primary sort order is threshold followed by last_login date.
Notice that sites like google make structured data (dates, image sizes) a range filter (e.g. "last week") and not a sort order so that relevance can remain the primary sort order for search results.


(Gaurav Kumar) #4

Thank you got your point.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.