@@ -17,7 +17,7 @@ booleans, or `not_analyzed` exact value string fields:
17
17
{ "term": { "tag": "full_text" }}
18
18
{ "term": { "public": true }}
19
19
--------------------------------------------------
20
-
20
+ // SENSE: 054_Query_DSL/70_Term_filter.json
21
21
22
22
==== `terms` filter
23
23
@@ -29,7 +29,7 @@ the specified values, then the document matches:
29
29
--------------------------------------------------
30
30
{ "terms": { "tag": [ "search", "full_text", "nosql" ] }}
31
31
--------------------------------------------------
32
-
32
+ // SENSE: 054_Query_DSL/70_Terms_filter.json
33
33
34
34
==== `range` filter
35
35
@@ -47,7 +47,7 @@ the specified range:
47
47
}
48
48
}
49
49
--------------------------------------------------
50
-
50
+ // SENSE: 054_Query_DSL/70_Range_filter.json
51
51
52
52
The operators that it accepts are:
53
53
@@ -72,7 +72,7 @@ any values (`missing`). It is similar in nature to `IS_NULL` in SQL:
72
72
}
73
73
}
74
74
--------------------------------------------------
75
-
75
+ // SENSE: 054_Query_DSL/70_Exists_filter.json
76
76
77
77
These filters are frequently used to apply a condition only if a field is
78
78
present, and to apply a different condition if it is missing.
@@ -103,6 +103,7 @@ of filter clauses:
103
103
}
104
104
}
105
105
--------------------------------------------------
106
+ // SENSE: 054_Query_DSL/70_Bool_filter.json
106
107
107
108
108
109
==== `match_all` query
@@ -114,6 +115,7 @@ query which is used if no query has been specified.
114
115
--------------------------------------------------
115
116
{ "match_all": {}}
116
117
--------------------------------------------------
118
+ // SENSE: 054_Query_DSL/70_Match_all_query.json
117
119
118
120
119
121
This query is frequently used in combination with a filter, for instance to
@@ -131,8 +133,9 @@ the search:
131
133
132
134
[source,js]
133
135
--------------------------------------------------
134
- { "match": { "tweet": "Cool, bonsai cool " }}
136
+ { "match": { "tweet": "About Search " }}
135
137
--------------------------------------------------
138
+ // SENSE: 054_Query_DSL/70_Match_query.json
136
139
137
140
If you use it on a field containing an exact value, such as a date, a number,
138
141
a boolean or a `not_analyzed` string field, then it will search for that
@@ -145,6 +148,7 @@ exact value:
145
148
{ "match": { "tag": "full_text" }}
146
149
{ "match": { "public": true }}
147
150
--------------------------------------------------
151
+ // SENSE: 054_Query_DSL/70_Match_query.json
148
152
149
153
TIP: For exact value searches, you probably want to use a filter instead of a
150
154
query, as a filter will be cached.
@@ -169,7 +173,7 @@ fields:
169
173
}
170
174
}
171
175
--------------------------------------------------
172
-
176
+ // SENSE: 054_Query_DSL/70_Multi_match_query.json
173
177
174
178
==== `bool` query
175
179
@@ -200,14 +204,14 @@ match *both* conditions will rank even higher:
200
204
"bool": {
201
205
"must": { "match": { "title": "how to make millions" }},
202
206
"must_not": { "match": { "tag": "spam" }},
203
- "should: [
207
+ "should" : [
204
208
{ "match": { "tag": "starred" }},
205
- { "match ": { "date": { "gte": "2014-01-01" }}
209
+ { "range ": { "date": { "gte": "2014-01-01" } }}
206
210
]
207
211
}
208
212
}
209
213
--------------------------------------------------
210
-
214
+ // SENSE: 054_Query_DSL/70_Bool_query.json
211
215
212
216
If there are no `must` clauses, then at least one `should` clause has to
213
217
match, but if there is at least one `must` clause, then no `should`
0 commit comments