Skip to content

Commit 062d26b

Browse files
Add initial ML APIs and types (#6330) (#6331)
Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent 450adfb commit 062d26b

File tree

241 files changed

+31863
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+31863
-0
lines changed

src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,66 @@ internal static class ApiUrlsLookups
158158
internal static ApiUrls LogstashDeletePipeline = new ApiUrls(new[] { "/_logstash/pipeline/{id}" });
159159
internal static ApiUrls LogstashPutPipeline = new ApiUrls(new[] { "/_logstash/pipeline/{id}" });
160160
internal static ApiUrls MigrationDeprecations = new ApiUrls(new[] { "/_migration/deprecations", "/{index}/_migration/deprecations" });
161+
internal static ApiUrls MachineLearningCloseJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_close" });
162+
internal static ApiUrls MachineLearningDeleteCalendarEvent = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/events/{event_id}" });
163+
internal static ApiUrls MachineLearningDeleteCalendar = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}" });
164+
internal static ApiUrls MachineLearningDeleteDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}" });
165+
internal static ApiUrls MachineLearningDeleteDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}" });
166+
internal static ApiUrls MachineLearningDeleteExpiredData = new ApiUrls(new[] { "/_ml/_delete_expired_data/{job_id}", "/_ml/_delete_expired_data" });
167+
internal static ApiUrls MachineLearningDeleteFilter = new ApiUrls(new[] { "/_ml/filters/{filter_id}" });
168+
internal static ApiUrls MachineLearningDeleteForecast = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_forecast", "/_ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}" });
169+
internal static ApiUrls MachineLearningDeleteJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}" });
170+
internal static ApiUrls MachineLearningDeleteModelSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}" });
171+
internal static ApiUrls MachineLearningDeleteTrainedModelAlias = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/model_aliases/{model_alias}" });
172+
internal static ApiUrls MachineLearningDeleteTrainedModel = new ApiUrls(new[] { "/_ml/trained_models/{model_id}" });
173+
internal static ApiUrls MachineLearningEstimateModelMemory = new ApiUrls(new[] { "/_ml/anomaly_detectors/_estimate_model_memory" });
174+
internal static ApiUrls MachineLearningEvaluateDataFrame = new ApiUrls(new[] { "/_ml/data_frame/_evaluate" });
175+
internal static ApiUrls MachineLearningExplainDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/_explain", "/_ml/data_frame/analytics/{id}/_explain" });
176+
internal static ApiUrls MachineLearningFlushJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_flush" });
177+
internal static ApiUrls MachineLearningForecast = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_forecast" });
178+
internal static ApiUrls MachineLearningGetCalendarEvents = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/events" });
179+
internal static ApiUrls MachineLearningGetCalendars = new ApiUrls(new[] { "/_ml/calendars", "/_ml/calendars/{calendar_id}" });
180+
internal static ApiUrls MachineLearningGetDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}", "/_ml/data_frame/analytics" });
181+
internal static ApiUrls MachineLearningGetDataFrameAnalyticsStats = new ApiUrls(new[] { "/_ml/data_frame/analytics/_stats", "/_ml/data_frame/analytics/{id}/_stats" });
182+
internal static ApiUrls MachineLearningGetInfluencers = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/results/influencers" });
183+
internal static ApiUrls MachineLearningGetJobStats = new ApiUrls(new[] { "/_ml/anomaly_detectors/_stats", "/_ml/anomaly_detectors/{job_id}/_stats" });
184+
internal static ApiUrls MachineLearningGetModelSnapshots = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", "/_ml/anomaly_detectors/{job_id}/model_snapshots" });
185+
internal static ApiUrls MachineLearningGetOverallBuckets = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/results/overall_buckets" });
186+
internal static ApiUrls MachineLearningGetRecords = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/results/records" });
187+
internal static ApiUrls MachineLearningGetTrainedModels = new ApiUrls(new[] { "/_ml/trained_models/{model_id}", "/_ml/trained_models" });
188+
internal static ApiUrls MachineLearningGetTrainedModelsStats = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/_stats", "/_ml/trained_models/_stats" });
189+
internal static ApiUrls MachineLearningInferTrainedModelDeployment = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/deployment/_infer" });
190+
internal static ApiUrls MachineLearningInfo = new ApiUrls(new[] { "/_ml/info" });
191+
internal static ApiUrls MachineLearningOpenJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_open" });
192+
internal static ApiUrls MachineLearningPostCalendarEvents = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/events" });
193+
internal static ApiUrls MachineLearningPreviewDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_preview", "/_ml/datafeeds/_preview" });
194+
internal static ApiUrls MachineLearningPreviewDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/_preview", "/_ml/data_frame/analytics/{id}/_preview" });
195+
internal static ApiUrls MachineLearningPutCalendarJob = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/jobs/{job_id}" });
196+
internal static ApiUrls MachineLearningPutCalendar = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}" });
197+
internal static ApiUrls MachineLearningPutDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}" });
198+
internal static ApiUrls MachineLearningPutDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}" });
199+
internal static ApiUrls MachineLearningPutFilter = new ApiUrls(new[] { "/_ml/filters/{filter_id}" });
200+
internal static ApiUrls MachineLearningPutJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}" });
201+
internal static ApiUrls MachineLearningPutTrainedModelAlias = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/model_aliases/{model_alias}" });
202+
internal static ApiUrls MachineLearningPutTrainedModel = new ApiUrls(new[] { "/_ml/trained_models/{model_id}" });
203+
internal static ApiUrls MachineLearningPutTrainedModelVocabulary = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/vocabulary" });
204+
internal static ApiUrls MachineLearningResetJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_reset" });
205+
internal static ApiUrls MachineLearningRevertModelSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert" });
206+
internal static ApiUrls MachineLearningSetUpgradeMode = new ApiUrls(new[] { "/_ml/set_upgrade_mode" });
207+
internal static ApiUrls MachineLearningStartDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_start" });
208+
internal static ApiUrls MachineLearningStartDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}/_start" });
209+
internal static ApiUrls MachineLearningStartTrainedModelDeployment = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/deployment/_start" });
210+
internal static ApiUrls MachineLearningStopDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_stop" });
211+
internal static ApiUrls MachineLearningStopDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}/_stop" });
212+
internal static ApiUrls MachineLearningStopTrainedModelDeployment = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/deployment/_stop" });
213+
internal static ApiUrls MachineLearningUpdateDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_update" });
214+
internal static ApiUrls MachineLearningUpdateDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}/_update" });
215+
internal static ApiUrls MachineLearningUpdateFilter = new ApiUrls(new[] { "/_ml/filters/{filter_id}/_update" });
216+
internal static ApiUrls MachineLearningUpdateJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_update" });
217+
internal static ApiUrls MachineLearningUpdateModelSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update" });
218+
internal static ApiUrls MachineLearningUpgradeJobSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade" });
219+
internal static ApiUrls MachineLearningValidateDetector = new ApiUrls(new[] { "/_ml/anomaly_detectors/_validate/detector" });
220+
internal static ApiUrls MachineLearningValidate = new ApiUrls(new[] { "/_ml/anomaly_detectors/_validate" });
161221
internal static ApiUrls NodesHotThreads = new ApiUrls(new[] { "/_nodes/hot_threads", "/_nodes/{node_id}/hot_threads" });
162222
internal static ApiUrls NodesInfo = new ApiUrls(new[] { "/_nodes", "/_nodes/{node_id}", "/_nodes/{metric}", "/_nodes/{node_id}/{metric}" });
163223
internal static ApiUrls NodesReloadSecureSettings = new ApiUrls(new[] { "/_nodes/reload_secure_settings", "/_nodes/{node_id}/reload_secure_settings" });
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Linq.Expressions;
22+
using System.Text.Json;
23+
using System.Text.Json.Serialization;
24+
25+
#nullable restore
26+
namespace Elastic.Clients.Elasticsearch.Ml
27+
{
28+
public class MlCloseJobRequestParameters : RequestParameters<MlCloseJobRequestParameters>
29+
{
30+
}
31+
32+
public partial class MlCloseJobRequest : PlainRequestBase<MlCloseJobRequestParameters>
33+
{
34+
public MlCloseJobRequest(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
35+
{
36+
}
37+
38+
internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningCloseJob;
39+
protected override HttpMethod HttpMethod => HttpMethod.POST;
40+
protected override bool SupportsBody => true;
41+
[JsonInclude]
42+
[JsonPropertyName("allow_no_match")]
43+
public bool? AllowNoMatch { get; set; }
44+
45+
[JsonInclude]
46+
[JsonPropertyName("force")]
47+
public bool? Force { get; set; }
48+
49+
[JsonInclude]
50+
[JsonPropertyName("timeout")]
51+
public Elastic.Clients.Elasticsearch.Time? Timeout { get; set; }
52+
}
53+
54+
public sealed partial class MlCloseJobRequestDescriptor : RequestDescriptorBase<MlCloseJobRequestDescriptor, MlCloseJobRequestParameters>
55+
{
56+
internal MlCloseJobRequestDescriptor(Action<MlCloseJobRequestDescriptor> configure) => configure.Invoke(this);
57+
public MlCloseJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
58+
{
59+
}
60+
61+
internal MlCloseJobRequestDescriptor()
62+
{
63+
}
64+
65+
internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningCloseJob;
66+
protected override HttpMethod HttpMethod => HttpMethod.POST;
67+
protected override bool SupportsBody => true;
68+
public MlCloseJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id job_id)
69+
{
70+
RouteValues.Required("job_id", job_id);
71+
return Self;
72+
}
73+
74+
private bool? AllowNoMatchValue { get; set; }
75+
76+
private bool? ForceValue { get; set; }
77+
78+
private Elastic.Clients.Elasticsearch.Time? TimeoutValue { get; set; }
79+
80+
public MlCloseJobRequestDescriptor AllowNoMatch(bool? allowNoMatch = true)
81+
{
82+
AllowNoMatchValue = allowNoMatch;
83+
return Self;
84+
}
85+
86+
public MlCloseJobRequestDescriptor Force(bool? force = true)
87+
{
88+
ForceValue = force;
89+
return Self;
90+
}
91+
92+
public MlCloseJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Time? timeout)
93+
{
94+
TimeoutValue = timeout;
95+
return Self;
96+
}
97+
98+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
99+
{
100+
writer.WriteStartObject();
101+
if (AllowNoMatchValue.HasValue)
102+
{
103+
writer.WritePropertyName("allow_no_match");
104+
writer.WriteBooleanValue(AllowNoMatchValue.Value);
105+
}
106+
107+
if (ForceValue.HasValue)
108+
{
109+
writer.WritePropertyName("force");
110+
writer.WriteBooleanValue(ForceValue.Value);
111+
}
112+
113+
if (TimeoutValue is not null)
114+
{
115+
writer.WritePropertyName("timeout");
116+
JsonSerializer.Serialize(writer, TimeoutValue, options);
117+
}
118+
119+
writer.WriteEndObject();
120+
}
121+
}
122+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport.Products.Elasticsearch;
19+
using System.Collections.Generic;
20+
using System.Text.Json.Serialization;
21+
22+
#nullable restore
23+
namespace Elastic.Clients.Elasticsearch.Ml
24+
{
25+
public partial class MlCloseJobResponse : ElasticsearchResponseBase
26+
{
27+
[JsonInclude]
28+
[JsonPropertyName("closed")]
29+
public bool Closed { get; init; }
30+
}
31+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Linq.Expressions;
22+
using System.Text.Json;
23+
using System.Text.Json.Serialization;
24+
25+
#nullable restore
26+
namespace Elastic.Clients.Elasticsearch.Ml
27+
{
28+
public class MlDeleteCalendarEventRequestParameters : RequestParameters<MlDeleteCalendarEventRequestParameters>
29+
{
30+
}
31+
32+
public partial class MlDeleteCalendarEventRequest : PlainRequestBase<MlDeleteCalendarEventRequestParameters>
33+
{
34+
public MlDeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.Id calendar_id, Elastic.Clients.Elasticsearch.Id event_id) : base(r => r.Required("calendar_id", calendar_id).Required("event_id", event_id))
35+
{
36+
}
37+
38+
internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningDeleteCalendarEvent;
39+
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
40+
protected override bool SupportsBody => false;
41+
}
42+
43+
public sealed partial class MlDeleteCalendarEventRequestDescriptor : RequestDescriptorBase<MlDeleteCalendarEventRequestDescriptor, MlDeleteCalendarEventRequestParameters>
44+
{
45+
internal MlDeleteCalendarEventRequestDescriptor(Action<MlDeleteCalendarEventRequestDescriptor> configure) => configure.Invoke(this);
46+
public MlDeleteCalendarEventRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendar_id, Elastic.Clients.Elasticsearch.Id event_id) : base(r => r.Required("calendar_id", calendar_id).Required("event_id", event_id))
47+
{
48+
}
49+
50+
internal MlDeleteCalendarEventRequestDescriptor()
51+
{
52+
}
53+
54+
internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningDeleteCalendarEvent;
55+
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
56+
protected override bool SupportsBody => false;
57+
public MlDeleteCalendarEventRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendar_id)
58+
{
59+
RouteValues.Required("calendar_id", calendar_id);
60+
return Self;
61+
}
62+
63+
public MlDeleteCalendarEventRequestDescriptor EventId(Elastic.Clients.Elasticsearch.Id event_id)
64+
{
65+
RouteValues.Required("event_id", event_id);
66+
return Self;
67+
}
68+
69+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
70+
{
71+
}
72+
}
73+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport.Products.Elasticsearch;
19+
using System.Collections.Generic;
20+
using System.Text.Json.Serialization;
21+
22+
#nullable restore
23+
namespace Elastic.Clients.Elasticsearch.Ml
24+
{
25+
public partial class MlDeleteCalendarEventResponse : ElasticsearchResponseBase
26+
{
27+
[JsonInclude]
28+
[JsonPropertyName("acknowledged")]
29+
public bool Acknowledged { get; init; }
30+
}
31+
}

0 commit comments

Comments
 (0)