elasticsearch,pyes,Lucene,elasticsearch,Pyes" /> elasticsearch,pyes,Lucene,elasticsearch,Pyes" />

Lucene 弹性搜索中的自定义分数

Lucene 弹性搜索中的自定义分数,lucene,elasticsearch,pyes,Lucene,elasticsearch,Pyes,我有一个索引,每个文档代表一个班级,有学生名单和教师名单 以下是映射: { "properties" : { "students" : { "include_in_root" : 1, "type" : "nested", "properties" : { "name" : { "first" : "text", "last" : "text",

我有一个索引,每个文档代表一个班级,有学生名单和教师名单

以下是映射:

{
"properties" :  {
    "students" : {
        "include_in_root" : 1,
        "type" : "nested",
        "properties" : {
            "name" : {
                "first" : "text",
                "last" : "text",
                },
            },
            "email" : { "type" : "string", "index" : "not_analyzed" },
        },

    "teachers" : {
        "include_in_root" : 0,
        "include_in_all" : 0,
        "type" : "nested",
        "properties" : {
            "name" : {
                "title" : { "type" : "string", "index" : "not_analyzed" },
                "first" : "text",
                "last" : "text",
                },
            },
        },
    },
}
我想影响弹性搜索评分功能,这样它将为技术人员匹配的文档提供更高的评分

例如,如果我搜索了“Smith”,我希望带有教师Smith的文档比带有学生Smith的文档得分更高

有人知道弹性搜索应该怎么做吗? 换句话说,我如何返回按逻辑排序的结果

提前谢谢

回答如下: $20a$20bool$20query$20to$20run$20two$20嵌套$20querys%22/elasticsearch/XTAb7eHcbqI/UgnKDh7ou48J