提升跨度

时间:2014-10-24 17:54:00

标签: elasticsearch

我正在使用弹性搜索并尝试使用带模糊匹配的span_near。它与下面的查询配合得很好。但是,我想提高span_near matche。我知道我可以单独提升模糊查询。但是,是否可以提升整个span_near?这是可能的,还是应该做其他事情?

{
  "span_near": {
    "clauses": [
      {
        "span_multi": {
          "match": {
            "fuzzy": {
              "container": {
                "fuzziness": "1",
                "value": "foo"
              }
            }
          }
        }
      },
      {
        "span_multi": {
          "match": {
            "fuzzy": {
              "container": {
                "fuzziness": "2",
                "value": "bar"
              }
            }
          }
        }
      }
    ],
    "slop": 20,
    "in_order": true
  }
}

提前致谢!

1 个答案:

答案 0 :(得分:3)

您可以使用boost选项为整个 span_near 查询提供增强功能。

示例:

{
  "span_near": {
    "clauses": [
      {
        "span_multi": {
          "match": {
            "fuzzy": {
              "container": {
                "fuzziness": "1",
                "value": "foo"
              }
            }
          }
        }
      },
      {
        "span_multi": {
          "match": {
            "fuzzy": {
              "container": {
                "fuzziness": "2",
                "value": "bar"
              }
            }
          }
        }
      }
    ],
    "slop": 20,
    "in_order": true,
    "boost" : 20
  }
}