Skip to content

Fix up incorrectly removed endpoint in 7.11 #5536

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 1 commit 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
4 changes: 0 additions & 4 deletions src/ApiGenerator/Configuration/CodeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public static class CodeConfiguration
// To be removed
"indices.upgrade.json",
"indices.get_upgrade.json",

// This was added in 7.12.0 BC1 but the spec was removed before GA, but the API still existed.
// This isn't the preferred API so skipping code gen for it.
"ml.find_file_structure.json"
};

private static string[] IgnoredApisHighLevel { get; } =
Expand Down
31 changes: 31 additions & 0 deletions src/Elasticsearch.Net/Api/Enums.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,19 @@ public enum IndicesShardStoresStatus
All
}

[StringEnum]
public enum MachineLearningFindFileStructureFormat
{
[EnumMember(Value = "ndjson")]
Ndjson,
[EnumMember(Value = "xml")]
Xml,
[EnumMember(Value = "delimited")]
Delimited,
[EnumMember(Value = "semi_structured_text")]
SemiStructuredText
}

[StringEnum]
public enum ThreadType
{
Expand Down Expand Up @@ -461,6 +474,7 @@ static KnownEnums()
EnumStringResolvers.TryAdd(typeof(Conflicts), (e) => GetStringValue((Conflicts)e));
EnumStringResolvers.TryAdd(typeof(OpType), (e) => GetStringValue((OpType)e));
EnumStringResolvers.TryAdd(typeof(IndicesShardStoresStatus), (e) => GetStringValue((IndicesShardStoresStatus)e));
EnumStringResolvers.TryAdd(typeof(MachineLearningFindFileStructureFormat), (e) => GetStringValue((MachineLearningFindFileStructureFormat)e));
EnumStringResolvers.TryAdd(typeof(ThreadType), (e) => GetStringValue((ThreadType)e));
EnumStringResolvers.TryAdd(typeof(GroupBy), (e) => GetStringValue((GroupBy)e));
}
Expand Down Expand Up @@ -933,6 +947,23 @@ public static string GetStringValue(this IndicesShardStoresStatus enumValue)
throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'IndicesShardStoresStatus'");
}

public static string GetStringValue(this MachineLearningFindFileStructureFormat enumValue)
{
switch (enumValue)
{
case MachineLearningFindFileStructureFormat.Ndjson:
return "ndjson";
case MachineLearningFindFileStructureFormat.Xml:
return "xml";
case MachineLearningFindFileStructureFormat.Delimited:
return "delimited";
case MachineLearningFindFileStructureFormat.SemiStructuredText:
return "semi_structured_text";
}

throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'MachineLearningFindFileStructureFormat'");
}

public static string GetStringValue(this ThreadType enumValue)
{
switch (enumValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,110 @@ public class ExplainDataFrameAnalyticsRequestParameters : RequestParameters<Expl
public override bool SupportsBody => true;
}

///<summary>Request options for FindFileStructure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html</para></summary>
public class FindFileStructureRequestParameters : RequestParameters<FindFileStructureRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
public override bool SupportsBody => true;
///<summary>Optional parameter to specify the character set of the file</summary>
public string Charset
{
get => Q<string>("charset");
set => Q("charset", value);
}

///<summary>Optional parameter containing a comma separated list of the column names for a delimited file</summary>
public string[] ColumnNames
{
get => Q<string[]>("column_names");
set => Q("column_names", value);
}

///<summary>Optional parameter to specify the delimiter character for a delimited file - must be a single character</summary>
public string Delimiter
{
get => Q<string>("delimiter");
set => Q("delimiter", value);
}

///<summary>Whether to include a commentary on how the structure was derived</summary>
public bool? Explain
{
get => Q<bool? >("explain");
set => Q("explain", value);
}

///<summary>Optional parameter to specify the high level file format</summary>
public MachineLearningFindFileStructureFormat? MachineLearningFindFileStructureFormat
{
get => Q<MachineLearningFindFileStructureFormat? >("format");
set => Q("format", value);
}

///<summary>Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file</summary>
public string GrokPattern
{
get => Q<string>("grok_pattern");
set => Q("grok_pattern", value);
}

///<summary>Optional parameter to specify whether a delimited file includes the column names in its first row</summary>
public bool? HasHeaderRow
{
get => Q<bool? >("has_header_row");
set => Q("has_header_row", value);
}

///<summary>Maximum number of characters permitted in a single message when lines are merged to create messages.</summary>
public int? LineMergeSizeLimit
{
get => Q<int? >("line_merge_size_limit");
set => Q("line_merge_size_limit", value);
}

///<summary>How many lines of the file should be included in the analysis</summary>
public int? LinesToSample
{
get => Q<int? >("lines_to_sample");
set => Q("lines_to_sample", value);
}

///<summary>Optional parameter to specify the quote character for a delimited file - must be a single character</summary>
public string Quote
{
get => Q<string>("quote");
set => Q("quote", value);
}

///<summary>Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them</summary>
public bool? ShouldTrimFields
{
get => Q<bool? >("should_trim_fields");
set => Q("should_trim_fields", value);
}

///<summary>Timeout after which the analysis will be aborted</summary>
public TimeSpan Timeout
{
get => Q<TimeSpan>("timeout");
set => Q("timeout", value);
}

///<summary>Optional parameter to specify the timestamp field in the file</summary>
public string TimestampField
{
get => Q<string>("timestamp_field");
set => Q("timestamp_field", value);
}

///<summary>Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format</summary>
public string TimestampFormat
{
get => Q<string>("timestamp_format");
set => Q("timestamp_format", value);
}
}

///<summary>Request options for FlushJob <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html</para></summary>
public class FlushJobRequestParameters : RequestParameters<FlushJobRequestParameters>
{
Expand Down
13 changes: 13 additions & 0 deletions src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,19 @@ public TResponse ExplainDataFrameAnalytics<TResponse>(string id, PostData body,
[MapsApi("ml.explain_data_frame_analytics", "id, body")]
public Task<TResponse> ExplainDataFrameAnalyticsAsync<TResponse>(string id, PostData body, ExplainDataFrameAnalyticsRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_ml/data_frame/analytics/{id:id}/_explain"), ctx, body, RequestParams(requestParameters));
///<summary>POST on /_ml/find_file_structure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-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 FindFileStructure<TResponse>(PostData body, FindFileStructureRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_ml/find_file_structure", body, RequestParams(requestParameters));
///<summary>POST on /_ml/find_file_structure <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-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("ml.find_file_structure", "body")]
public Task<TResponse> FindFileStructureAsync<TResponse>(PostData body, FindFileStructureRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_ml/find_file_structure", ctx, body, RequestParams(requestParameters));
///<summary>POST on /_ml/anomaly_detectors/{job_id}/_flush <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html</para></summary>
///<param name = "jobId">The name of the job to flush</param>
///<param name = "body">Flush parameters</param>
Expand Down
3 changes: 0 additions & 3 deletions tests/Tests.YamlRunner/SkipList.fs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,4 @@ let SkipList = dict<SkipFile,SkipSection> [

// TODO investigate post 7.11.0
SkipFile "nodes.info/10_basic.yml", Section "node_info role test"

]