Accessing term frequency using function_score query script_score option to compute custom score

Hi,

I am planning to implement custom scoring using function score query. I want the scores to be based on term frequencies in the document. It was possible in earlier versions of elastic search to access the term frequency in the script query using _index field i.e. _index[field][term].tf(). How can we achieve this in latest version of elastic search since _index[field][term].tf() is deprecated now?

How to achive this in latest version on elastic search?
{
"script_score": {
"script": {"inline": "_index[field][term].tf()"}
},
"weight": 100
}

Thanks,
Manasa

You will need to write an elasticsearch plugin to achieve this. See the advanced scripting example in the docs.

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