没有[查询]注册[已过滤] [英] no [query] registered for [filtered]

查看:150
本文介绍了没有[查询]注册[已过滤]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的查询

 {
query:{
filtered:{
query:{
multi_match:{
default_operator:AND,
fields:[
author,
title,
publisher,
year
],
查询:乔治·奥威尔
}
},
过滤器:{
条款:{
:[
1980,
1981
]
}
}
}
}
}

我收到一条错误,说出没有[查询]注册[筛选] 。我显然有一个查询过滤的字段。我按照在弹性搜索页面上过滤的查询文档中给出的格式。
https://www.elastic.co/ guide / en / elasticsearch / reference / current / query-dsl-filtered-query.html

解决方案

code>过滤查询已被弃用,并在ES 5.0中删除。您现在应该使用 bool / must / filter 查询。

  {
query:{
bool:{
must:{
multi_match:{
operator:and,
字段:[
author,
title,
publisher,
year
],
query乔治·奥威尔
}
},
过滤器:{
条款:{
年:[
1980,
1981
]
}
}
}
}
}

PS:您正在查看的参考页面位于附录的已删除的页面中,因此它不再是主要文档的一部分。


I have a query which I need to filter out results.

This is my query

{
    "query": {
        "filtered": {
            "query": {
                "multi_match": {
                    "default_operator": "AND",
                    "fields": [
                        "author",
                        "title",
                        "publisher",
                        "year"
                    ],
                    "query": "George Orwell"
                }
            },
            "filter": {
                "terms": {
                    "year": [
                        1980,
                        1981
                    ]
                }
            }
        }
    }
}

I get an error saying no [query] registered for [filtered]. I clearly have a query for the filtered field. I am following the format given in the filtered query documentation on the elasticsearch page. https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html

解决方案

The filtered query has been deprecated and removed in ES 5.0. You should now use the bool/must/filter query instead.

{
    "query": {
        "bool": {
            "must": {
                "multi_match": {
                    "operator": "and",
                    "fields": [
                        "author",
                        "title",
                        "publisher",
                        "year"
                    ],
                    "query": "George Orwell"
                }
            },
            "filter": {
                "terms": {
                    "year": [
                        1980,
                        1981
                    ]
                }
            }
        }
    }
}

PS: the reference page you're looking at is located in the "deleted pages" of the appendix, so it's not part of the main documentation anymore.

这篇关于没有[查询]注册[已过滤]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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