elasticsearch嵌套支持功能中的过滤器

 宝丁2502907973 发布于 2023-01-16 16:03

我目前正在尝试在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预发行版。

谢谢!

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有