2018-10-05 11:41:03 -04:00
|
|
|
--
|
|
|
|
:api: delete
|
|
|
|
:request: DeleteRequest
|
|
|
|
:response: DeleteResponse
|
|
|
|
--
|
|
|
|
|
|
|
|
[id="{upid}-{api}"]
|
2017-07-04 04:58:57 -04:00
|
|
|
=== Delete API
|
2017-07-03 04:48:16 -04:00
|
|
|
|
2018-10-05 11:41:03 -04:00
|
|
|
[id="{upid}-{api}-request"]
|
2017-07-04 04:58:57 -04:00
|
|
|
==== Delete Request
|
2017-07-03 04:48:16 -04:00
|
|
|
|
2018-11-30 18:11:29 -05:00
|
|
|
A +{request}+ has two required arguments:
|
2017-07-03 04:48:16 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Index
|
2018-11-30 18:11:29 -05:00
|
|
|
<2> Document id
|
2017-07-03 04:48:16 -04:00
|
|
|
|
2017-07-04 04:58:57 -04:00
|
|
|
==== Optional arguments
|
2017-07-03 04:48:16 -04:00
|
|
|
The following arguments can optionally be provided:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-routing]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Routing value
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-timeout]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Timeout to wait for primary shard to become available as a `TimeValue`
|
|
|
|
<2> Timeout to wait for primary shard to become available as a `String`
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-refresh]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Refresh policy as a `WriteRequest.RefreshPolicy` instance
|
|
|
|
<2> Refresh policy as a `String`
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-version]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Version
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-version-type]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Version type
|
|
|
|
|
2018-10-05 11:41:03 -04:00
|
|
|
include::../execution.asciidoc[]
|
2017-07-03 04:48:16 -04:00
|
|
|
|
2018-10-05 11:41:03 -04:00
|
|
|
[id="{upid}-{api}-response"]
|
2017-07-04 04:58:57 -04:00
|
|
|
==== Delete Response
|
2017-07-03 04:48:16 -04:00
|
|
|
|
2018-10-05 11:41:03 -04:00
|
|
|
The returned +{response}+ allows to retrieve information about the executed
|
2017-07-03 04:48:16 -04:00
|
|
|
operation as follows:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-response]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Handle the situation where number of successful shards is less than
|
|
|
|
total shards
|
|
|
|
<2> Handle the potential failures
|
|
|
|
|
|
|
|
|
|
|
|
It is also possible to check whether the document was found or not:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-notfound]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Do something if the document to be deleted was not found
|
|
|
|
|
|
|
|
If there is a version conflict, an `ElasticsearchException` will
|
|
|
|
be thrown:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:41:03 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-conflict]
|
2017-07-03 04:48:16 -04:00
|
|
|
--------------------------------------------------
|
2017-07-05 05:57:57 -04:00
|
|
|
<1> The raised exception indicates that a version conflict error was returned
|
2017-07-03 04:48:16 -04:00
|
|
|
|