如何将具有Multi_Match的筛选查询转换为通用条款的过滤查询 [英] How to convert filtered query with Multi_Match to filtered query with Common Terms

查看:502
本文介绍了如何将具有Multi_Match的筛选查询转换为通用条款的过滤查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ES 2.0。我有以下过滤的查询与 multi_match

  {
filtered:{
query:{
multi_match:{
query:sleep,
fields:[title。 10,介绍*],
cutoff_frequency:0.001,
运算符:或,
分析器:标准
}
},
过滤器:{
...
}
}

由于停止词出现问题,我想用以下解释的常用条款替换Multi_Match: https://www.elastic.co/blog/stop-stopping-stop-words-a-look-at-common-terms -query



如何将以上 multi_match 替换为常用条款?我不知道如何处理基于常用条款的多个字段的搜索。



谢谢!

解决方案

multi_match 查询中指定 cutoff_frequency 时,您已经在使用条款,如您链接到的博客文章中所述:


常见条款也已被并入Match查询中,可以
通过将 cutoff_frequency 设置为0.001


对于匹配和 multi_match elasticsearch / reference / current / query-dsl-match-query.html#query-dsl-match-query-cutoffrel =nofollow> cutoff_frequency 也提到这个事实。


I am using ES 2.0. I have the following filtered query with multi_match:

{
    "filtered" : {
        "query": { 
                "multi_match" : {
                    "query" : "sleep",
                    "fields" : ["title.*^10","introduction.*"],
                    "cutoff_frequency" : 0.001,
                    "operator" : "or",
                    "analyzer" : "standard"
                }
        },
        "filter" : {
            ...
        }
}

Because of stop words issue, I would like to replace the Multi_Match with Common Terms explained here: https://www.elastic.co/blog/stop-stopping-stop-words-a-look-at-common-terms-query

How can I just replace the above multi_match with Common Terms? I cannot figure out how to handle the search on multiple fields based on Common Terms.

Thanks!

解决方案

When specifying the cutoff_frequency in your multi_match query, you're already using common terms, as mentioned in the blog article you linked to:

"Common Terms has also been incorporated into the Match query and can be enabled by setting cutoff_frequency to a value like 0.001"

The documentation for match and multi_match on cutoff_frequency also mention this fact.

这篇关于如何将具有Multi_Match的筛选查询转换为通用条款的过滤查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