Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/ApiGenerator/RestSpecification/Core/eql.search.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"description": "Returns results matching a query expressed in Event Query Language (EQL)"
},
"stability": "stable",
"visibility":"feature_flag",
"feature_flag":"es.eql_feature_flag_registered",
"visibility":"public",
"headers":{
"accept": [ "application/json"],
"content_type": ["application/json"]
Expand Down
7 changes: 6 additions & 1 deletion src/ApiGenerator/RestSpecification/Core/ml.forecast.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"stability":"stable",
"visibility":"public",
"headers":{
"accept": [ "application/json"]
"accept": [ "application/json"],
"content_type": ["application/json"]
},
"url":{
"paths":[
Expand Down Expand Up @@ -41,6 +42,10 @@
"required":false,
"description":"The max memory able to be used by the forecast. Default is 20mb."
}
},
"body":{
"description": "Query parameters can be specified in the body",
"required":false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"ml.get_model_snapshot_upgrade_stats":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html",
"description":"Gets stats for anomaly detection job model snapshot upgrades that are in progress."
},
"stability":"stable",
"visibility":"public",
"headers":{
"accept": [ "application/json"]
},
"url":{
"paths":[
{
"path":"/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade/_stats",
"methods":[
"GET"
],
"parts":{
"job_id":{
"type":"string",
"description":"The ID of the job. May be a wildcard, comma separated list or `_all`."
},
"snapshot_id":{
"type":"string",
"description":"The ID of the snapshot. May be a wildcard, comma separated list or `_all`."
}
}
}
]
},
"params":{
"allow_no_match":{
"type":"boolean",
"required":false,
"description":"Whether to ignore if a wildcard expression matches no jobs or no snapshots. (This includes the `_all` string.)"
}
}
}
}
7 changes: 6 additions & 1 deletion src/ApiGenerator/RestSpecification/Core/ml.open_job.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"stability":"stable",
"visibility":"public",
"headers":{
"accept": [ "application/json"]
"accept": [ "application/json"],
"content_type": ["application/json"]
},
"url":{
"paths":[
Expand All @@ -24,6 +25,10 @@
}
}
]
},
"body":{
"description": "Query parameters can be specified in the body",
"required":false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public string SkipTime
public class ForecastJobRequestParameters : RequestParameters<ForecastJobRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
public override bool SupportsBody => false;
public override bool SupportsBody => true;
///<summary>The max memory able to be used by the forecast. Default is 20mb.</summary>
public string MaxModelMemory
{
Expand Down Expand Up @@ -507,6 +507,19 @@ public bool? ExcludeGenerated
}
}

///<summary>Request options for GetModelSnapshotUpgradeStats <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html</para></summary>
public class GetModelSnapshotUpgradeStatsRequestParameters : RequestParameters<GetModelSnapshotUpgradeStatsRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
public override bool SupportsBody => false;
///<summary>Whether to ignore if a wildcard expression matches no jobs or no snapshots. (This includes the `_all` string.)</summary>
public bool? AllowNoMatch
{
get => Q<bool? >("allow_no_match");
set => Q("allow_no_match", value);
}
}

///<summary>Request options for GetModelSnapshots <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html</para></summary>
public class GetModelSnapshotsRequestParameters : RequestParameters<GetModelSnapshotsRequestParameters>
{
Expand Down Expand Up @@ -644,7 +657,7 @@ public class MachineLearningInfoRequestParameters : RequestParameters<MachineLea
public class OpenJobRequestParameters : RequestParameters<OpenJobRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
public override bool SupportsBody => false;
public override bool SupportsBody => true;
}

