Skip to content

[codegen] 7.x synchronization #5518

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 2 commits into from
Apr 8, 2021
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
101 changes: 101 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/ml.find_file_structure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"ml.find_file_structure":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html",
"description":"Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."
},
"stability":"experimental",
"visibility":"public",
"headers":{
"accept": [ "application/json"],
"content_type": ["application/x-ndjson"]
},
"url":{
"paths":[
{
"path":"/_ml/find_file_structure",
"methods":[
"POST"
],
"deprecated":{
"version":"7.12.0",
"description":"This endpoint has changed to _text_structure/find_structure, please use that API instead"
}
}
]
},
"params":{
"lines_to_sample":{
"type":"int",
"description":"How many lines of the file should be included in the analysis",
"default":1000
},
"line_merge_size_limit":{
"type":"int",
"description":"Maximum number of characters permitted in a single message when lines are merged to create messages.",
"default":10000
},
"timeout":{
"type":"time",
"description":"Timeout after which the analysis will be aborted",
"default":"25s"
},
"charset":{
"type":"string",
"description":"Optional parameter to specify the character set of the file"
},
"format":{
"type":"enum",
"options":[
"ndjson",
"xml",
"delimited",
"semi_structured_text"
],
"description":"Optional parameter to specify the high level file format"
},
"has_header_row":{
"type":"boolean",
"description":"Optional parameter to specify whether a delimited file includes the column names in its first row"
},
"column_names":{
"type":"list",
"description":"Optional parameter containing a comma separated list of the column names for a delimited file"
},
"delimiter":{
"type":"string",
"description":"Optional parameter to specify the delimiter character for a delimited file - must be a single character"
},
"quote":{
"type":"string",
"description":"Optional parameter to specify the quote character for a delimited file - must be a single character"
},
"should_trim_fields":{
"type":"boolean",
"description":"Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them"
},
"grok_pattern":{
"type":"string",
"description":"Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"
},
"timestamp_field":{
"type":"string",
"description":"Optional parameter to specify the timestamp field in the file"
},
"timestamp_format":{
"type":"string",
"description":"Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format"
},
"explain":{
"type":"boolean",
"description":"Whether to include a commentary on how the structure was derived",
"default":false
}
},
"body":{
"description":"The contents of the file to be analyzed",
"required":true,
"serialize":"bulk"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html",
"description":"Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."
},
"stability":"experimental",
"stability":"stable",
"visibility":"public",
"headers":{
"accept": [ "application/json"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ public class PreviewDataFrameAnalyticsRequestParameters : RequestParameters<Prev
///<summary>Request options for PreviewDatafeed <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
public class PreviewDatafeedRequestParameters : RequestParameters<PreviewDatafeedRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
public override bool SupportsBody => true;
}

Expand Down
16 changes: 8 additions & 8 deletions src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -721,30 +721,30 @@ public TResponse PreviewDataFrameAnalytics<TResponse>(string id, PostData body,
[MapsApi("ml.preview_data_frame_analytics", "id, body")]
public Task<TResponse> PreviewDataFrameAnalyticsAsync<TResponse>(string id, PostData body, PreviewDataFrameAnalyticsRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/data_frame/analytics/{id:id}/_preview"), ctx, body, RequestParams(requestParameters));
///<summary>GET on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
///<summary>POST on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
///<param name = "datafeedId">The ID of the datafeed to preview</param>
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse PreviewDatafeed<TResponse>(string datafeedId, PostData body, PreviewDatafeedRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), body, RequestParams(requestParameters));
///<summary>GET on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), body, RequestParams(requestParameters));
///<summary>POST on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
///<param name = "datafeedId">The ID of the datafeed to preview</param>
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
[MapsApi("ml.preview_datafeed", "datafeed_id, body")]
public Task<TResponse> PreviewDatafeedAsync<TResponse>(string datafeedId, PostData body, PreviewDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), ctx, body, RequestParams(requestParameters));
///<summary>GET on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), ctx, body, RequestParams(requestParameters));
///<summary>POST on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse PreviewDatafeed<TResponse>(PostData body, PreviewDatafeedRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, "_ml/datafeeds/_preview", body, RequestParams(requestParameters));
///<summary>GET on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_ml/datafeeds/_preview", body, RequestParams(requestParameters));
///<summary>POST on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
[MapsApi("ml.preview_datafeed", "body")]
public Task<TResponse> PreviewDatafeedAsync<TResponse>(PostData body, PreviewDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, "_ml/datafeeds/_preview", ctx, body, RequestParams(requestParameters));
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_ml/datafeeds/_preview", ctx, body, RequestParams(requestParameters));
///<summary>PUT on /_ml/calendars/{calendar_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar.html</para></summary>
///<param name = "calendarId">The ID of the calendar to create</param>
///<param name = "body">The calendar details</param>
Expand Down
2 changes: 0 additions & 2 deletions src/Elasticsearch.Net/ElasticLowLevelClient.TextStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ internal LowLevelTextStructureNamespace(ElasticLowLevelClient client): base(clie
///<summary>POST on /_text_structure/find_structure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html</para></summary>
///<param name = "body">The contents of the file to be analyzed</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
public TResponse FindStructure<TResponse>(PostData body, FindStructureRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_text_structure/find_structure", body, RequestParams(requestParameters));
///<summary>POST on /_text_structure/find_structure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html</para></summary>
///<param name = "body">The contents of the file to be analyzed</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
[MapsApi("text_structure.find_structure", "body")]
public Task<TResponse> FindStructureAsync<TResponse>(PostData body, FindStructureRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_text_structure/find_structure", ctx, body, RequestParams(requestParameters));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public PreviewDatafeedApiTests(MachineLearningCluster cluster, EndpointUsage usa
protected override object ExpectJson => null;
protected override int ExpectStatusCode => 200;
protected override Func<PreviewDatafeedDescriptor, IPreviewDatafeedRequest> Fluent => f => f;
protected override HttpMethod HttpMethod => HttpMethod.GET;
protected override HttpMethod HttpMethod => HttpMethod.POST;
protected override PreviewDatafeedRequest Initializer => new PreviewDatafeedRequest(CallIsolatedValue + "-datafeed");
protected override bool SupportsDeserialization => false;
protected override string UrlPath => $"/_ml/datafeeds/{CallIsolatedValue}-datafeed/_preview";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Tests.XPack.MachineLearning.PreviewDataFeed
{
public class PreviewDatafeedUrlTests : UrlTestsBase
{
[U] public override async Task Urls() => await UrlTester.GET("/_ml/datafeeds/datafeed_id/_preview")
[U] public override async Task Urls() => await UrlTester.POST("/_ml/datafeeds/datafeed_id/_preview")
.Fluent(c => c.MachineLearning.PreviewDatafeed<Metric>("datafeed_id", p => p))
.Request(c => c.MachineLearning.PreviewDatafeed<Metric>(new PreviewDatafeedRequest("datafeed_id")))
.FluentAsync(c => c.MachineLearning.PreviewDatafeedAsync<Metric>("datafeed_id", p => p))
Expand Down