| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | --:api: delete:request: DeleteRequest:response: DeleteResponse--[id="{upid}-{api}"]=== Delete API[id="{upid}-{api}-request"]==== Delete RequestA +{request}+ requires the following arguments:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------<1> Index<2> Type<3> Document id==== Optional argumentsThe following arguments can optionally be provided:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request-routing]--------------------------------------------------<1> Routing value["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request-timeout]--------------------------------------------------<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"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request-refresh]--------------------------------------------------<1> Refresh policy as a `WriteRequest.RefreshPolicy` instance<2> Refresh policy as a `String`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request-version]--------------------------------------------------<1> Version["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request-version-type]--------------------------------------------------<1> Version typeinclude::../execution.asciidoc[][id="{upid}-{api}-response"]==== Delete ResponseThe returned +{response}+ allows to retrieve information about the executed operation as follows:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> Handle the situation where number of successful shards is less thantotal shards<2> Handle the potential failuresIt is also possible to check whether the document was found or not:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-notfound]--------------------------------------------------<1> Do something if the document to be deleted was not foundIf there is a version conflict, an `ElasticsearchException` willbe thrown:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-conflict]--------------------------------------------------<1> The raised exception indicates that a version conflict error was returned
 |