在布尔查询中应过滤上下文 [英] Filter context for should in bool query

查看:54
本文介绍了在布尔查询中应过滤上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Elasticsearch文档说

Elasticsearch documentation says

如果布尔查询是一个过滤器上下文,或者既不是必须的也不是过滤器,则至少一个应查询必须与文档匹配才能使其与布尔查询相匹配.

If the bool query is a filter context or has neither must or filter then at least one of the should queries must match a document for it to match the bool query.

因此,我可以在布尔查询中使用should子句以及must或filter在过滤器上下文中,然后仍然获得完全匹配.该如何组合?

So I can have a bool query with a should clause along with must or filter within a filter context and then still get an exact match. How to do this combination?

我也想知道如何与Jest客户一起做到这一点?

I would also be interested in knowing how to do this with Jest client?

推荐答案

在这种情况下,如果您希望至少一个should子句匹配,则需要添加 minimum_should_match:1 .

In that case you need to add minimum_should_match: 1 if you want that at least one of your should clauses match.

这篇关于在布尔查询中应过滤上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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