Skip to content

Update specifications for 7.7.0 #4513

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 5 commits into from
Mar 30, 2020
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
80 changes: 44 additions & 36 deletions src/ApiGenerator/Configuration/CodeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@ public static class CodeConfiguration
/// <summary> These APIs are not implemented yet in the low and high level client</summary>
public static string[] IgnoredApis { get; } =
{
// Upgrade API no longer relevant, might make a reapearance
"indices.upgrade.json",
"indices.get_upgrade.json",

// these APIs are not ready for primetime yet
"indices.reload_search_analyzers.json",
"rank_eval.json",
"eql.search.json",

// Internal API,
// Internal only,
"monitoring.bulk.json",

// Never exposed and now deprecated
Expand All @@ -32,16 +23,53 @@ public static class CodeConfiguration
"data_frame_transform_deprecated.start_transform.json",
"data_frame_transform_deprecated.stop_transform.json",
"data_frame_transform_deprecated.update_transform.json",

// To be removed
"indices.upgrade.json",
"indices.get_upgrade.json",
};

public static string[] IgnoredApisHighLevel { get; } = new []
public static string[] IgnoredApisHighLevel { get; } =
{
"get_script_context.json",
"get_script_languages.json",
"scripts_painless_context.json",
"autoscaling.get_autoscaling_decision.json", // 7.7 experimental
"eql.search.json", // 7.7 beta
"get_script_context.json", // 7.7 experimental
"get_script_languages.json", // 7.7 experimental
"indices.create_data_stream.json", // 7.7 experimental
"indices.delete_data_stream.json", // 7.7 experimental
"indices.get_data_streams.json", // 7.7 experimental
"ml.delete_data_frame_analytics.json", // 7.7 experimental
"ml.delete_trained_model.json", // 7.7 experimental
"ml.evaluate_data_frame.json", // 7.7 experimental
"ml.explain_data_frame_analytics.json", // 7.7 experimental
"ml.find_file_structure.json", // 7.7 experimental
"ml.get_data_frame_analytics.json", // 7.7 experimental
"ml.get_data_frame_analytics_stats.json", // 7.7 experimental
"ml.get_trained_models.json", // 7.7 experimental
"ml.get_trained_models_stats.json", // 7.7 experimental
"ml.put_data_frame_analytics.json", // 7.7 experimental
"ml.put_trained_model.json", // 7.7 experimental
"ml.start_data_frame_analytics.json", // 7.7 experimental
"ml.stop_data_frame_analytics.json", // 7.7 experimental
"rank_eval.json", // 7.7 experimental
"scripts_painless_context.json", // 7.7 experimental

// 7.7 - to be implemented
"async_search.delete.json",
"async_search.get.json",
"async_search.submit.json",
"cat.ml_data_frame_analytics.json",
"cat.ml_datafeeds.json",
"cat.ml_jobs.json",
"cat.ml_trained_models.json",
"cat.transform.json",
"cluster.delete_component_template.json",
"cluster.get_component_template.json",
"cluster.put_component_template.json",
"indices.reload_search_analyzers.json",
"ml.estimate_model_memory.json",
"ml.set_upgrade_mode.json",
"security.get_builtin_privileges.json",

// these APIs are new and need to be mapped
"transform.delete_transform.json",
"transform.get_transform.json",
"transform.get_transform_stats.json",
Expand All @@ -50,26 +78,6 @@ public static class CodeConfiguration
"transform.start_transform.json",
"transform.stop_transform.json",
"transform.update_transform.json",

"data_frame.delete_data_frame_transform.json",
"data_frame.get_data_frame_transform.json",
"data_frame.get_data_frame_transform_stats.json",
"data_frame.preview_data_frame_transform.json",
"data_frame.put_data_frame_transform.json",
"data_frame.start_data_frame_transform.json",
"data_frame.stop_data_frame_transform.json",
"data_frame.update_data_frame_transform.json",

"ml.estimate_memory_usage.json",
"ml.set_upgrade_mode.json",
"ml.find_file_structure.json",
"ml.evaluate_data_frame.json",
"ml.delete_data_frame_analytics.json",
"ml.get_data_frame_analytics.json",
"ml.get_data_frame_analytics_stats.json",
"ml.put_data_frame_analytics.json",
"ml.start_data_frame_analytics.json",
"ml.stop_data_frame_analytics.json",
};


Expand Down
4 changes: 2 additions & 2 deletions src/ApiGenerator/Domain/RestApiSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public class RestApiSpec

public IDictionary<string, ApiEndpoint> Endpoints { get; set; }

