mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-04-17 21:07:25 +00:00
This further applies the pattern set in #34125 to reduce copy-and-paste in the single document CRUD portion of the High Level REST Client docs. It also adds line wraps to snippets that are too wide to fit into the box when rendered in the docs, following up on the work started in #34163.
32 lines
884 B
Plaintext
32 lines
884 B
Plaintext
--
|
|
:api: exists
|
|
:request: GetRequest
|
|
:response: boolean
|
|
--
|
|
|
|
[id="{upid}-{api}"]
|
|
=== Exists API
|
|
|
|
The exists API returns `true` if a document exists, and `false` otherwise.
|
|
|
|
[id="{upid}-{api}-request"]
|
|
==== Exists Request
|
|
|
|
It uses +{request}+ just like the <<java-rest-high-document-get>>.
|
|
All of its <<java-rest-high-document-get-request-optional-arguments, optional arguments>>
|
|
are supported. Since `exists()` only returns `true` or `false`, we recommend
|
|
turning off fetching `_source` and any stored fields so the request is
|
|
slightly lighter:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests-file}[{api}-request]
|
|
--------------------------------------------------
|
|
<1> Index
|
|
<2> Type
|
|
<3> Document id
|
|
<4> Disable fetching `_source`.
|
|
<5> Disable fetching stored fields.
|
|
|
|
include::../execution.asciidoc[]
|