Skip to content

Add initial ML APIs and types #6330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,66 @@ internal static class ApiUrlsLookups
internal static ApiUrls LogstashDeletePipeline = new ApiUrls(new[] { "/_logstash/pipeline/{id}" });
internal static ApiUrls LogstashPutPipeline = new ApiUrls(new[] { "/_logstash/pipeline/{id}" });
internal static ApiUrls MigrationDeprecations = new ApiUrls(new[] { "/_migration/deprecations", "/{index}/_migration/deprecations" });
internal static ApiUrls MachineLearningCloseJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_close" });
internal static ApiUrls MachineLearningDeleteCalendarEvent = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/events/{event_id}" });
internal static ApiUrls MachineLearningDeleteCalendar = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}" });
internal static ApiUrls MachineLearningDeleteDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}" });
internal static ApiUrls MachineLearningDeleteDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}" });
internal static ApiUrls MachineLearningDeleteExpiredData = new ApiUrls(new[] { "/_ml/_delete_expired_data/{job_id}", "/_ml/_delete_expired_data" });
internal static ApiUrls MachineLearningDeleteFilter = new ApiUrls(new[] { "/_ml/filters/{filter_id}" });
internal static ApiUrls MachineLearningDeleteForecast = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_forecast", "/_ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}" });
internal static ApiUrls MachineLearningDeleteJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}" });
internal static ApiUrls MachineLearningDeleteModelSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}" });
internal static ApiUrls MachineLearningDeleteTrainedModelAlias = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/model_aliases/{model_alias}" });
internal static ApiUrls MachineLearningDeleteTrainedModel = new ApiUrls(new[] { "/_ml/trained_models/{model_id}" });
internal static ApiUrls MachineLearningEstimateModelMemory = new ApiUrls(new[] { "/_ml/anomaly_detectors/_estimate_model_memory" });
internal static ApiUrls MachineLearningEvaluateDataFrame = new ApiUrls(new[] { "/_ml/data_frame/_evaluate" });
internal static ApiUrls MachineLearningExplainDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/_explain", "/_ml/data_frame/analytics/{id}/_explain" });
internal static ApiUrls MachineLearningFlushJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_flush" });
internal static ApiUrls MachineLearningForecast = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_forecast" });
internal static ApiUrls MachineLearningGetCalendarEvents = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/events" });
internal static ApiUrls MachineLearningGetCalendars = new ApiUrls(new[] { "/_ml/calendars", "/_ml/calendars/{calendar_id}" });
internal static ApiUrls MachineLearningGetDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}", "/_ml/data_frame/analytics" });
internal static ApiUrls MachineLearningGetDataFrameAnalyticsStats = new ApiUrls(new[] { "/_ml/data_frame/analytics/_stats", "/_ml/data_frame/analytics/{id}/_stats" });
internal static ApiUrls MachineLearningGetInfluencers = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/results/influencers" });
internal static ApiUrls MachineLearningGetJobStats = new ApiUrls(new[] { "/_ml/anomaly_detectors/_stats", "/_ml/anomaly_detectors/{job_id}/_stats" });
internal static ApiUrls MachineLearningGetModelSnapshots = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", "/_ml/anomaly_detectors/{job_id}/model_snapshots" });
internal static ApiUrls MachineLearningGetOverallBuckets = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/results/overall_buckets" });
internal static ApiUrls MachineLearningGetRecords = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/results/records" });
internal static ApiUrls MachineLearningGetTrainedModels = new ApiUrls(new[] { "/_ml/trained_models/{model_id}", "/_ml/trained_models" });
internal static ApiUrls MachineLearningGetTrainedModelsStats = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/_stats", "/_ml/trained_models/_stats" });
internal static ApiUrls MachineLearningInferTrainedModelDeployment = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/deployment/_infer" });
internal static ApiUrls MachineLearningInfo = new ApiUrls(new[] { "/_ml/info" });
internal static ApiUrls MachineLearningOpenJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_open" });
internal static ApiUrls MachineLearningPostCalendarEvents = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/events" });
internal static ApiUrls MachineLearningPreviewDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_preview", "/_ml/datafeeds/_preview" });
internal static ApiUrls MachineLearningPreviewDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/_preview", "/_ml/data_frame/analytics/{id}/_preview" });
internal static ApiUrls MachineLearningPutCalendarJob = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}/jobs/{job_id}" });
internal static ApiUrls MachineLearningPutCalendar = new ApiUrls(new[] { "/_ml/calendars/{calendar_id}" });
internal static ApiUrls MachineLearningPutDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}" });
internal static ApiUrls MachineLearningPutDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}" });
internal static ApiUrls MachineLearningPutFilter = new ApiUrls(new[] { "/_ml/filters/{filter_id}" });
internal static ApiUrls MachineLearningPutJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}" });
internal static ApiUrls MachineLearningPutTrainedModelAlias = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/model_aliases/{model_alias}" });
internal static ApiUrls MachineLearningPutTrainedModel = new ApiUrls(new[] { "/_ml/trained_models/{model_id}" });
internal static ApiUrls MachineLearningPutTrainedModelVocabulary = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/vocabulary" });
internal static ApiUrls MachineLearningResetJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_reset" });
internal static ApiUrls MachineLearningRevertModelSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert" });
internal static ApiUrls MachineLearningSetUpgradeMode = new ApiUrls(new[] { "/_ml/set_upgrade_mode" });
internal static ApiUrls MachineLearningStartDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_start" });
internal static ApiUrls MachineLearningStartDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}/_start" });
internal static ApiUrls MachineLearningStartTrainedModelDeployment = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/deployment/_start" });
internal static ApiUrls MachineLearningStopDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_stop" });
internal static ApiUrls MachineLearningStopDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}/_stop" });
internal static ApiUrls MachineLearningStopTrainedModelDeployment = new ApiUrls(new[] { "/_ml/trained_models/{model_id}/deployment/_stop" });
internal static ApiUrls MachineLearningUpdateDatafeed = new ApiUrls(new[] { "/_ml/datafeeds/{datafeed_id}/_update" });
internal static ApiUrls MachineLearningUpdateDataFrameAnalytics = new ApiUrls(new[] { "/_ml/data_frame/analytics/{id}/_update" });
internal static ApiUrls MachineLearningUpdateFilter = new ApiUrls(new[] { "/_ml/filters/{filter_id}/_update" });
internal static ApiUrls MachineLearningUpdateJob = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/_update" });
internal static ApiUrls MachineLearningUpdateModelSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update" });
internal static ApiUrls MachineLearningUpgradeJobSnapshot = new ApiUrls(new[] { "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade" });
internal static ApiUrls MachineLearningValidateDetector = new ApiUrls(new[] { "/_ml/anomaly_detectors/_validate/detector" });
internal static ApiUrls MachineLearningValidate = new ApiUrls(new[] { "/_ml/anomaly_detectors/_validate" });
internal static ApiUrls NodesHotThreads = new ApiUrls(new[] { "/_nodes/hot_threads", "/_nodes/{node_id}/hot_threads" });
internal static ApiUrls NodesInfo = new ApiUrls(new[] { "/_nodes", "/_nodes/{node_id}", "/_nodes/{metric}", "/_nodes/{node_id}/{metric}" });
internal static ApiUrls NodesReloadSecureSettings = new ApiUrls(new[] { "/_nodes/reload_secure_settings", "/_nodes/{node_id}/reload_secure_settings" });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
public class MlCloseJobRequestParameters : RequestParameters<MlCloseJobRequestParameters>
{
}

