_explain查询,请解释为什么子句看起来像这样

时间:2018-10-10 07:07:45

标签: elasticsearch elasticsearch-6

我正在将ES 2.x迁移到ES 6.4,对于其中一个查询,我得到了不同的结果(查询和解释均来自ES 6.4)

这是我的查询的一部分:

"multi_match": {
        "query": "nike xl",
        "type": "cross_fields",
        "fields": [
          "name^10",
          "variants.params^10",
          "*desc^5",
          "manufacturer",
          "categories"
        ],
        "operator": "and",
        "minimum_should_match": 1
      }

以下是此multi_match爆炸方式的说明:

"explanation" : {
"value" : 0.0,
"description" : "Failure to meet condition(s) of required/prohibited clause(s)",
"details" : [
  {
    "value" : 0.0,
    "description" : "no match on required clause (((variants.code:*NIKE XL*)^15.0 (((+((shortdesc:nik)^5.0 | (name:nik)^10.0 | categories:nik | (variants.params:nik)^10.0 | (longdesc:nik)^5.0) +((shortdesc:xl)^5.0 | (name:xl)^10.0 | categories:xl | (variants.params:xl)^10.0 | (longdesc:xl)^5.0))~1) | manufacturer:nike xl) (name_na:*xl*)^10.0 #type:product)~1)",

注意一件事。查询中来自fields的所有字段都在nik上搜索,然后也在xl上搜索。但是制造商没有,它在那里寻找nike xl。我相信这就是找不到该文件的原因。有人知道为什么吗?

1 个答案:

答案 0 :(得分:0)

我发现是operator提示引起的问题。我在文档中的任何地方都找不到operatortype=cross_fields上下文中的含义。文档说:

In other words, all terms must be present in at least one field for a document to match.

取自https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-cross-fields

对我来说,operator在这里并不是真正需要的。当我删除它时,我开始获得预期的结果。请注意,在ES 2.4中,这的行为有所不同(好像operator被忽略了)

相关问题