Skip to content

Commit a478837

Browse files
github-actions[bot]Mpdreamzstevejgordon
authored
[codegen] 7.x synchronization (#5518)
* [codegen] 7.x synchronization * Update test after change in HTTP method Co-authored-by: Mpdreamz <Mpdreamz@users.noreply.github.com> Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent db3e142 commit a478837

File tree

7 files changed

+113
-14
lines changed

7 files changed

+113
-14
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"ml.find_file_structure":{
3+
"documentation":{
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html",
5+
"description":"Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."
6+
},
7+
"stability":"experimental",
8+
"visibility":"public",
9+
"headers":{
10+
"accept": [ "application/json"],
11+
"content_type": ["application/x-ndjson"]
12+
},
13+
"url":{
14+
"paths":[
15+
{
16+
"path":"/_ml/find_file_structure",
17+
"methods":[
18+
"POST"
19+
],
20+
"deprecated":{
21+
"version":"7.12.0",
22+
"description":"This endpoint has changed to _text_structure/find_structure, please use that API instead"
23+
}
24+
}
25+
]
26+
},
27+
"params":{
28+
"lines_to_sample":{
29+
"type":"int",
30+
"description":"How many lines of the file should be included in the analysis",
31+
"default":1000
32+
},
33+
"line_merge_size_limit":{
34+
"type":"int",
35+
"description":"Maximum number of characters permitted in a single message when lines are merged to create messages.",
36+
"default":10000
37+
},
38+
"timeout":{
39+
"type":"time",
40+
"description":"Timeout after which the analysis will be aborted",
41+
"default":"25s"
42+
},
43+
"charset":{
44+
"type":"string",
45+
"description":"Optional parameter to specify the character set of the file"
46+
},
47+
"format":{
48+
"type":"enum",
49+
"options":[
50+
"ndjson",
51+
"xml",
52+
"delimited",
53+
"semi_structured_text"
54+
],
55+
"description":"Optional parameter to specify the high level file format"
56+
},
57+
"has_header_row":{
58+
"type":"boolean",
59+
"description":"Optional parameter to specify whether a delimited file includes the column names in its first row"
60+
},
61+
"column_names":{
62+
"type":"list",
63+
"description":"Optional parameter containing a comma separated list of the column names for a delimited file"
64+
},
65+
"delimiter":{
66+
"type":"string",
67+
"description":"Optional parameter to specify the delimiter character for a delimited file - must be a single character"
68+
},
69+
"quote":{
70+
"type":"string",
71+
"description":"Optional parameter to specify the quote character for a delimited file - must be a single character"
72+
},
73+
"should_trim_fields":{
74+
"type":"boolean",
75+
"description":"Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them"
76+
},
77+
"grok_pattern":{
78+
"type":"string",
79+
"description":"Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"
80+
},
81+
"timestamp_field":{
82+
"type":"string",
83+
"description":"Optional parameter to specify the timestamp field in the file"
84+
},
85+
"timestamp_format":{
86+
"type":"string",
87+
"description":"Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format"
88+
},
89+
"explain":{
90+
"type":"boolean",
91+
"description":"Whether to include a commentary on how the structure was derived",
92+
"default":false
93+
}
94+
},
95+
"body":{
96+
"description":"The contents of the file to be analyzed",
97+
"required":true,
98+
"serialize":"bulk"
99+
}
100+
}
101+
}

