<commit_before>[[java-rest-high-delete-stored-script]]

=== Delete Stored Script API

[[java-rest-high-delete-stored-script-request]]
==== Delete Stored Script Request

A `DeleteStoredScriptRequest` requires an `id`:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request]
--------------------------------------------------
<1> The id of the script

==== Optional arguments
The following arguments can optionally be provided:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the stored script is deleted as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the stored script is deleted as a `String`

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`

[[java-rest-high-delete-stored-script-sync]]
==== Synchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute]
--------------------------------------------------

[[java-rest-high-delete-stored-script-async]]
==== Asynchronous Execution

The asynchronous execution of a delete stored script request requires both the `DeleteStoredScriptRequest`
instance and an `ActionListener` instance to be passed to the asynchronous method:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute-async]
--------------------------------------------------
<1> The `DeleteStoredScriptRequest` to execute and the `ActionListener` to use when
the execution completes

[[java-rest-high-delete-stored-script-listener]]
===== Action Listener

The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.

A typical listener for `DeleteStoredScriptResponse` looks like:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument

[[java-rest-high-delete-stored-script-response]]
==== Delete Stored Script Response

The returned `DeleteStoredScriptResponse` allows to retrieve information about the
executed operation as follows:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request<commit_msg>[DOCS] Fix typos in HLRC delete stored script API (#70897)<commit_after>[[java-rest-high-delete-stored-script]]

=== Delete Stored Script API

[[java-rest-high-delete-stored-script-request]]
==== Delete Stored Script Request

A `DeleteStoredScriptRequest` requires an `id`:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request]
--------------------------------------------------
<1> The id of the script

==== Optional arguments
The following arguments can optionally be provided:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the stored script is deleted as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the stored script is deleted as a `String`

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`

[[java-rest-high-delete-stored-script-sync]]
==== Synchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute]
--------------------------------------------------

[[java-rest-high-delete-stored-script-async]]
==== Asynchronous Execution

The asynchronous execution of a delete stored script request requires both the `DeleteStoredScriptRequest`
instance and an `ActionListener` instance to be passed to the asynchronous method:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute-async]
--------------------------------------------------
<1> The `DeleteStoredScriptRequest` to execute and the `ActionListener` to use when
the execution completes

[[java-rest-high-delete-stored-script-listener]]
===== Action Listener

The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.

A typical listener for `AcknowledgedResponse` looks like:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument

[[java-rest-high-delete-stored-script-response]]
==== Delete Stored Script Response

The returned `AcknowledgedResponse` allows to retrieve information about the
executed operation as follows:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

{'fraction_non_alphanumeric': 0.28001622498647916, 'fraction_numerical': 0.0031097890751757705, 'mean_word_length': 2.400919540229885, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '976413', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1715, 'n_words': 512}