I am trying to change the _score of documents by normalizing all returned doc['relevancy'].value
fields by the max doc['relevancy'].value
of the result set. I also would like to multiple this result by the Max Elastic Search score found in hits.total.value
.
Is this type of calculation possible? I can't seem to find something like it in the documentation.
curl -X GET "localhost:9200/products/_search?pretty&size=20" -H 'Content-Type: application/json' -d'
{
"query": {
"function_score": {
"query": {
"multi_match" : {
"query": "KQ2",
"fields": [ "item_id", "item_desc" ]
}
},
"script_score" : {
"script": "(doc[\u0027relevancy\u0027].value / max_of_relevancy_field) * _max_score"
},
"boost_mode": "replace"
}
}
}
'