From 62a5356ac807f50d70e62621f066ab523a8d4191 Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Tue, 14 Dec 2021 10:06:46 +0000 Subject: [PATCH] [codegen] 7.16 synchronization --- .../RestSpecification/Core/eql.search.json | 3 +- .../RestSpecification/Core/ml.forecast.json | 7 +++- .../ml.get_model_snapshot_upgrade_stats.json | 40 +++++++++++++++++++ .../RestSpecification/Core/ml.open_job.json | 7 +++- .../RequestParameters.MachineLearning.cs | 17 +++++++- .../ElasticLowLevelClient.MachineLearning.cs | 37 ++++++++++++----- 6 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 src/ApiGenerator/RestSpecification/Core/ml.get_model_snapshot_upgrade_stats.json diff --git a/src/ApiGenerator/RestSpecification/Core/eql.search.json b/src/ApiGenerator/RestSpecification/Core/eql.search.json index 6748dfd4acf..c854c44d9d7 100644 --- a/src/ApiGenerator/RestSpecification/Core/eql.search.json +++ b/src/ApiGenerator/RestSpecification/Core/eql.search.json @@ -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"] diff --git a/src/ApiGenerator/RestSpecification/Core/ml.forecast.json b/src/ApiGenerator/RestSpecification/Core/ml.forecast.json index 8a88e904802..a468741815b 100644 --- a/src/ApiGenerator/RestSpecification/Core/ml.forecast.json +++ b/src/ApiGenerator/RestSpecification/Core/ml.forecast.json @@ -7,7 +7,8 @@ "stability":"stable", "visibility":"public", "headers":{ - "accept": [ "application/json"] + "accept": [ "application/json"], + "content_type": ["application/json"] }, "url":{ "paths":[ @@ -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 } } } diff --git a/src/ApiGenerator/RestSpecification/Core/ml.get_model_snapshot_upgrade_stats.json b/src/ApiGenerator/RestSpecification/Core/ml.get_model_snapshot_upgrade_stats.json new file mode 100644 index 00000000000..f20b7705011 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ml.get_model_snapshot_upgrade_stats.json @@ -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.)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ml.open_job.json b/src/ApiGenerator/RestSpecification/Core/ml.open_job.json index 07b9e666e28..b93b9cff825 100644 --- a/src/ApiGenerator/RestSpecification/Core/ml.open_job.json +++ b/src/ApiGenerator/RestSpecification/Core/ml.open_job.json @@ -7,7 +7,8 @@ "stability":"stable", "visibility":"public", "headers":{ - "accept": [ "application/json"] + "accept": [ "application/json"], + "content_type": ["application/json"] }, "url":{ "paths":[ @@ -24,6 +25,10 @@ } } ] + }, + "body":{ + "description": "Query parameters can be specified in the body", + "required":false } } } diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs index 60161d50f7f..acbba3bc6ce 100644 --- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs +++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs @@ -242,7 +242,7 @@ public string SkipTime public class ForecastJobRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.POST; - public override bool SupportsBody => false; + public override bool SupportsBody => true; ///The max memory able to be used by the forecast. Default is 20mb. public string MaxModelMemory { @@ -507,6 +507,19 @@ public bool? ExcludeGenerated } } + ///Request options for GetModelSnapshotUpgradeStats https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html + public class GetModelSnapshotUpgradeStatsRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + ///Whether to ignore if a wildcard expression matches no jobs or no snapshots. (This includes the `_all` string.) + public bool? AllowNoMatch + { + get => Q("allow_no_match"); + set => Q("allow_no_match", value); + } + } + ///Request options for GetModelSnapshots https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html public class GetModelSnapshotsRequestParameters : RequestParameters { @@ -644,7 +657,7 @@ public class MachineLearningInfoRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.POST; - public override bool SupportsBody => false; + public override bool SupportsBody => true; } ///Request options for PostCalendarEvents https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs index baddcc02414..a76cfc13be8 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs @@ -275,15 +275,17 @@ public Task FlushJobAsync(string jobId, PostData body, Flu where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_flush"), ctx, body, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/_forecast https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html ///The ID of the job to forecast for + ///Query parameters can be specified in the body ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse ForecastJob(string jobId, ForecastJobRequestParameters requestParameters = null) - where TResponse : class, IElasticsearchResponse, new() => DoRequest(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), null, RequestParams(requestParameters)); + public TResponse ForecastJob(string jobId, PostData body, ForecastJobRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => DoRequest(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), body, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/_forecast https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html ///The ID of the job to forecast for + ///Query parameters can be specified in the body ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("ml.forecast", "job_id")] - public Task ForecastJobAsync(string jobId, ForecastJobRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), ctx, null, RequestParams(requestParameters)); + [MapsApi("ml.forecast", "job_id, body")] + public Task ForecastJobAsync(string jobId, PostData body, ForecastJobRequestParameters requestParameters = null, CancellationToken ctx = default) + where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_forecast"), ctx, body, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/results/buckets/{timestamp} https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html ///ID of the job to get bucket results from ///The timestamp of the desired single bucket result @@ -528,6 +530,19 @@ public TResponse GetJobs(GetJobsRequestParameters requestParameters = [MapsApi("ml.get_jobs", "")] public Task GetJobsAsync(GetJobsRequestParameters requestParameters = null, CancellationToken ctx = default) where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(GET, "_ml/anomaly_detectors", ctx, null, RequestParams(requestParameters)); + ///GET on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade/_stats https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html + ///The ID of the job. May be a wildcard, comma separated list or `_all`. + ///The ID of the snapshot. May be a wildcard, comma separated list or `_all`. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse GetModelSnapshotUpgradeStats(string jobId, string snapshotId, GetModelSnapshotUpgradeStatsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => DoRequest(GET, Url($"_ml/anomaly_detectors/{jobId:jobId}/model_snapshots/{snapshotId:snapshotId}/_upgrade/_stats"), null, RequestParams(requestParameters)); + ///GET on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade/_stats https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html + ///The ID of the job. May be a wildcard, comma separated list or `_all`. + ///The ID of the snapshot. May be a wildcard, comma separated list or `_all`. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("ml.get_model_snapshot_upgrade_stats", "job_id, snapshot_id")] + public Task GetModelSnapshotUpgradeStatsAsync(string jobId, string snapshotId, GetModelSnapshotUpgradeStatsRequestParameters requestParameters = null, CancellationToken ctx = default) + where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(GET, Url($"_ml/anomaly_detectors/{jobId:jobId}/model_snapshots/{snapshotId:snapshotId}/_upgrade/_stats"), ctx, null, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id} https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html ///The ID of the job to fetch ///The ID of the snapshot to fetch @@ -633,15 +648,17 @@ public Task InfoAsync(MachineLearningInfoRequestParameters where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(GET, "_ml/info", ctx, null, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/_open https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html ///The ID of the job to open + ///Query parameters can be specified in the body ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse OpenJob(string jobId, OpenJobRequestParameters requestParameters = null) - where TResponse : class, IElasticsearchResponse, new() => DoRequest(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), null, RequestParams(requestParameters)); + public TResponse OpenJob(string jobId, PostData body, OpenJobRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => DoRequest(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), body, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/_open https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html ///The ID of the job to open + ///Query parameters can be specified in the body ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("ml.open_job", "job_id")] - public Task OpenJobAsync(string jobId, OpenJobRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), ctx, null, RequestParams(requestParameters)); + [MapsApi("ml.open_job", "job_id, body")] + public Task OpenJobAsync(string jobId, PostData body, OpenJobRequestParameters requestParameters = null, CancellationToken ctx = default) + where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_open"), ctx, body, RequestParams(requestParameters)); ///POST on /_ml/calendars/{calendar_id}/events https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html ///The ID of the calendar to modify ///A list of events