Skip to content

Commit f4693ed

Browse files
committed
Update rest specs and regenerate client
1 parent 5b84abe commit f4693ed

37 files changed

+402
-170
lines changed

docs/aggregations.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ The values are typically extracted from the fields of the document (using the fi
6464

6565
* <<sum-aggregation-usage,Sum Aggregation Usage>>
6666

67-
* <<t-test-aggregation-usage,T Test Aggregation Usage>>
68-
6967
* <<top-hits-aggregation-usage,Top Hits Aggregation Usage>>
7068

7169
* <<top-metrics-aggregation-usage,Top Metrics Aggregation Usage>>
7270

71+
* <<t-test-aggregation-usage,T Test Aggregation Usage>>
72+
7373
* <<value-count-aggregation-usage,Value Count Aggregation Usage>>
7474

7575
* <<weighted-average-aggregation-usage,Weighted Average Aggregation Usage>>
@@ -108,12 +108,12 @@ include::aggregations/metric/string-stats/string-stats-aggregation-usage.asciido
108108

109109
include::aggregations/metric/sum/sum-aggregation-usage.asciidoc[]
110110

111-
include::aggregations/metric/t-test/t-test-aggregation-usage.asciidoc[]
112-
113111
include::aggregations/metric/top-hits/top-hits-aggregation-usage.asciidoc[]
114112

115113
include::aggregations/metric/top-metrics/top-metrics-aggregation-usage.asciidoc[]
116114

115+
include::aggregations/metric/t-test/t-test-aggregation-usage.asciidoc[]
116+
117117
include::aggregations/metric/value-count/value-count-aggregation-usage.asciidoc[]
118118

119119
include::aggregations/metric/weighted-average/weighted-average-aggregation-usage.asciidoc[]

docs/query-dsl.asciidoc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ NEST exposes all of the full text queries available in Elasticsearch
4949

5050
* <<intervals-usage,Intervals Usage>>
5151

52-
* <<match-bool-prefix-usage,Match Bool Prefix Usage>>
52+
* <<match-usage,Match Usage>>
5353

54-
* <<match-phrase-prefix-usage,Match Phrase Prefix Usage>>
54+
* <<match-bool-prefix-usage,Match Bool Prefix Usage>>
5555

5656
* <<match-phrase-usage,Match Phrase Usage>>
5757

58-
* <<match-usage,Match Usage>>
58+
* <<match-phrase-prefix-usage,Match Phrase Prefix Usage>>
5959

6060
* <<multi-match-usage,Multi Match Usage>>
6161

@@ -71,13 +71,13 @@ include::query-dsl/full-text/common-terms/common-terms-usage.asciidoc[]
7171

7272
include::query-dsl/full-text/intervals/intervals-usage.asciidoc[]
7373

74-
include::query-dsl/full-text/match-bool-prefix/match-bool-prefix-usage.asciidoc[]
74+
include::query-dsl/full-text/match/match-usage.asciidoc[]
7575

76-
include::query-dsl/full-text/match-phrase-prefix/match-phrase-prefix-usage.asciidoc[]
76+
include::query-dsl/full-text/match-bool-prefix/match-bool-prefix-usage.asciidoc[]
7777

7878
include::query-dsl/full-text/match-phrase/match-phrase-usage.asciidoc[]
7979

80-
include::query-dsl/full-text/match/match-usage.asciidoc[]
80+
include::query-dsl/full-text/match-phrase-prefix/match-phrase-prefix-usage.asciidoc[]
8181

8282
include::query-dsl/full-text/multi-match/multi-match-usage.asciidoc[]
8383

@@ -122,14 +122,14 @@ NEST exposes all of the term queries available in Elasticsearch
122122

123123
* <<term-query-usage,Term Query Usage>>
124124

125-
* <<terms-set-query-usage,Terms Set Query Usage>>
126-
127125
* <<terms-list-query-usage,Terms List Query Usage>>
128126

129127
* <<terms-lookup-query-usage,Terms Lookup Query Usage>>
130128

131129
* <<terms-query-usage,Terms Query Usage>>
132130

131+
* <<terms-set-query-usage,Terms Set Query Usage>>
132+
133133
* <<wildcard-query-usage,Wildcard Query Usage>>
134134

135135
See the Elasticsearch documentation on {ref_current}/term-level-queries.html[Term level queries] for more details.
@@ -160,14 +160,14 @@ include::query-dsl/term-level/regexp/regexp-query-usage.asciidoc[]
160160

161161
include::query-dsl/term-level/term/term-query-usage.asciidoc[]
162162

163-
include::query-dsl/term-level/terms-set/terms-set-query-usage.asciidoc[]
164-
165163
include::query-dsl/term-level/terms/terms-list-query-usage.asciidoc[]
166164

167165
include::query-dsl/term-level/terms/terms-lookup-query-usage.asciidoc[]
168166

169167
include::query-dsl/term-level/terms/terms-query-usage.asciidoc[]
170168

169+
include::query-dsl/term-level/terms-set/terms-set-query-usage.asciidoc[]
170+
171171
include::query-dsl/term-level/wildcard/wildcard-query-usage.asciidoc[]
172172

173173
[[compound-queries]]
@@ -283,10 +283,10 @@ Specialized types of queries that do not fit into other groups
283283

284284
* <<rank-feature-query-usage,Rank Feature Query Usage>>
285285

286-
* <<script-score-query-usage,Script Score Query Usage>>
287-
288286
* <<script-query-usage,Script Query Usage>>
289287

288+
* <<script-score-query-usage,Script Score Query Usage>>
289+
290290
* <<shape-query-usage,Shape Query Usage>>
291291

292292
See the Elasticsearch documentation on {ref_current}/specialized-queries.html[Specialized queries] for more details.
@@ -305,10 +305,10 @@ include::query-dsl/specialized/pinned/pinned-query-usage.asciidoc[]
305305

306306
include::query-dsl/specialized/rank-feature/rank-feature-query-usage.asciidoc[]
307307

308-
include::query-dsl/specialized/script-score/script-score-query-usage.asciidoc[]
309-
310308
include::query-dsl/specialized/script/script-query-usage.asciidoc[]
311309

310+
include::query-dsl/specialized/script-score/script-score-query-usage.asciidoc[]
311+
312312
include::query-dsl/specialized/shape/shape-query-usage.asciidoc[]
313313

314314
[[span-queries]]

src/ApiGenerator/Domain/Specification/QueryParameters.cs

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,23 @@ public string Obsolete
8080
get
8181
{
8282
if (!string.IsNullOrEmpty(_obsolete)) return _obsolete;
83+
if (Deprecated != null)
84+
{
85+
if (!string.IsNullOrEmpty(Deprecated.Version) && !string.IsNullOrEmpty(Deprecated.Description))
86+
return $"Deprecated as of: {Deprecated.Version}, reason: {Deprecated.Description}";
87+
if (!string.IsNullOrEmpty(Deprecated.Version))
88+
return $"Deprecated as of: {Deprecated.Version}";
89+
if (!string.IsNullOrEmpty(Deprecated.Description))
90+
return $"reason: {Deprecated.Description}";
91+
92+
return "deprecated";
93+
}
8394

84-
return Deprecated != null
85-
? $"Deprecated as of: {Deprecated.Version}, reason: {Deprecated.Description}"
86-
: null;
95+
return null;
8796
}
8897
set => _obsolete = value;
8998
}
9099

