@@ -60,9 +60,11 @@ To override the default for this field, set the
60
60
to reduce the memory overhead per search request if the potential number of
61
61
shards in the request can be large. Defaults to `512`.
62
62
63
+ [[ccs-minimize-roundtrips]]
63
64
`ccs_minimize_roundtrips`::
64
- (Optional, boolean) Indicates whether network round-trips should be minimized
65
- as part of cross-cluster search requests execution. Defaults to `true`.
65
+ (Optional, boolean) If `true`, network round-trips between the
66
+ coordinating node and the remote clusters are minimized when executing
67
+ {ccs} (CCS) requests. See <<ccs-network-delays>>. Defaults to `true`.
66
68
67
69
`docvalue_fields`::
68
70
(Optional, string) A comma-separated list of fields to return as the docvalue
@@ -77,6 +79,14 @@ Defaults to `open`.
77
79
computation as part of a hit. Defaults to `false`.
78
80
79
81
include::{docdir}/rest-api/common-parms.asciidoc[tag=from]
82
+ +
83
+ --
84
+ [IMPORTANT]
85
+ ====
86
+ You can also specify this value using the `from` request body parameter. If
87
+ both parameters are specified, only the query parameter is used.
88
+ ====
89
+ --
80
90
81
91
`ignore_throttled`::
82
92
(Optional, boolean) If `true`, concrete, expanded or aliased indices will be
@@ -123,8 +133,9 @@ matching the `query` request body parameter are not returned.
123
133
--
124
134
125
135
`request_cache`::
126
- (Optional, boolean) If `true`, request cache will be used for this request.
127
- Defaults to index level settings.
136
+ (Optional, boolean) If `true`, the caching of search results is enabled for
137
+ requests where `size` is `0`. See <<shard-request-cache>>. Defaults to index
138
+ level settings.
128
139
129
140
`rest_total_hits_as_int`::
130
141
(Optional, boolean) Indicates whether hits.total should be rendered as an
@@ -141,7 +152,15 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=search_type]
141
152
last modification of each hit.
142
153
143
154
`size`::
144
- (Optional, integer) Defines the number of hits to return. Defaults to `10`.
155
+ (Optional, integer) Defines the number of hits to return. Defaults to `10`.
156
+ +
157
+ --
158
+ [IMPORTANT]
159
+ ====
160
+ You can also specify this value using the `size` request body parameter. If
161
+ both parameters are specified, only the query parameter is used.
162
+ ====
163
+ --
145
164
146
165
`sort`::
147
166
(Optional, string) A comma-separated list of <field>:<direction> pairs.
@@ -173,12 +192,29 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=source_includes]
173
192
174
193
include::{docdir}/rest-api/common-parms.asciidoc[tag=terminate_after]
175
194
+
195
+ --
176
196
Defaults to `0`, which does not terminate query execution early.
177
197
198
+ [IMPORTANT]
199
+ ====
200
+ You can also specify this value using the `terminate_after` request body
201
+ parameter. If both parameters are specified, only the query parameter is used.
202
+ ====
203
+ --
204
+
178
205
`timeout`::
179
- (Optional, <<time-units, time units>>) Specifies the period of time to wait
180
- for a response. If no response is received before the timeout expires, the
181
- request fails and returns an error. Defaults to no timeout.
206
+ +
207
+ --
208
+ (Optional, <<time-units, time units>>) Specifies the period of time to wait
209
+ for a response. If no response is received before the timeout expires, the
210
+ request fails and returns an error. Defaults to no timeout.
211
+
212
+ [IMPORTANT]
213
+ ====
214
+ You can also specify this value using the `timeout` request body
215
+ parameter. If both parameters are specified, only the query parameter is used.
216
+ ====
217
+ --
182
218
183
219
`track_scores`::
184
220
(Optional, boolean) If `true`, calculate and return document scores, even if
@@ -203,11 +239,58 @@ include the total number of hits matching the query.
203
239
[[search-search-api-request-body]]
204
240
==== {api-request-body-title}
205
241
242
+ include::{docdir}/rest-api/common-parms.asciidoc[tag=from]
243
+ +
244
+ --
245
+ [IMPORTANT]
246
+ ====
247
+ You can also specify this value using the `from` query parameter. If both
248
+ parameters are specified, only the query parameter is used.
249
+ ====
250
+ --
251
+
206
252
[[search-api-request-body-query]]
207
253
`query`::
208
254
(Optional, <<query-dsl,query object>>) Defines the search definition using the
209
255
<<query-dsl,Query DSL>>.
210
256
257
+ `size`::
258
+ (Optional, integer) The number of hits to return. Defaults to `10`.
259
+ +
260
+ --
261
+ [IMPORTANT]
262
+ ====
263
+ You can also specify this value using the `size` query parameter. If both
264
+ parameters are specified, only the query parameter is used.
265
+ ====
266
+ --
267
+
268
+ include::{docdir}/rest-api/common-parms.asciidoc[tag=terminate_after]
269
+ +
270
+ --
271
+ Defaults to `0`, which does not terminate query execution early.
272
+
273
+ [IMPORTANT]
274
+ ====
275
+ You can also specify this value using the `terminate_after` query parameter. If
276
+ both parameters are specified, only the query parameter is used.
277
+ ====
278
+ --
279
+
280
+ `timeout`::
281
+ +
282
+ --
283
+ (Optional, <<time-units, time units>>) Specifies the period of time to wait
284
+ for a response. If no response is received before the timeout expires, the
285
+ request fails and returns an error. Defaults to no timeout.
286
+
287
+ [IMPORTANT]
288
+ ====
289
+ You can also specify this value using the `timeout` query parameter. If both
290
+ parameters are specified, only the query parameter is used.
291
+ ====
292
+ --
293
+
211
294
[role="child_attributes"]
212
295
[[search-api-response-body]]
213
296
==== {api-response-body-title}
@@ -430,3 +513,55 @@ GET /_all/_search?q=user:kimchy
430
513
GET /*/_search?q=user:kimchy
431
514
----
432
515
// TEST[continued]
516
+
517
+ [[search-request-body-api-example]]
518
+ ===== Search an index using the `query` request body parameter
519
+
520
+ [source,console]
521
+ --------------------------------------------------
522
+ GET /twitter/_search
523
+ {
524
+ "query" : {
525
+ "term" : { "user" : "kimchy" }
526
+ }
527
+ }
528
+ --------------------------------------------------
529
+ // TEST[setup:twitter]
530
+
531
+ The API returns the following response:
532
+
533
+ [source,console-result]
534
+ --------------------------------------------------
535
+ {
536
+ "took": 1,
537
+ "timed_out": false,
538
+ "_shards":{
539
+ "total" : 1,
540
+ "successful" : 1,
541
+ "skipped" : 0,
542
+ "failed" : 0
543
+ },
544
+ "hits":{
545
+ "total" : {
546
+ "value": 1,
547
+ "relation": "eq"
548
+ },
549
+ "max_score": 1.3862942,
550
+ "hits" : [
551
+ {
552
+ "_index" : "twitter",
553
+ "_type" : "_doc",
554
+ "_id" : "0",
555
+ "_score": 1.3862942,
556
+ "_source" : {
557
+ "user" : "kimchy",
558
+ "message": "trying out Elasticsearch",
559
+ "date" : "2009-11-15T14:12:12",
560
+ "likes" : 0
561
+ }
562
+ }
563
+ ]
564
+ }
565
+ }
566
+ --------------------------------------------------
567
+ // TESTRESPONSE[s/"took": 1/"took": $body.took/]
0 commit comments