Skip to content

Commit 5572cce

Browse files
authored
[DOCS] Add collapsible sections to search API response (#55887)
1 parent 11d2480 commit 5572cce

File tree

1 file changed

+67
-48
lines changed

1 file changed

+67
-48
lines changed

docs/reference/search/search.asciidoc

Lines changed: 67 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,14 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
226226
(Optional, <<query-dsl,query object>>) Defines the search definition using the
227227
<<query-dsl,Query DSL>>.
228228

229-
229+
[role="child_attributes"]
230230
[[search-api-response-body]]
231231
==== {api-response-body-title}
232232

233233
`took`::
234234
+
235235
--
236-
(Integer)
236+
(integer)
237237
Milliseconds it took {es} to execute the request.
238238

239239
This value is calculated by measuring the time elapsed
@@ -254,90 +254,109 @@ Took time does *not* include:
254254
* Time needed to send the response to a client
255255
--
256256

257-
258257
`timed_out`::
259-
+
260-
--
261-
(Boolean)
258+
(boolean)
262259
If `true`,
263260
the request timed out before completion;
264261
returned results may be partial or empty.
265-
--
266262

267263
`_shards`::
264+
(object)
265+
Contains a count of shards used for the request.
268266
+
269-
--
270-
(Object)
271-
Object containing a count of shards used for the request.
272-
Returned parameters include:
273-
267+
.Properties of `_shards`
268+
[%collapsible%open]
269+
====
274270
`total`::
275-
(Integer)
271+
(integer)
276272
Total number of shards that require querying,
277273
including unallocated shards.
278274
279275
`successful`::
280-
(Integer)
276+
(integer)
281277
Number of shards that executed the request successfully.
282278
283279
`skipped`::
284-
(Integer)
280+
(integer)
285281
Number of shards that skipped the request because a lightweight check
286282
helped realize that no documents could possibly match on this shard. This
287283
typically happens when a search request includes a range filter and the
288284
shard only has values that fall outside of that range.
289285
290286
`failed`::
291-
(Integer)
287+
(integer)
292288
Number of shards that failed to execute the request. Note that shards
293289
that are not allocated will be considered neither successful nor failed.
294290
Having `failed+successful` less than `total` is thus an indication that
295291
some of the shards were not allocated.
296-
297-
--
292+
====
298293

299294
`hits`::
300-
+
301-
--
302-
(Object)
295+
(object)
303296
Contains returned documents and metadata.
304-
Returned parameters include:
305-
297+
+
298+
.Properties of `hits`
299+
[%collapsible%open]
300+
====
306301
`total`::
307-
(Object)
302+
(object)
308303
Metadata about the number of returned documents.
309-
Returned parameters include:
310304
+
311-
* `value`: Total number of returned documents.
312-
* `relation`: Indicates whether the number of returned documents in the `value`
313-
parameter is accurate or a lower bound. Returned values are:
314-
** `eq`: Accurate
315-
** `gte`: Lower bound, including returned documents
305+
.Properties of `total`
306+
[%collapsible%open]
307+
=====
308+
`value`::
309+
(integer)
310+
Total number of returned documents.
311+
312+
`relation`::
313+
(string)
314+
Indicates whether the number of returned documents in the `value`
315+
parameter is accurate or a lower bound.
316+
+
317+
.Values of `relation`:
318+
[%collapsible%open]
319+
======
320+
`eq`:: Accurate
321+
`gte`:: Lower bound, including returned documents
322+
======
323+
=====
316324
317325
`max_score`::
318-
(Float)
319-
Highest returned document `_score`.
326+
(float)
327+
Highest returned <<search-api-response-body-score,document `_score`>>.
320328
+
321-
The `_score` parameter is a 32-bit floating point number
322-
used to determine the relevance of the returned document.
323-
+
324-
This parameter value is `null` for requests
325-
that do not sort by `_score`.
329+
This value is `null` for requests that do not sort by `_score`.
326330
331+
[[search-api-response-body-hits]]
327332
`hits`::
328-
(Array of objects)
333+
(array of objects)
329334
Array of returned document objects.
330-
Returned parameters include:
331335
+
332-
* `_index`: Name of the index containing the returned document.
333-
* `_id`: Unique identifier for the returned document.
334-
This ID is only unique within the returned index.
335-
* `_score`: Positive 32-bit floating point number used to determine the
336-
relevance of the returned document.
337-
* `_source`: Object containing the original JSON body
338-
passed for the document at index time.
339-
--
340-
336+
.Properties of `hits` objects
337+
[%collapsible%open]
338+
=====
339+
`_index`::
340+
(string)
341+
Name of the index containing the returned document.
342+
343+
`_id`::
344+
(string)
345+
Unique identifier for the returned document.
346+
This ID is only unique within the returned index.
347+
348+
[[search-api-response-body-score]]
349+
`_score`::
350+
(float)
351+
Positive 32-bit floating point number used to determine the relevance of the
352+
returned document.
353+
354+
[[search-api-response-body-source]]
355+
`_source`::
356+
(object)
357+
Original JSON body passed for the document at index time.
358+
=====
359+
====
341360

342361
[[search-search-api-example]]
343362
==== {api-examples-title}

0 commit comments

Comments
 (0)