Skip to content

Commit 771fc2d

Browse files
authored
[codegen] 7.x synchronization
1 parent 145f035 commit 771fc2d

File tree

6 files changed

+246
-12
lines changed

6 files changed

+246
-12
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/Enums.Generated.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,19 @@ public enum IndicesShardStoresStatus
411411
All
412412
}
413413

414+
[StringEnum]
415+
public enum MachineLearningFindFileStructureFormat
416+
{
417+
[EnumMember(Value = "ndjson")]
418+
Ndjson,
419+
[EnumMember(Value = "xml")]
420+
Xml,
421+
[EnumMember(Value = "delimited")]
422+
Delimited,
423+
[EnumMember(Value = "semi_structured_text")]
424+
SemiStructuredText
425+
}
426+
414427
[StringEnum]
415428
public enum ThreadType
416429
{
@@ -474,6 +487,7 @@ static KnownEnums()
474487
EnumStringResolvers.TryAdd(typeof(Conflicts), (e) => GetStringValue((Conflicts)e));
475488
EnumStringResolvers.TryAdd(typeof(OpType), (e) => GetStringValue((OpType)e));
476489
EnumStringResolvers.TryAdd(typeof(IndicesShardStoresStatus), (e) => GetStringValue((IndicesShardStoresStatus)e));
490+
EnumStringResolvers.TryAdd(typeof(MachineLearningFindFileStructureFormat), (e) => GetStringValue((MachineLearningFindFileStructureFormat)e));
477491
EnumStringResolvers.TryAdd(typeof(ThreadType), (e) => GetStringValue((ThreadType)e));
478492
EnumStringResolvers.TryAdd(typeof(GroupBy), (e) => GetStringValue((GroupBy)e));
479493
EnumStringResolvers.TryAdd(typeof(TextStructureFindStructureFormat), (e) => GetStringValue((TextStructureFindStructureFormat)e));
@@ -947,6 +961,23 @@ public static string GetStringValue(this IndicesShardStoresStatus enumValue)
947961
throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'IndicesShardStoresStatus'");
948962
}
949963

964+
public static string GetStringValue(this MachineLearningFindFileStructureFormat enumValue)
965+
{
966+
switch (enumValue)
967+
{
968+
case MachineLearningFindFileStructureFormat.Ndjson:
969+
return "ndjson";
970+
case MachineLearningFindFileStructureFormat.Xml:
971+
return "xml";
972+
case MachineLearningFindFileStructureFormat.Delimited:
973+
return "delimited";
974+
case MachineLearningFindFileStructureFormat.SemiStructuredText:
975+
return "semi_structured_text";
976+
}
977+
978+
throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'MachineLearningFindFileStructureFormat'");
979+
}
980+
950981
public static string GetStringValue(this ThreadType enumValue)
951982
{
952983
switch (enumValue)

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

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,110 @@ public class ExplainDataFrameAnalyticsRequestParameters : RequestParameters<Expl
222222
public override bool SupportsBody => true;
223223
}
224224

225+
///<summary>Request options for FindFileStructure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html</para></summary>
226+
public class FindFileStructureRequestParameters : RequestParameters<FindFileStructureRequestParameters>
227+
{
228+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
229+
public override bool SupportsBody => true;
230+
///<summary>Optional parameter to specify the character set of the file</summary>
231+
public string Charset
232+
{
233+
get => Q<string>("charset");
234+
set => Q("charset", value);
235+
}
236+
237+
///<summary>Optional parameter containing a comma separated list of the column names for a delimited file</summary>
238+
public string[] ColumnNames
239+
{
240+
get => Q<string[]>("column_names");
241+
set => Q("column_names", value);
242+
}
243+
244+
///<summary>Optional parameter to specify the delimiter character for a delimited file - must be a single character</summary>
245+
public string Delimiter
246+
{
247+
get => Q<string>("delimiter");
248+
set => Q("delimiter", value);
249+
}
250+
251+
///<summary>Whether to include a commentary on how the structure was derived</summary>
252+
public bool? Explain
253+
{
254+
get => Q<bool? >("explain");
255+
set => Q("explain", value);
256+
}
257+
258+
///<summary>Optional parameter to specify the high level file format</summary>
259+
public Format? Format
260+
{
261+
get => Q<Format? >("format");
262+
set => Q("format", value);
263+
}
264+
265+
///<summary>Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file</summary>
266+
public string GrokPattern
267+
{
268+
get => Q<string>("grok_pattern");
269+
set => Q("grok_pattern", value);
270+
}
271+
272+
///<summary>Optional parameter to specify whether a delimited file includes the column names in its first row</summary>
273+
public bool? HasHeaderRow
274+
{
275+
get => Q<bool? >("has_header_row");
276+
set => Q("has_header_row", value);
277+
}
278+
279+
///<summary>Maximum number of characters permitted in a single message when lines are merged to create messages.</summary>
280+
public int? LineMergeSizeLimit
281+
{
282+
get => Q<int? >("line_merge_size_limit");
283+
set => Q("line_merge_size_limit", value);
284+
}
285+
286+
///<summary>How many lines of the file should be included in the analysis</summary>
287+
public int? LinesToSample
288+
{
289+
get => Q<int? >("lines_to_sample");
290+
set => Q("lines_to_sample", value);
291+
}
292+
293+
///<summary>Optional parameter to specify the quote character for a delimited file - must be a single character</summary>
294+
public string Quote
295+
{
296+
get => Q<string>("quote");
297+
set => Q("quote", value);
298+
}
299+
300+
///<summary>Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them</summary>
301+
public bool? ShouldTrimFields
302+
{
303+
get => Q<bool? >("should_trim_fields");
304+
set => Q("should_trim_fields", value);
305+
}
306+
307+
///<summary>Timeout after which the analysis will be aborted</summary>
308+
public TimeSpan Timeout
309+
{
310+
get => Q<TimeSpan>("timeout");
311+
set => Q("timeout", value);
312+
}
313+
314+
///<summary>Optional parameter to specify the timestamp field in the file</summary>
315+
public string TimestampField
316+
{
317+
get => Q<string>("timestamp_field");
318+
set => Q("timestamp_field", value);
319+
}
320+
321+
///<summary>Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format</summary>
322+
public string TimestampFormat
323+
{
324+
get => Q<string>("timestamp_format");
325+
set => Q("timestamp_format", value);
326+
}
327+
}
328+
225329
///<summary>Request options for FlushJob <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html</para></summary>
226330
public class FlushJobRequestParameters : RequestParameters<FlushJobRequestParameters>
227331
{
@@ -681,7 +785,7 @@ public class PreviewDataFrameAnalyticsRequestParameters : RequestParameters<Prev
681785
///<summary>Request options for PreviewDatafeed <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html</para></summary>
682786
public class PreviewDatafeedRequestParameters : RequestParameters<PreviewDatafeedRequestParameters>
683787
{
684-
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
788+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
685789
public override bool SupportsBody => true;
686790
}
687791

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));

0 commit comments

Comments
 (0)