我目前正在尝试在NEST中实现“ function_score”查询,仅在过滤器匹配时才应用这些函数。
看起来FunctionScoreFunctionsDescriptor尚不支持添加过滤器。是否会在不久的将来添加此功能?
这是我想要实现的超基本示例:
使用基本分数运行ES查询
浏览功能列表,并向其添加过滤器匹配的第一个分数
"function_score": { "query": {...}, // base ES query "functions": [ { "filter": {...}, "script_score": {"script": "25"} }, { "filter": {...}, "script_score": {"script": "15"} } ], "score_mode": "first", // take the first script_score where the filter matches "boost_mode": "sum" // and add this to the base ES query score }
我目前正在使用Elasticsearch v1.1.0和NEST v1.0.0-beta1预发行版。
谢谢!