1- [[java-rest-high-x-pack-ml-delete-forecast]]
1+ --
2+ :api: delete-forecast
3+ :request: DeleteForecastRequest
4+ :response: AcknowledgedResponse
5+ --
6+ [id="{upid} -{api} "]
27=== Delete Forecast API
38
49The Delete Forecast API provides the ability to delete a {ml} job's
510forecast in the cluster.
6- It accepts a `DeleteForecastRequest` object and responds
7- with an `AcknowledgedResponse` object.
11+ It accepts a +{request}+ object and responds
12+ with an +{response}+ object.
813
9- [[java-rest-high-x-pack-ml-delete-forecast- request] ]
14+ [id="{upid}-{api}- request" ]
1015==== Delete Forecast Request
1116
12- A `DeleteForecastRequest` object gets created with an existing non-null `jobId`.
17+ A +{request}+ object gets created with an existing non-null `jobId`.
1318All other fields are optional for the request.
1419
1520["source","java",subs="attributes,callouts,macros"]
1621--------------------------------------------------
17- include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-forecast -request]
22+ include-tagged::{doc-tests-file}[{api} -request]
1823--------------------------------------------------
1924<1> Constructing a new request referencing an existing `jobId`
2025
@@ -24,55 +29,23 @@ The following arguments are optional.
2429
2530["source","java",subs="attributes,callouts,macros"]
2631--------------------------------------------------
27- include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-forecast -request-options]
32+ include-tagged::{doc-tests-file}[{api} -request-options]
2833--------------------------------------------------
2934<1> Sets the specific forecastIds to delete, can be set to `_all` to indicate ALL forecasts for the given
3035`jobId`
3136<2> Set the timeout for the request to respond, default is 30 seconds
3237<3> Set the `allow_no_forecasts` option. When `true` no error will be returned if an `_all`
33- request finds no forecasts. It defaults to `true`
38+ request finds no forecasts. It defaults to `true`
3439
35- [[java-rest-high-x-pack-ml-delete-forecast-execution]]
36- ==== Execution
37-
38- The request can be executed through the `MachineLearningClient` contained
39- in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
40-
41- ["source","java",subs="attributes,callouts,macros"]
42- --------------------------------------------------
43- include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-forecast-execute]
44- --------------------------------------------------
45-
46- [[java-rest-high-x-pack-ml-delete-forecast-execution-async]]
47- ==== Asynchronous Execution
48-
49- The request can also be executed asynchronously:
50-
51- ["source","java",subs="attributes,callouts,macros"]
52- --------------------------------------------------
53- include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-forecast-execute-async]
54- --------------------------------------------------
55- <1> The `DeleteForecastRequest` to execute and the `ActionListener` to use when
56- the execution completes
57-
58- The method does not block and returns immediately. The passed `ActionListener` is used
59- to notify the caller of completion. A typical `ActionListener` for `AcknowledgedResponse` may
60- look like
61-
62- ["source","java",subs="attributes,callouts,macros"]
63- --------------------------------------------------
64- include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-forecast-listener]
65- --------------------------------------------------
66- <1> `onResponse` is called back when the action is completed successfully
67- <2> `onFailure` is called back when some unexpected error occurs
68-
69- [[java-rest-high-x-pack-ml-delete-forecast-response]]
40+ [id="{upid}-{api}-response"]
7041==== Delete Forecast Response
7142
72- An `AcknowledgedResponse` contains an acknowledgement of the forecast(s) deletion
43+ An +{response}+ contains an acknowledgement of the forecast(s) deletion
7344
7445["source","java",subs="attributes,callouts,macros"]
7546--------------------------------------------------
76- include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-forecast -response]
47+ include-tagged::{doc-tests-file}[{api} -response]
7748--------------------------------------------------
7849<1> `isAcknowledged()` indicates if the forecast was successfully deleted or not.
50+
51+ include::../execution.asciidoc[]
0 commit comments