public ImmutableSortedDictionary<string, ReadOnlyCollection<ApiEndpoint>> EndpointsPerNamespace =>
public ImmutableSortedDictionary<string, ReadOnlyCollection<ApiEndpoint>> EndpointsPerNamespaceLowLevel =>
Endpoints.Values.GroupBy(e=>e.CsharpNames.Namespace)
.ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly());

public ImmutableSortedDictionary<string, ReadOnlyCollection<ApiEndpoint>> EndpointsPerNamespaceHighLevel =>
Endpoints.Values
.Where(v => !CodeConfiguration.IgnoredApisHighLevel.Contains(v.Name))
.Where(v => !CodeConfiguration.IgnoredApisHighLevel.Contains(v.FileName))
.GroupBy(e => e.CsharpNames.Namespace)
.ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly());

Expand Down
8 changes: 5 additions & 3 deletions src/ApiGenerator/Domain/Specification/UrlPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
namespace ApiGenerator.Domain.Specification
{

//TODO once https://github.com/elastic/elasticsearch/pull/42346 lands
//TODO once https://github.com/elastic/elasticsearch/pull/42346 lands
// Rename this type to Deprecation and remove Path duplication
public class DeprecatedPath
{
public string Version { get; set; }
public string Path { get; set; }
public string Description { get; set; }
}


public class UrlPart
{
private string _description;
Expand Down Expand Up @@ -80,6 +80,8 @@ public string HighLevelTypeName
case "datafeed_id":
case "snapshot_id":
case "filter_id":
case "transform_id":
case "model_id":
case "id":
return "Id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override async Task Generate(RestApiSpec spec, ProgressBar progressBar)
var target = GeneratorLocations.LowLevel($"ElasticLowLevelClient.{CsharpNames.RootNamespace}.cs");
await DoRazor(spec, view, target);

var namespaced = spec.EndpointsPerNamespaceHighLevel.Where(kv => kv.Key != CsharpNames.RootNamespace).ToList();
var namespaced = spec.EndpointsPerNamespaceLowLevel.Where(kv => kv.Key != CsharpNames.RootNamespace).ToList();
var namespacedView = ViewLocations.LowLevel("Client", "Implementation", "ElasticLowLevelClient.Namespace.cshtml");
await DoRazorDependantFiles(progressBar, namespaced, namespacedView, kv => kv.Key,
id => GeneratorLocations.LowLevel($"ElasticLowLevelClient.{id}.cs"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override async Task Generate(RestApiSpec spec, ProgressBar progressBar)
var view = ViewLocations.LowLevel("RequestParameters", "RequestParameters.cshtml");
string Target(string id) => GeneratorLocations.LowLevel("Api", "RequestParameters", $"RequestParameters.{id}.cs");

var namespaced = spec.EndpointsPerNamespaceHighLevel.ToList();
var namespaced = spec.EndpointsPerNamespaceLowLevel.ToList();
await DoRazorDependantFiles(progressBar, namespaced, view, kv => kv.Key, id => Target(id));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"indices.create_data_stream":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html",
"description":"Creates or updates a data stream"
},
"stability":"experimental",
"url":{
"paths":[
{
"path":"/_data_stream/{name}",
"methods":[
"PUT"
],
"parts":{
"name":{
"type":"string",
"description":"The name of the data stream"
}
}
}
]
},
"params":{
},
"body":{
"description":"The data stream definition",
"required":true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"indices.delete_data_stream":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html",
"description":"Deletes a data stream."
},
"stability":"experimental",
"url":{
"paths":[
{
"path":"/_data_stream/{name}",
"methods":[
"DELETE"
],
"parts":{
"name":{
"type":"string",
"description":"The name of the data stream"
}
}
}
]
},
"params":{}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"indices.get_data_streams":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html",
"description":"Returns data streams."
},
"stability":"experimental",
"url":{
"paths":[
{
"path":"/_data_streams",
"methods":[
"GET"
]
},
{
"path":"/_data_streams/{name}",
"methods":[
"GET"
],
"parts":{
"name":{
"type":"list",
"description":"The comma separated names of data streams"
}
}
}
]
},
"params":{
}
}
}
7 changes: 3 additions & 4 deletions src/ApiGenerator/RestSpecification/Core/msearch.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@
"type" : "boolean",
"description" : "Specify whether aggregation and suggester names should be prefixed by their respective types in the response"
},
"pre_filter_shard_size" : {
"type" : "number",
"description" : "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.",
"default" : 128
"pre_filter_shard_size":{
"type":"number",
"description" : "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint."
},
"max_concurrent_shard_requests" : {
"type" : "number",
Expand Down
Loading