| 1234567891011121314151617181920212223242526272829303132333435363738 | --:api: exists:request: GetRequest:response: boolean--[id="{upid}-{api}"]=== Exists APIThe exists API returns `true` if a document exists, and `false` otherwise.[id="{upid}-{api}-request"]==== Exists RequestIt 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 recommendturning off fetching `_source` and any stored fields so the request isslightly 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[]==== Source exists requestA variant of the exists request is `existsSource` method which has the additional checkthat the document in question has stored the `source`. If the mapping for the index has optedto remove support for storing JSON source in documents then this method will return falsefor documents in this index.
 |