| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 | --:api: asyncsearch-delete:request: DeleteAsyncSearchRequest:response: AcknowledgedResponse--[role="xpack"][id="{upid}-{api}"]=== Delete Async Search API[id="{upid}-{api}-request"]==== RequestA +{request}+ allows deleting a running asynchronous search task usingits id. Required arguments are the `id` of a running search:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------[id="{upid}-{api}-sync"]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-execute]--------------------------------------------------<1> Execute the request and get back the response as an +{response}+ object.[id="{upid}-{api}-async"]==== Asynchronous ExecutionThe asynchronous execution of a +{request}+ allows to use an `ActionListener` to be called back when the submit request returns: ["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-execute-async]--------------------------------------------------<1> The +{request}+ to execute and the `ActionListener` to use whenthe execution completesThe asynchronous method does not block and returns immediately. Once it iscompleted the `ActionListener` is called back using the `onResponse` methodif the execution successfully completed or using the `onFailure` method ifit failed.A typical listener for +{response}+ looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-listener]--------------------------------------------------<1> Called when the execution is successfully completed. The response isprovided as an argument<2> Called in case of failure. The raised exception is provided as an argument[id="{upid}-{api}-response"]==== ResponseThe returned +{response}+ indicates the acknowledgement of the request:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> `isAcknowledged` was the deletion request acknowledged or not.
 |