跨多个领域的模糊性——只在某些领域使用模糊性

Fuzziness across multiple fields -- only use fuzziness on certain fields

有没有一种方法可以仅在某些列上使用模糊度进行 cross_field 搜索?例如:

match against:
- name (fuzziness=1)
- country (fuzziness=0)

所以搜索 "John USA" 会匹配,搜索 "Jon USA" 会匹配,但搜索 "John AUS" 不会。这将如何完成?

正如文档中所写和 Val 在上面的评论中所说,"The fuzziness parameter cannot be used with the cross_fields type"。

根据我阅读的内容 here and here。对于您所描述的问题,我会使用 AUTO 值来表示模糊度 属性。同样,我会更进一步,并指定 'name' 列应该比国家列更相关,因为您更有可能匹配名称而不是国家(由于您提供的结构征求意见)。

{
   "size": 100,
   "query": {
      "multi_match": {
         "query": "John Doe USA",
         "fields": [
            "name^3",
            "country"
         ],
         "fuzziness": "AUTO",
         "max_expansions": 50,
         "prefix_length": 0
      }
   }
}

希望对您有所帮助!