diff --git a/src/ApiGenerator/RestSpecification/Core/ml.reset_job.json b/src/ApiGenerator/RestSpecification/Core/ml.reset_job.json
new file mode 100644
index 00000000000..75d2ae410e8
--- /dev/null
+++ b/src/ApiGenerator/RestSpecification/Core/ml.reset_job.json
@@ -0,0 +1,36 @@
+{
+ "ml.reset_job":{
+ "documentation":{
+ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html",
+ "description":"Resets an existing anomaly detection job."
+ },
+ "stability":"stable",
+ "visibility":"public",
+ "headers":{
+ "accept": [ "application/json"]
+ },
+ "url":{
+ "paths":[
+ {
+ "path":"/_ml/anomaly_detectors/{job_id}/_reset",
+ "methods":[
+ "POST"
+ ],
+ "parts":{
+ "job_id":{
+ "type":"string",
+ "description":"The ID of the job to reset"
+ }
+ }
+ }
+ ]
+ },
+ "params":{
+ "wait_for_completion":{
+ "type":"boolean",
+ "description":"Should this request wait until the operation has completed before returning",
+ "default":true
+ }
+ }
+ }
+}
diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs
index da48165b4b2..8e46e6b0320 100644
--- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs
+++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs
@@ -777,6 +777,19 @@ public bool? Reassign
}
}
+ ///Request options for ResetJob https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html
+ public class ResetJobRequestParameters : RequestParameters
+ {
+ public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
+ public override bool SupportsBody => false;
+ ///Should this request wait until the operation has completed before returning
+ public bool? WaitForCompletion
+ {
+ get => Q("wait_for_completion");
+ set => Q("wait_for_completion", value);
+ }
+ }
+
///Request options for RevertModelSnapshot https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html
public class RevertModelSnapshotRequestParameters : RequestParameters
{
diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs
index 060bbcd4bc8..baddcc02414 100644
--- a/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs
+++ b/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs
@@ -820,6 +820,17 @@ public TResponse PutTrainedModelAlias(string modelId, string modelAli
[MapsApi("ml.put_trained_model_alias", "model_id, model_alias")]
public Task PutTrainedModelAliasAsync(string modelId, string modelAlias, PutTrainedModelAliasRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(PUT, Url($"_ml/trained_models/{modelId:modelId}/model_aliases/{modelAlias:modelAlias}"), ctx, null, RequestParams(requestParameters));
+ ///POST on /_ml/anomaly_detectors/{job_id}/_reset https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html
+ ///The ID of the job to reset
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse ResetJob(string jobId, ResetJobRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_reset"), null, RequestParams(requestParameters));
+ ///POST on /_ml/anomaly_detectors/{job_id}/_reset https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html
+ ///The ID of the job to reset
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("ml.reset_job", "job_id")]
+ public Task ResetJobAsync(string jobId, ResetJobRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_reset"), ctx, null, RequestParams(requestParameters));
///POST on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html
///The ID of the job to fetch
///The ID of the snapshot to revert to