91-
public class QueryParameterDeprecation
92-
{
93-
public string Version { get; set; }
94-
95-
public string Description { get; set; }
96-
}
97-
98100
public QueryParameterDeprecation Deprecated { get; set; }
99101

100102
public IEnumerable<string> Options { get; set; }
@@ -173,4 +175,27 @@ public string TypeLowLevel
173175
public string InitializerGenerator(string @namespace, string type, string name, string key, string setter, params string[] doc) =>
174176
CodeGenerator.Property(@namespace, type, name, key, setter, Obsolete, doc);
175177
}
178+
179+
public class QueryParameterDeprecation
180+
{
181+
public string Version { get; set; }
182+
183+
public string Description { get; set; }
184+
}
185+
186+
internal class QueryParameterDeprecationConverter : JsonConverter
187+
{
188+
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => throw new NotImplementedException();
189+
190+
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
191+
{
192+
if (reader.TokenType == JsonToken.Boolean)
193+
return new QueryParameterDeprecation();
194+
195+
var jObject = JObject.Load(reader);
196+
return jObject.ToObject<QueryParameterDeprecation>(JsonSerializer.CreateDefault());
197+
}
198+
199+
public override bool CanConvert(Type objectType) => typeof(QueryParameterDeprecation).IsAssignableFrom(objectType);
200+
}
176201
}

src/ApiGenerator/Generator/ApiEndpointFactory.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@
1111
using ApiGenerator.Domain;
1212
using ApiGenerator.Domain.Code;
1313
using ApiGenerator.Domain.Specification;
14+
using Newtonsoft.Json;
1415
using Newtonsoft.Json.Linq;
1516

1617
namespace ApiGenerator.Generator
1718
{
1819
public static class ApiEndpointFactory
1920
{
21+
private static readonly JsonSerializer Serializer = JsonSerializer.Create(
22+
new JsonSerializerSettings { Converters = new List<JsonConverter> { new QueryParameterDeprecationConverter() } });
23+
2024
public static ApiEndpoint FromFile(string jsonFile)
2125
{
2226
var officialJsonSpec = JObject.Parse(File.ReadAllText(jsonFile));
2327
TransformNewSpecStructureToOld(officialJsonSpec);
2428
PatchOfficialSpec(officialJsonSpec, jsonFile);
25-
var (name, endpoint) = officialJsonSpec.ToObject<Dictionary<string, ApiEndpoint>>().First();
29+
var (name, endpoint) = officialJsonSpec.ToObject<Dictionary<string, ApiEndpoint>>(Serializer).First();
2630

2731
endpoint.FileName = Path.GetFileName(jsonFile);
2832
endpoint.Name = name;

src/ApiGenerator/Generator/ApiGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System;
5+
using System;
66
using System.Collections.Generic;
77
using System.IO;
88
using System.Linq;

src/ApiGenerator/RestSpecification/Core/indices.add_block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"indices.add_block":{
33
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-blocks.html",
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html",
55
"description":"Adds a block to an index."
66
},
77
"stability":"stable",

src/ApiGenerator/RestSpecification/Core/indices.resolve_index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"indices.resolve_index":{
33
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index.html",
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html",
55
"description":"Returns information about any matching indices, aliases, and data streams"
66
},
77
"stability":"experimental",

0 commit comments

Comments
 (0)