Keyword Search Scoring

(Choo Kar Chun) #1

Hello! Is there any way to get the relevancy score for keyword/partial searches?

This is my mapping code:

URL: /vacancy
{
"mappings": {
"properties": {
"vacancy_join": {
"type": "join",
"relations": {
"employer": "vacancy"
}
},
"location": {
"type": "geo_point"
},
"posted_date": {
"type": "date"
}
}
}
}

This is my data entry using PUT method:

/vacancy/_doc/1?routing=1
{
"occupation_title":"Tech Support",
"skills":["Information Technology"],
"unit_group_code":"2519",
"min_salary": 3000,
"max_salary": 4500,
"location_name":"location ABC",
"location":"3.0587,101.6917",
"occupation_type":"full_time",
"posted_date": "1556264385124",
"vacancy_join":{"name":"vacancy","parent":1}
}

For example, in scenario where the "occupation_title" is "Tech Support", if I type "Tec", it should display "Tech Support" result with a lower score.

But if I type "Tech Sup", it should display the same result but with higher score.

I've look into wildcard query doc here: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html

But it seems to be giving me a constant score of 1, regardless of how many characters I typed, which is not what I wanted.

Is there any way to achieve this? Appreciate if you guys can advise.

(Choo Kar Chun) #2

Btw, I'm using Elasticsearch 7.0