src/ApiGenerator/RestSpecification/Core/text_structure.find_structure.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html",
55
"description":"Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."
66
},
7-
"stability":"experimental",
7+
"stability":"stable",
88
"visibility":"public",
99
"headers":{
1010
"accept": [ "application/json"],

src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ public class PreviewDataFrameAnalyticsRequestParameters : RequestParameters<Prev
681681
///<summary>Request options for PreviewDatafeed <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
682682
public class PreviewDatafeedRequestParameters : RequestParameters<PreviewDatafeedRequestParameters>
683683
{
684-
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
684+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
685685
public override bool SupportsBody => true;
686686
}
687687

src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -721,30 +721,30 @@ public TResponse PreviewDataFrameAnalytics<TResponse>(string id, PostData body,
721721
[MapsApi("ml.preview_data_frame_analytics", "id, body")]
722722
public Task<TResponse> PreviewDataFrameAnalyticsAsync<TResponse>(string id, PostData body, PreviewDataFrameAnalyticsRequestParameters requestParameters = null, CancellationToken ctx = default)
723723
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/data_frame/analytics/{id:id}/_preview"), ctx, body, RequestParams(requestParameters));
724-
///<summary>GET on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
724+
///<summary>POST on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
725725
///<param name = "datafeedId">The ID of the datafeed to preview</param>
726726
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
727727
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
728728
public TResponse PreviewDatafeed<TResponse>(string datafeedId, PostData body, PreviewDatafeedRequestParameters requestParameters = null)
729-
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), body, RequestParams(requestParameters));
730-
///<summary>GET on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
729+
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), body, RequestParams(requestParameters));
730+
///<summary>POST on /_ml/datafeeds/{datafeed_id}/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
731731
///<param name = "datafeedId">The ID of the datafeed to preview</param>
732732
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
733733
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
734734
[MapsApi("ml.preview_datafeed", "datafeed_id, body")]
735735
public Task<TResponse> PreviewDatafeedAsync<TResponse>(string datafeedId, PostData body, PreviewDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default)
736-
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), ctx, body, RequestParams(requestParameters));
737-
///<summary>GET on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
736+
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/datafeeds/{datafeedId:datafeedId}/_preview"), ctx, body, RequestParams(requestParameters));
737+
///<summary>POST on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
738738
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
739739
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
740740
public TResponse PreviewDatafeed<TResponse>(PostData body, PreviewDatafeedRequestParameters requestParameters = null)
741-
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, "_ml/datafeeds/_preview", body, RequestParams(requestParameters));
742-
///<summary>GET on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
741+
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_ml/datafeeds/_preview", body, RequestParams(requestParameters));
742+
///<summary>POST on /_ml/datafeeds/_preview <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
743743
///<param name = "body">The datafeed config and job config with which to execute the preview</param>
744744
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
745745
[MapsApi("ml.preview_datafeed", "body")]
746746
public Task<TResponse> PreviewDatafeedAsync<TResponse>(PostData body, PreviewDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default)
747-
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, "_ml/datafeeds/_preview", ctx, body, RequestParams(requestParameters));
747+
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_ml/datafeeds/_preview", ctx, body, RequestParams(requestParameters));
748748
///<summary>PUT on /_ml/calendars/{calendar_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar.html</para></summary>
749749
///<param name = "calendarId">The ID of the calendar to create</param>
750750
///<param name = "body">The calendar details</param>

src/Elasticsearch.Net/ElasticLowLevelClient.TextStructure.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ internal LowLevelTextStructureNamespace(ElasticLowLevelClient client): base(clie
4646
///<summary>POST on /_text_structure/find_structure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html</para></summary>
4747
///<param name = "body">The contents of the file to be analyzed</param>
4848
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
49-
///<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>
5049
public TResponse FindStructure<TResponse>(PostData body, FindStructureRequestParameters requestParameters = null)
5150
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_text_structure/find_structure", body, RequestParams(requestParameters));
5251
///<summary>POST on /_text_structure/find_structure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html</para></summary>
5352
///<param name = "body">The contents of the file to be analyzed</param>
5453
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
55-
///<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>
5654
[MapsApi("text_structure.find_structure", "body")]
5755
public Task<TResponse> FindStructureAsync<TResponse>(PostData body, FindStructureRequestParameters requestParameters = null, CancellationToken ctx = default)
5856
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_text_structure/find_structure", ctx, body, RequestParams(requestParameters));

tests/Tests/XPack/MachineLearning/PreviewDataFeed/PreviewDataFeedApiTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public PreviewDatafeedApiTests(MachineLearningCluster cluster, EndpointUsage usa
2222
protected override object ExpectJson => null;
2323
protected override int ExpectStatusCode => 200;
2424
protected override Func<PreviewDatafeedDescriptor, IPreviewDatafeedRequest> Fluent => f => f;
25-
protected override HttpMethod HttpMethod => HttpMethod.GET;
25+
protected override HttpMethod HttpMethod => HttpMethod.POST;
2626
protected override PreviewDatafeedRequest Initializer => new PreviewDatafeedRequest(CallIsolatedValue + "-datafeed");
2727
protected override bool SupportsDeserialization => false;
2828
protected override string UrlPath => $"/_ml/datafeeds/{CallIsolatedValue}-datafeed/_preview";

tests/Tests/XPack/MachineLearning/PreviewDataFeed/PreviewDataFeedUrlTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Tests.XPack.MachineLearning.PreviewDataFeed
1212
{
1313
public class PreviewDatafeedUrlTests : UrlTestsBase
1414
{
15-
[U] public override async Task Urls() => await UrlTester.GET("/_ml/datafeeds/datafeed_id/_preview")
15+
[U] public override async Task Urls() => await UrlTester.POST("/_ml/datafeeds/datafeed_id/_preview")
1616
.Fluent(c => c.MachineLearning.PreviewDatafeed<Metric>("datafeed_id", p => p))
1717
.Request(c => c.MachineLearning.PreviewDatafeed<Metric>(new PreviewDatafeedRequest("datafeed_id")))
1818
.FluentAsync(c => c.MachineLearning.PreviewDatafeedAsync<Metric>("datafeed_id", p => p))

0 commit comments

Comments
 (0)