我正在尝试使用嵌套查询对查询结果进行重新评分,但出现以下异常,我认为这意味着重新评分不支持嵌套查询:
nested: ElasticsearchIllegalArgumentException[rescore doesn't support [path]];
是这样吗 ?
嵌套对象包含一个应该匹配的关键字段和一个应该用作分数的权重字段。这是查询:
POST myindex/_search
{
"query" : {
"match" : {
"field1" : {
"query" : "my_query_string",
"type" : "boolean"
}
}
},
"rescore" : {
"window_size" : 50,
"query": {
"nested": {
"path": "path.to.nested.object",
"score_mode" : "avg",
"query": {
"function_score": {
"query":{
"constant_score": {
"query": {
"match": {
"path.to.nested.object.key": "my_query_string"
}
}
}
},
"script_score": {
"script": "doc['path.to.nested.object.weight'].value"
}
}
}
}
}
}
}