I want to use the elasticsearch metric for an individual score, and these are my priorities for ranking:
the number of general terms with the request (for example, a document containing 3 of 4 terms in the request should be rated higher than a document that has 2 of 4 terms in the request, regardless of how many tf / idf points of each member). in elastic documentation it is called the coordination factor .
sum of the relevance of the terms. (TC / IDF)
document popularity (number of votes for each document, as described in increasing popularity )
This is the request body for using elasticsearch currently in use:
body = {
"query": {
"function_score": {
"query": {
{'match': {'text': query}}
},
"functions": [
{
"field_value_factor": {
"field": "ducoumnet_popularity",
}
}
],
}
}
}
The problem is that this request is not satisfied with the first priority. for example, there may be document A, which has less general terms with the query than document B, but since its general terms have more tf / idf, document A is higher than level B.
To prevent this, I believe that the best way is to increase the number of documents by a coordinating coefficient. Is there any way to do this? something similar to this query:
body = {
"query": {
"function_score": {
"query": {
{'match': {'text': query}}
},
"functions": [
{
"field_value_factor": {
"field": "ducoumnet_popularity",
},
"field_value_factor": {
"field": "_coordination"
"weight": 10
}
}
],
}
}
}
source
share