没有为 [已过滤] 注册 [查询]

编程入门 行业动态 更新时间:2024-10-23 07:23:26
本文介绍了没有为 [已过滤] 注册 [查询]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个查询需要过滤结果.

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

这是我的查询

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

我收到一条错误消息,说没有为 [filtered] 注册的 [query].我显然有一个对过滤字段的查询.我正在遵循 elasticsearch 页面上过滤查询文档中给出的格式.www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html

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. www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html

推荐答案

filtered 查询已在 ES 5.0 中弃用并删除.您现在应该使用 bool/must/filter 改为查询.

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 ] } } } } }

以下是两个查询之间的区别:

Here are the differences between the two queries:

3,4c3,4 < "bool": { < "must": { --- > "filtered": { > "query": { 6c6 < "operator": "and", --- > "default_operator": "AND",

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

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.

更多推荐

没有为 [已过滤] 注册 [查询]

本文发布于:2023-11-17 03:03:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608577.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!