Skip to content
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

Add Machine Learning filter APIs and detector custom rules #3632

Merged
merged 4 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 0 additions & 4 deletions src/CodeGeneration/ApiGenerator/ApiGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ public class ApiGenerator
private static string[] IgnoredApis { get; } =
{
// these API's are not ready for primetime yet
"xpack.ml.delete_filter.json",
"xpack.ml.get_filters.json",
"xpack.ml.put_filter.json",
"xpack.ml.update_filter.json",
"rank_eval.json",

// these API's are new and need to be mapped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public string TypeLowLevel
{
case "boolean": return "bool?";
case "list": return "string[]";
case "int":
russcam marked this conversation as resolved.
Show resolved Hide resolved
case "integer": return "int?";
case "date": return "DateTimeOffset?";
case "enum": return $"{ClsName}?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,11 @@ public partial class DeleteExpiredDataRequestParameters : RequestParameters<Dele
{
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
}
///<summary>Request options for XpackMlDeleteFilter<pre></pre></summary>
public partial class DeleteFilterRequestParameters : RequestParameters<DeleteFilterRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
}
///<summary>Request options for XpackMlDeleteForecast<pre>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html</pre></summary>
public partial class DeleteForecastRequestParameters : RequestParameters<DeleteForecastRequestParameters>
{
Expand Down Expand Up @@ -2470,6 +2475,15 @@ public partial class GetDatafeedStatsRequestParameters : RequestParameters<GetDa
///<summary>Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)</summary>
public bool? AllowNoDatafeeds { get => Q<bool?>("allow_no_datafeeds"); set => Q("allow_no_datafeeds", value); }
}
///<summary>Request options for XpackMlGetFilters<pre></pre></summary>
public partial class GetFiltersRequestParameters : RequestParameters<GetFiltersRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
///<summary>skips a number of filters</summary>
public int? From { get => Q<int?>("from"); set => Q("from", value); }
///<summary>specifies a max number of filters to get</summary>
public int? Size { get => Q<int?>("size"); set => Q("size", value); }
}
///<summary>Request options for XpackMlGetInfluencers<pre>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html</pre></summary>
public partial class GetInfluencersRequestParameters : RequestParameters<GetInfluencersRequestParameters>
{
Expand Down Expand Up @@ -2548,6 +2562,11 @@ public partial class PutDatafeedRequestParameters : RequestParameters<PutDatafee
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
}
///<summary>Request options for XpackMlPutFilter<pre></pre></summary>
public partial class PutFilterRequestParameters : RequestParameters<PutFilterRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
}
///<summary>Request options for XpackMlPutJob<pre>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html</pre></summary>
public partial class PutJobRequestParameters : RequestParameters<PutJobRequestParameters>
{
Expand Down Expand Up @@ -2575,6 +2594,11 @@ public partial class UpdateDatafeedRequestParameters : RequestParameters<UpdateD
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
}
///<summary>Request options for XpackMlUpdateFilter<pre></pre></summary>
public partial class UpdateFilterRequestParameters : RequestParameters<UpdateFilterRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
}
///<summary>Request options for XpackMlUpdateJob<pre>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html</pre></summary>
public partial class UpdateJobRequestParameters : RequestParameters<UpdateJobRequestParameters>
{
Expand Down
52 changes: 52 additions & 0 deletions src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3236,6 +3236,16 @@ public TResponse XpackMlDeleteExpiredData<TResponse>(DeleteExpiredDataRequestPar
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlDeleteExpiredDataAsync<TResponse>(DeleteExpiredDataRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(DELETE, Url($"_xpack/ml/_delete_expired_data"), ctx, null, _params(requestParameters));
///<summary>DELETE on /_xpack/ml/filters/{filter_id} <para></para></summary>
///<param name="filter_id">The ID of the filter to delete</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public TResponse XpackMlDeleteFilter<TResponse>(string filter_id, DeleteFilterRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(DELETE, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}"), null, _params(requestParameters));
///<summary>DELETE on /_xpack/ml/filters/{filter_id} <para></para></summary>
///<param name="filter_id">The ID of the filter to delete</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlDeleteFilterAsync<TResponse>(string filter_id, DeleteFilterRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(DELETE, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}"), ctx, null, _params(requestParameters));
///<summary>DELETE on /_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id} <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html</para></summary>
///<param name="job_id">The ID of the job from which to delete forecasts</param>
///<param name="forecast_id">The ID of the forecast to delete, can be comma delimited list or `_all`</param>
Expand Down Expand Up @@ -3448,6 +3458,24 @@ public TResponse XpackMlGetDatafeedStats<TResponse>(GetDatafeedStatsRequestParam
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlGetDatafeedStatsAsync<TResponse>(GetDatafeedStatsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(GET, Url($"_xpack/ml/datafeeds/_stats"), ctx, null, _params(requestParameters));
///<summary>GET on /_xpack/ml/filters <para></para></summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public TResponse XpackMlGetFilters<TResponse>(GetFiltersRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(GET, Url($"_xpack/ml/filters"), null, _params(requestParameters));
///<summary>GET on /_xpack/ml/filters <para></para></summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlGetFiltersAsync<TResponse>(GetFiltersRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(GET, Url($"_xpack/ml/filters"), ctx, null, _params(requestParameters));
///<summary>GET on /_xpack/ml/filters/{filter_id} <para></para></summary>
///<param name="filter_id">The ID of the filter to fetch</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public TResponse XpackMlGetFilters<TResponse>(string filter_id, GetFiltersRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(GET, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}"), null, _params(requestParameters));
///<summary>GET on /_xpack/ml/filters/{filter_id} <para></para></summary>
///<param name="filter_id">The ID of the filter to fetch</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlGetFiltersAsync<TResponse>(string filter_id, GetFiltersRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(GET, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}"), ctx, null, _params(requestParameters));
///<summary>GET on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html</para></summary>
///<param name="job_id"></param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
Expand Down Expand Up @@ -3686,6 +3714,18 @@ public TResponse XpackMlPutDatafeed<TResponse>(string datafeed_id, PostData body
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlPutDatafeedAsync<TResponse>(string datafeed_id, PostData body, PutDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(PUT, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), ctx, body, _params(requestParameters));
///<summary>PUT on /_xpack/ml/filters/{filter_id} <para></para></summary>
///<param name="filter_id">The ID of the filter to create</param>
///<param name="body">The filter details</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public TResponse XpackMlPutFilter<TResponse>(string filter_id, PostData body, PutFilterRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(PUT, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}"), body, _params(requestParameters));
///<summary>PUT on /_xpack/ml/filters/{filter_id} <para></para></summary>
///<param name="filter_id">The ID of the filter to create</param>
///<param name="body">The filter details</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlPutFilterAsync<TResponse>(string filter_id, PostData body, PutFilterRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(PUT, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}"), ctx, body, _params(requestParameters));
///<summary>PUT on /_xpack/ml/anomaly_detectors/{job_id} <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html</para></summary>
///<param name="job_id">The ID of the job to create</param>
///<param name="body">The job</param>
Expand Down Expand Up @@ -3746,6 +3786,18 @@ public TResponse XpackMlUpdateDatafeed<TResponse>(string datafeed_id, PostData b
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlUpdateDatafeedAsync<TResponse>(string datafeed_id, PostData body, UpdateDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_update"), ctx, body, _params(requestParameters));
///<summary>POST on /_xpack/ml/filters/{filter_id}/_update <para></para></summary>
///<param name="filter_id">The ID of the filter to update</param>
///<param name="body">The filter update</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public TResponse XpackMlUpdateFilter<TResponse>(string filter_id, PostData body, UpdateFilterRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(POST, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}/_update"), body, _params(requestParameters));
///<summary>POST on /_xpack/ml/filters/{filter_id}/_update <para></para></summary>
///<param name="filter_id">The ID of the filter to update</param>
///<param name="body">The filter update</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<TResponse> XpackMlUpdateFilterAsync<TResponse>(string filter_id, PostData body, UpdateFilterRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_xpack/ml/filters/{filter_id.NotNull("filter_id")}/_update"), ctx, body, _params(requestParameters));
///<summary>POST on /_xpack/ml/anomaly_detectors/{job_id}/_update <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html</para></summary>
///<param name="job_id">The ID of the job to create</param>
///<param name="body">The job update settings</param>
Expand Down
Loading