ElasticSearch 跨度接近查询未使用嵌套跨度查询产生预期结果

ElasticSearch span near query not producing expected results with nested span queries

我有一个奇怪的场景。我有一个包含文本“6 Music Live Hour”的文档。 查询的第二部分 - span_term 匹配 "Hour" 如下所示时不产生结果

  {
    "span_near" : {
      "clauses" : [
        {
          "span_near" : {
            "clauses" : [
              {
                "span_term" : {
                  "all_field" : {
                    "value" : "6",
                    "boost" : 1.0
                  }
                }
              },
              {
                "span_multi" : {
                  "match" : {
                    "wildcard" : {
                      "all_field" : {
                        "wildcard" : "M*c",
                        "boost" : 1.0
                      }
                    }
                  },
                  "boost" : 1.0
                }
              }
            ],
            "slop" : 0,
            "in_order" : true,
            "boost" : 1.0
          }
        },
        {
          "span_term" : {
            "all_field" : {
              "value" : "Hour",
              "boost" : 1.0
            }
          }
        }
      ],
      "slop" : 2147483647,
      "in_order" : true,
      "boost" : 1.0
    }
  }

但是,当我将其更改为通配符查询时,它会产生预期的结果。见下文。

  {
    "span_near" : {
      "clauses" : [
        {
          "span_near" : {
            "clauses" : [
              {
                "span_term" : {
                  "all_field" : {
                    "value" : "6",
                    "boost" : 1.0
                  }
                }
              },
              {
                "span_multi" : {
                  "match" : {
                    "wildcard" : {
                      "all_field" : {
                        "wildcard" : "M*c",
                        "boost" : 1.0
                      }
                    }
                  },
                  "boost" : 1.0
                }
              }
            ],
            "slop" : 0,
            "in_order" : true,
            "boost" : 1.0
          }
        },
        {
          "span_multi" : {
            "match" : {
              "wildcard" : {
                "all_field" : {
                  "wildcard" : "Hour",
                  "boost" : 1.0
                }
              }
            },
            "boost" : 1.0
          }
        }
      ],
      "slop" : 2147483647,
      "in_order" : true,
      "boost" : 1.0
    }
  }

任何人都可以就我在第一个查询中做错了什么提出建议。

将文本转换为小写,然后构建术语查询产生了预期的结果。