elasticsearch 如何在ElasticSearch中的布尔查询中获得基础匹配查询的分数?,elasticsearch,elasticsearch" /> elasticsearch 如何在ElasticSearch中的布尔查询中获得基础匹配查询的分数?,elasticsearch,elasticsearch" />

elasticsearch 如何在ElasticSearch中的布尔查询中获得基础匹配查询的分数?

elasticsearch 如何在ElasticSearch中的布尔查询中获得基础匹配查询的分数?,elasticsearch,elasticsearch,我有一个非常复杂的搜索,在这里我基本上执行一个大型搜索,搜索与多个实体组中至少一个实体匹配的文章 我注意到,随着我添加更多实体,分数会发生显著变化,因为我的should子句的大小会增加 下面是我对两个实体的查询示例: { "size": 50, "track_scores": true, "min_score": 0.05, "sort": [ { "timestamp": { "order": "desc" } } ]

我有一个非常复杂的搜索,在这里我基本上执行一个大型搜索,搜索与多个实体组中至少一个实体匹配的文章

我注意到,随着我添加更多实体,分数会发生显著变化,因为我的
should
子句的大小会增加

下面是我对两个实体的查询示例:

{
  "size": 50,
  "track_scores": true,
  "min_score": 0.05,
  "sort": [
    {
      "timestamp": {
        "order": "desc"
      }
    }
  ],
  "query": {
    "bool": {
      "should": [
        {
          "bool": {
            "should": [
              {
                "function_score": {
                  "functions": [
                    {
                      "boost_factor": 1000000
                    }
                  ],
                  "query": {
                    "terms": {
                      "relatedProfiles": [
                        "SomethingElse/124026966662",
                        "SomeLocation/707765"
                      ]
                    }
                  },
                  "boost_mode": "replace"
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "multi_match": {
                        "type": "phrase",
                        "query": "Generic Systems",
                        "operator": "and",
                        "fields": [
                          "content.title",
                          "content.description"
                        ]
                      }
                    },
                    {
                      "multi_match": {
                        "type": "phrase",
                        "query": "Generic Systems, Inc.",
                        "operator": "and",
                        "fields": [
                          "content.title",
                          "content.description"
                        ]
                      }
                    }
                  ],
                  "minimum_should_match": "1"
                }
              }
            ],
            "minimum_should_match": "1",
            "_name": "0e7da739-1d18-448b-caa2-5c615a59d108"
          }
        },
        {
          "bool": {
            "should": [
              {
                "function_score": {
                  "functions": [
                    {
                      "boost_factor": 1000000
                    }
                  ],
                  "query": {
                    "terms": {
                      "relatedProfiles": [
                        "SomeLocation/162479",
                        "SomethingElse/32b95cc3-a363-47c3-2ac1-86fdb3b7d108"
                      ]
                    }
                  },
                  "boost_mode": "replace"
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "multi_match": {
                        "type": "phrase",
                        "query": "SomeBusiness Computer Inc",
                        "operator": "and",
                        "fields": [
                          "content.title",
                          "content.description"
                        ]
                      }
                    },
                    {
                      "multi_match": {
                        "type": "phrase",
                        "query": "SomeBusiness, Inc",
                        "operator": "and",
                        "fields": [
                          "content.title",
                          "content.description"
                        ]
                      }
                    }
                  ],
                  "minimum_should_match": "1"
                }
              }
            ],
            "minimum_should_match": "1",
            "_name": "00cc4b36-ce6b-4816-e61e-b7124344d108"
          }
        }
      ],
      "minimum_should_match": "1"
    }
  },
  "filter": {
    "bool": {
      "must": [
        {
          "bool": {
            "should": [
              {
                "bool": {
                  "must": [
                    {
                      "term": {
                        "type": "News"
                      }
                    },
                    {
                      "terms": {
                        "language": [
                          "eng"
                        ]
                      }
                    }
                  ]
                }
              },
              {
                "terms": {
                  "type": [
                    "Social",
                    "Job",
                    "Unknown"
                  ]
                }
              }
            ]
          }
        },
        {
          "range": {
            "timestamp": {
              "lt": "2015-05-13T09:25:40.605",
              "gt": "2013-05-13T09:25:40.605"
            }
          }
        }
      ]
    }
  }
}
如何将基础匹配作为分数?或者,至少是名称查询下方部分的分数?

可以用于此操作。在提供查询时,它为每个文档匹配提供了大量关于如何推导分数的信息。它是调试分数的完美工具。

可能有一些见解;在视频的后面,他谈到了Dis Max查询

“我们希望主分数是与最高提升相关联的分数,而不是字段分数的总和(如布尔查询所示)。”


不幸的是,我并不想调试分数,而是希望查询中不存在一个实体来影响其他实体的分数;在视频的后面,他谈到了*Dis Max查询:“我们希望主分数是与最高提升相关联的分数,而不是字段分数之和(如布尔查询所给出的)。”或者可能是“常量分数查询”“:但我不确定你的真实目标是什么。@马克,你能回答这个问题而不是发表评论,这样我才能接受吗?您的Dis Max查询建议非常正确!毕竟是dismax查询!