在配对中,公式2 *配对数/配对对* 100 例如:santhoshi在具有弹性索引的文档值中,并且santhosh是查询中的searchin元素,然后santhoshi中的对数= 8,匹配的对数= 7,santhosh中的对数= 7 结果= 2 * 7 /(7_8)* 100 = 93%... 我尝试了下面的代码,将.sumDocFreq提交为“类型”:“ illegal_argument_exception,”原因”:“未定义变量[field]。”
{ "query": {
"function_score": {
"query": {
"match": {
"Name":"santhosh"
}
},
"min_score":100,
"functions": [
{
"script_score": {
"script": {
"params" : {
"inputpairlength": 6 },
"source": "double tf = doc.freq; double ttf = field.sumDocFreq; return (2* tf /(params.inputpairlength + ttf)) * 100;"
}
}
}
]
}
}
}
"settings": {
"similarity": {
"scripted_tfidf": {
"type": "scripted",
"script": {
"source": "double tf = doc.freq; double ttf = field.sumDocFreq; return tf / (params.inputpairlength+ttf) * 100;"
}
}
},
getting param.input is not defined
I need to pass parameter and calcluate score using this "double tf = doc.freq; double ttf = field.sumDocFreq; return tf / (params.inputpairlength+ttf) * 100