public partial class MlCloseJobRequest : PlainRequestBase<MlCloseJobRequestParameters>
{
public MlCloseJobRequest(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningCloseJob;
protected override HttpMethod HttpMethod => HttpMethod.POST;
protected override bool SupportsBody => true;
[JsonInclude]
[JsonPropertyName("allow_no_match")]
public bool? AllowNoMatch { get; set; }

[JsonInclude]
[JsonPropertyName("force")]
public bool? Force { get; set; }

[JsonInclude]
[JsonPropertyName("timeout")]
public Elastic.Clients.Elasticsearch.Time? Timeout { get; set; }
}

public sealed partial class MlCloseJobRequestDescriptor : RequestDescriptorBase<MlCloseJobRequestDescriptor, MlCloseJobRequestParameters>
{
internal MlCloseJobRequestDescriptor(Action<MlCloseJobRequestDescriptor> configure) => configure.Invoke(this);
public MlCloseJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
{
}

internal MlCloseJobRequestDescriptor()
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningCloseJob;
protected override HttpMethod HttpMethod => HttpMethod.POST;
protected override bool SupportsBody => true;
public MlCloseJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id job_id)
{
RouteValues.Required("job_id", job_id);
return Self;
}

private bool? AllowNoMatchValue { get; set; }

private bool? ForceValue { get; set; }

private Elastic.Clients.Elasticsearch.Time? TimeoutValue { get; set; }

public MlCloseJobRequestDescriptor AllowNoMatch(bool? allowNoMatch = true)
{
AllowNoMatchValue = allowNoMatch;
return Self;
}

public MlCloseJobRequestDescriptor Force(bool? force = true)
{
ForceValue = force;
return Self;
}

public MlCloseJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Time? timeout)
{
TimeoutValue = timeout;
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
writer.WriteStartObject();
if (AllowNoMatchValue.HasValue)
{
writer.WritePropertyName("allow_no_match");
writer.WriteBooleanValue(AllowNoMatchValue.Value);
}

if (ForceValue.HasValue)
{
writer.WritePropertyName("force");
writer.WriteBooleanValue(ForceValue.Value);
}

if (TimeoutValue is not null)
{
writer.WritePropertyName("timeout");
JsonSerializer.Serialize(writer, TimeoutValue, options);
}

writer.WriteEndObject();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport.Products.Elasticsearch;
using System.Collections.Generic;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
public partial class MlCloseJobResponse : ElasticsearchResponseBase
{
[JsonInclude]
[JsonPropertyName("closed")]
public bool Closed { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
public class MlDeleteCalendarEventRequestParameters : RequestParameters<MlDeleteCalendarEventRequestParameters>
{
}

public partial class MlDeleteCalendarEventRequest : PlainRequestBase<MlDeleteCalendarEventRequestParameters>
{
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))
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningDeleteCalendarEvent;
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
protected override bool SupportsBody => false;
}

public sealed partial class MlDeleteCalendarEventRequestDescriptor : RequestDescriptorBase<MlDeleteCalendarEventRequestDescriptor, MlDeleteCalendarEventRequestParameters>
{
internal MlDeleteCalendarEventRequestDescriptor(Action<MlDeleteCalendarEventRequestDescriptor> configure) => configure.Invoke(this);
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))
{
}

internal MlDeleteCalendarEventRequestDescriptor()
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningDeleteCalendarEvent;
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
protected override bool SupportsBody => false;
public MlDeleteCalendarEventRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendar_id)
{
RouteValues.Required("calendar_id", calendar_id);
return Self;
}

public MlDeleteCalendarEventRequestDescriptor EventId(Elastic.Clients.Elasticsearch.Id event_id)
{
RouteValues.Required("event_id", event_id);
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport.Products.Elasticsearch;
using System.Collections.Generic;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
public partial class MlDeleteCalendarEventResponse : ElasticsearchResponseBase
{
[JsonInclude]
[JsonPropertyName("acknowledged")]
public bool Acknowledged { get; init; }
}
}
Loading