POST: http://localhost:9200/myindex/type/_search
{
"query": {
"function_score": {
"functions": [
{
"gauss": {
"b": {
"origin": "0",
"scale": "1000"
}
}, "weight":"2"
}
],
"query": {
"match": {"b":656}
},
"score_mode": "multiply"
}
}
}
I have 2 fields in my doc a:string and b:number
So I was trying various ways to change scoring pattern.
Requirement: I need to have the score based on only coord and not on tf-idf.
Example: If my query is "location":"bangalore" OR "location":"chennai" OR "location":"mumbai"
So If a record contains all the matches, it should come on top, then a document with less number of matches like that.
So the scoring should respect coord only and not tf-idf. How can i achieve this.
From lucene documentation this is the scoring logic:
score(q,d) = coord(q,d) · queryNorm(q) · ∑( tf(t in d)· idf(t)2 · t.getBoost()· norm(t,d))