You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of these clauses _must_ match. The equivalent of `AND`.
38
-
39
-
`must_not`::
40
-
All of these clauses _must not_ match. The equivalent of `NOT`.
41
-
42
-
`should`::
43
-
At least one of these clauses must match. The equivalent of `OR`.
32
+
`must`::
33
+
所有的语句都 _必须(must)_ 匹配,与 `AND` 等价。
44
34
45
-
And that's it!((("should clause", "in bool filters")))((("must_not clause", "in bool filters")))((("must clause", "in bool filters"))) When you need multiple filters, simply place them into the
46
-
different sections of the `bool` filter.
35
+
`must_not`::
36
+
所有的语句都 _不能(must not)_ 匹配,与 `NOT` 等价。
37
+
38
+
`should`::
39
+
至少有一个语句要匹配,与 `OR` 等价。
40
+
41
+
就这么简单!((("should clause", "in bool filters")))((("must_not clause", "in bool filters")))((("must clause", "in bool filters"))) 当我们需要多个过滤器时,只须将它们置入 `bool` 过滤器的不同部分即可。
47
42
48
43
[NOTE]
49
44
====
50
-
Each section of the `bool` filter is optional (for example, you can have a `must`
51
-
clause and nothing else), and each section can contain a single filter or an
To replicate the preceding SQL example, we will take the two `term` filters that
56
-
we used((("term filter", "placing inside bool filter")))((("bool filter", "with two term filters in should clause and must_not clause"))) previously and place them inside the `should` clause of a `bool`
57
-
filter, and add another clause to deal with the `NOT` condition:
Even though `bool` is a compound filter and accepts children filters, it is
118
-
important to understand that `bool` is just a filter itself.((("filters", "combining", "nesting bool filters")))((("bool filter", "nesting in another bool filter"))) This means you
119
-
can nest `bool` filters inside other `bool` filters, giving you the
120
-
ability to make arbitrarily complex Boolean logic.
105
+
尽管 `bool` 是一个复合的过滤器,可以接受多个子过滤器,需要注意的是 `bool` 过滤器本身仍然还只是一个过滤器。((("filters", "combining", "nesting bool filters")))((("bool filter", "nesting in another bool filter"))) 这意味着我们可以将一个 `bool` 过滤器置于其他 `bool` 过滤器内部,这为我们提供了对任意复杂布尔逻辑进行处理的能力。
<3> Document 1 matches even though it contains only `brown`, not `dog`.
61
+
<3> 文档 1 也能匹配,尽管它只有 `brown` 没有 `dog` 。
66
62
67
-
Because the `match` query has to look for two terms—`["brown","dog"]`—internally it has to execute two `term` queries and combine their individual
68
-
results into the overall result. To do this, it wraps the two `term` queries
69
-
in a `bool` query, which we examine in detail in <<bool-query>>.
Matching any document that contains _any_ of the query terms may result in a
79
-
long tail of seemingly irrelevant results. ((("full text search", "multi-word queries", "improving precision")))((("precision", "improving for full text search multi-word queries"))) It's a shotgun approach to search.
80
-
Perhaps we want to show only documents that contain _all_ of the query terms.
81
-
In other words, instead of `brown OR dog`, we want to return only documents
82
-
that match `brown AND dog`.
70
+
用 _任意_ 查询词项匹配文档可能会导致结果中出现不相关的长尾。((("full text search", "multi-word queries", "improving precision")))((("precision", "improving for full text search multi-word queries")))这是种散弹式搜索。可能我们只想搜索包含 _所有_ 词项的文档,也就是说,不去匹配 `brown OR dog` ,而通过匹配 `brown AND dog` 找到所有文档。
83
71
84
-
The `match` query accepts an `operator` parameter((("match query", "operator parameter")))((("or operator", "in match queries")))((("and operator", "in match queries"))) that defaults to `or`.
85
-
You can change it to `and` to require that all specified terms must match:
The `match` query supports((("match query", "minimum_should_match parameter")))((("minimum_should_match parameter"))) the `minimum_should_match` parameter, which allows
121
-
you to specify the number of terms that must match for a document to be considered
122
-
relevant. While you can specify an absolute number of terms, it usually makes
123
-
sense to specify a percentage instead, as you have no control over the number of words the user may enter:
0 commit comments