///<summary>Request options for PostCalendarEvents <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html</para></summary>
Expand Down
37 changes: 27 additions & 10 deletions src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,17 @@ public Task<TResponse> FlushJobAsync<TResponse>(string jobId, PostData body, Flu
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_flush"), ctx, body, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/_forecast <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html</para></summary>
///<param name = "jobId">The ID of the job to forecast for</param>
///<param name = "body">Query parameters can be specified in the body</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse ForecastJob<TResponse>(string jobId, ForecastJobRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), null, RequestParams(requestParameters));
public TResponse ForecastJob<TResponse>(string jobId, PostData body, ForecastJobRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), body, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/_forecast <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html</para></summary>
///<param name = "jobId">The ID of the job to forecast for</param>
///<param name = "body">Query parameters can be specified in the body</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
[MapsApi("ml.forecast", "job_id")]
public Task<TResponse> ForecastJobAsync<TResponse>(string jobId, ForecastJobRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), ctx, null, RequestParams(requestParameters));
[MapsApi("ml.forecast", "job_id, body")]
public Task<TResponse> ForecastJobAsync<TResponse>(string jobId, PostData body, ForecastJobRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), ctx, body, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/results/buckets/{timestamp} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html</para></summary>
///<param name = "jobId">ID of the job to get bucket results from</param>
///<param name = "timestamp">The timestamp of the desired single bucket result</param>
Expand Down Expand Up @@ -528,6 +530,19 @@ public TResponse GetJobs<TResponse>(GetJobsRequestParameters requestParameters =
[MapsApi("ml.get_jobs", "")]
public Task<TResponse> GetJobsAsync<TResponse>(GetJobsRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, "_ml/anomaly_detectors", ctx, null, RequestParams(requestParameters));
///<summary>GET on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade/_stats <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html</para></summary>
///<param name = "jobId">The ID of the job. May be a wildcard, comma separated list or `_all`.</param>
///<param name = "snapshotId">The ID of the snapshot. May be a wildcard, comma separated list or `_all`.</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse GetModelSnapshotUpgradeStats<TResponse>(string jobId, string snapshotId, GetModelSnapshotUpgradeStatsRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, Url($"_ml/anomaly_detectors/{jobId:jobId}/model_snapshots/{snapshotId:snapshotId}/_upgrade/_stats"), null, RequestParams(requestParameters));
///<summary>GET on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade/_stats <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html</para></summary>
///<param name = "jobId">The ID of the job. May be a wildcard, comma separated list or `_all`.</param>
///<param name = "snapshotId">The ID of the snapshot. May be a wildcard, comma separated list or `_all`.</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
[MapsApi("ml.get_model_snapshot_upgrade_stats", "job_id, snapshot_id")]
public Task<TResponse> GetModelSnapshotUpgradeStatsAsync<TResponse>(string jobId, string snapshotId, GetModelSnapshotUpgradeStatsRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, Url($"_ml/anomaly_detectors/{jobId:jobId}/model_snapshots/{snapshotId:snapshotId}/_upgrade/_stats"), ctx, null, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html</para></summary>
///<param name = "jobId">The ID of the job to fetch</param>
///<param name = "snapshotId">The ID of the snapshot to fetch</param>
Expand Down Expand Up @@ -633,15 +648,17 @@ public Task<TResponse> InfoAsync<TResponse>(MachineLearningInfoRequestParameters
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, "_ml/info", ctx, null, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/_open <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html</para></summary>
///<param name = "jobId">The ID of the job to open</param>
///<param name = "body">Query parameters can be specified in the body</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse OpenJob<TResponse>(string jobId, OpenJobRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), null, RequestParams(requestParameters));
public TResponse OpenJob<TResponse>(string jobId, PostData body, OpenJobRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), body, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/_open <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html</para></summary>
///<param name = "jobId">The ID of the job to open</param>
///<param name = "body">Query parameters can be specified in the body</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
[MapsApi("ml.open_job", "job_id")]
public Task<TResponse> OpenJobAsync<TResponse>(string jobId, OpenJobRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), ctx, null, RequestParams(requestParameters));
[MapsApi("ml.open_job", "job_id, body")]
public Task<TResponse> OpenJobAsync<TResponse>(string jobId, PostData body, OpenJobRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), ctx, body, RequestParams(requestParameters));
///<summary>POST on /_ml/calendars/{calendar_id}/events <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html</para></summary>
///<param name = "calendarId">The ID of the calendar to modify</param>
///<param name = "body">A list of events</param>
Expand Down