Skip to content

Commit df991b4

Browse files
Align specification tweaks and naming with Java (#6982) (#6983)
* Remove container suffixes * Manual type renaming to align with Java * Rename requests and responses to align with Java * Remove range query until ambiguous union is handled * EQL Get Status fixup * Skip SimpleQueryStringFlags until generated correctly * Eql API URLs Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent 6d8ffc2 commit df991b4

File tree

294 files changed

+6043
-7914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+6043
-7914
lines changed

benchmarks/Benchmarks/Program.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,56 +173,56 @@ public class BulkIngest
173173
public void Version7()
174174
{
175175
Stream.Position = 0;
176-
_ = NestClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponse>(Stream);
176+
_ = NestClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponse>(Stream);
177177
}
178178

179179
[Benchmark]
180180
public void Version8()
181181
{
182182
Stream.Position = 0;
183-
_ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponse>(Stream);
183+
_ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponse>(Stream);
184184
}
185185

186186
// [Benchmark]
187187
// public void Version8_String()
188188
// {
189189
// Stream.Position = 0;
190-
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponseV2>(Stream);
190+
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponseV2>(Stream);
191191
// }
192192

193193
//[Benchmark]
194194
//public void Version8_String_Converter()
195195
//{
196196
// Stream.Position = 0;
197-
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponseV3>(Stream);
197+
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponseV3>(Stream);
198198
//}
199199

200200
//[Benchmark]
201201
//public void Version8_String_ConverterWithBool()
202202
//{
203203
// Stream.Position = 0;
204-
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponseV3_BoolFlags>(Stream);
204+
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponseV3_BoolFlags>(Stream);
205205
//}
206206

207207
//[Benchmark]
208208
//public void Version8_String_ConverterWithSpan()
209209
//{
210210
// Stream.Position = 0;
211-
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponseV3_Span>(Stream);
211+
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponseV3_Span>(Stream);
212212
//}
213213

214214
//[Benchmark]
215215
//public void Version8_SourceWithoutUsingContext()
216216
//{
217217
// Stream.Position = 0;
218-
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponseV4>(Stream);
218+
// _ = AlphaClient.RequestResponseSerializer.Deserialize<Elastic.Clients.Elasticsearch.Cluster.HealthResponseV4>(Stream);
219219
//}
220220

221221
//[Benchmark]
222222
//public void Version8_SourceDirect()
223223
//{
224224
// Stream.Position = 0;
225-
// _ = JsonSerializer.Deserialize(Stream, Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponseV4Context.Default.ClusterHealthResponseV4);
225+
// _ = JsonSerializer.Deserialize(Stream, Elastic.Clients.Elasticsearch.Cluster.HealthResponseV4Context.Default.HealthResponseV4);
226226
//}
227227
}
228228

benchmarks/Profiling/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
//var observer = bulkAll.Wait(TimeSpan.FromMinutes(1), n => { });
3333

34-
_ = await alphaClient.RequestResponseSerializer.DeserializeAsync<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponse>(stream);
34+
_ = await alphaClient.RequestResponseSerializer.DeserializeAsync<Elastic.Clients.Elasticsearch.Cluster.HealthResponse>(stream);
3535

3636
MemoryProfiler.ForceGc();
3737

@@ -47,7 +47,7 @@
4747

4848
//observer = bulkAll.Wait(TimeSpan.FromMinutes(1), n => { });
4949

50-
var result = await alphaClient.RequestResponseSerializer.DeserializeAsync<Elastic.Clients.Elasticsearch.Cluster.ClusterHealthResponse>(stream);
50+
var result = await alphaClient.RequestResponseSerializer.DeserializeAsync<Elastic.Clients.Elasticsearch.Cluster.HealthResponse>(stream);
5151

5252
MemoryProfiler.GetSnapshot();
5353

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareContractResolver.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,31 @@ private void ApplyPropertyOverrides(MemberInfo member, JsonProperty property)
6464

6565
private static void ApplyShouldSerializer(JsonProperty property)
6666
{
67-
if (property.PropertyType == typeof(QueryContainer))
68-
property.ShouldSerialize = o => ShouldSerializeQueryContainer(o, property);
69-
else if (property.PropertyType == typeof(IEnumerable<QueryContainer>))
70-
property.ShouldSerialize = o => ShouldSerializeQueryContainers(o, property);
67+
if (property.PropertyType == typeof(Query))
68+
property.ShouldSerialize = o => ShouldSerializeQuery(o, property);
69+
else if (property.PropertyType == typeof(IEnumerable<Query>))
70+
property.ShouldSerialize = o => ShouldSerializeQuerys(o, property);
7171
}
7272

73-
private static bool ShouldSerializeQueryContainer(object o, JsonProperty prop)
73+
private static bool ShouldSerializeQuery(object o, JsonProperty prop)
7474
{
7575
if (o == null)
7676
return false;
77-
if (prop.ValueProvider.GetValue(o) is not QueryContainer q)
77+
if (prop.ValueProvider.GetValue(o) is not Query q)
7878
return false;
7979
//return q.IsWritable;
8080
return true;
8181
}
8282

83-
private static bool ShouldSerializeQueryContainers(object o, JsonProperty prop)
83+
private static bool ShouldSerializeQuerys(object o, JsonProperty prop)
8484
{
8585
if (o == null)
8686
return false;
87-
if (prop.ValueProvider.GetValue(o) is not IEnumerable<QueryContainer> q)
87+
if (prop.ValueProvider.GetValue(o) is not IEnumerable<Query> q)
8888
return false;
8989

90-
var queryContainers = q as QueryContainer[] ?? q.ToArray();
91-
//return queryContainers.Any(qq => qq != null && ((QueryContainer)qq).IsWritable);
90+
var queryContainers = q as Query[] ?? q.ToArray();
91+
//return queryContainers.Any(qq => qq != null && ((Query)qq).IsWritable);
9292
return queryContainers.Any(qq => qq != null);
9393
}
9494
}

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/HandleNestTypesOnSourceJsonConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class HandleNestTypesOnSourceJsonConverter : JsonConverter
1818
private static readonly HashSet<Type> NestTypesThatCanAppearInSource = new()
1919
{
2020
typeof(JoinField),
21-
typeof(QueryContainer),
21+
typeof(Query),
2222
//typeof(CompletionField),
2323
//typeof(Attachment),
2424
typeof(LazyJson),

src/Elastic.Clients.Elasticsearch/Api/AsyncSearch/AsyncSearchSubmitRequest.cs renamed to src/Elastic.Clients.Elasticsearch/Api/AsyncSearch/SubmitAsyncSearchRequest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77

88
namespace Elastic.Clients.Elasticsearch.AsyncSearch;
99

10-
public partial class AsyncSearchSubmitRequest
10+
public partial class SubmitAsyncSearchRequest
1111
{
1212
// Any request may contain aggregations so we force typed_keys in order to successfully deserialise them.
1313
internal override void BeforeRequest() => TypedKeys = true;
1414
}
1515

16-
public sealed partial class AsyncSearchSubmitRequestDescriptor
16+
public sealed partial class SubmitAsyncSearchRequestDescriptor
1717
{
18-
public AsyncSearchSubmitRequestDescriptor MatchAll(Action<MatchAllQueryDescriptor>? selector = null) => selector is null ? Query(q => q.MatchAll()) : Query(q => q.MatchAll(selector));
18+
public SubmitAsyncSearchRequestDescriptor MatchAll(Action<MatchAllQueryDescriptor>? selector = null) => selector is null ? Query(q => q.MatchAll()) : Query(q => q.MatchAll(selector));
1919

2020
internal override void BeforeRequest() => TypedKeys(true);
2121
}
2222

23-
public sealed partial class AsyncSearchSubmitRequestDescriptor<TDocument>
23+
public sealed partial class SubmitAsyncSearchRequestDescriptor<TDocument>
2424
{
25-
public AsyncSearchSubmitRequestDescriptor<TDocument> MatchAll()
25+
public SubmitAsyncSearchRequestDescriptor<TDocument> MatchAll()
2626
{
2727
Query(new MatchAllQuery());
2828
return Self;

src/Elastic.Clients.Elasticsearch/Api/CountRequest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public CountRequestDescriptor Index(Indices indices)
3131
return Self;
3232
}
3333

34-
public CountRequestDescriptor Query(Func<QueryContainerDescriptor, QueryContainer> configure)
34+
public CountRequestDescriptor Query(Func<QueryDescriptor, Query> configure)
3535
{
36-
var container = configure?.Invoke(new QueryContainerDescriptor());
36+
var container = configure?.Invoke(new QueryDescriptor());
3737
QueryValue = container;
3838
return Self;
3939
}

src/Elastic.Clients.Elasticsearch/Api/Eql/GetEqlResponse.cs renamed to src/Elastic.Clients.Elasticsearch/Api/Eql/EqlGetResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Elastic.Clients.Elasticsearch.Eql;
99

10-
public partial class GetEqlResponse<TEvent>
10+
public partial class EqlGetResponse<TEvent>
1111
{
1212
private IReadOnlyCollection<HitsEvent<TEvent>> _events;
1313
private IReadOnlyCollection<HitsSequence<TEvent>> _sequences;

src/Elastic.Clients.Elasticsearch/Api/SourceRequest.cs renamed to src/Elastic.Clients.Elasticsearch/Api/GetSourceRequestDescriptor.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44

55
namespace Elastic.Clients.Elasticsearch;
66

7-
// TODO - Should be added as a rule to the descriptor generator
8-
//public sealed partial class SourceRequestDescriptor<TDocument>
9-
//{
10-
// public SourceRequestDescriptor(TDocument documentWithId, IndexName index = null, Id id = null) : this(index ?? typeof(TDocument), id ?? Id.From(documentWithId)) => Doc
11-
//}
12-
13-
public partial class SourceRequestDescriptor
7+
public partial class GetSourceRequestDescriptor
148
{
159
/// <summary>
1610
/// A shortcut into calling Index(typeof(TOther)).
1711
/// </summary>
18-
public SourceRequestDescriptor Index<TOther>()
12+
public GetSourceRequestDescriptor Index<TOther>()
1913
{
2014
RouteValues.Required("index", (IndexName)typeof(TOther));
2115
return Self;

src/Elastic.Clients.Elasticsearch/Api/SourceResponse.cs renamed to src/Elastic.Clients.Elasticsearch/Api/GetSourceResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Elastic.Clients.Elasticsearch;
1010

11-
public partial class SourceResponse<TDocument> : ISelfDeserializable
11+
public partial class GetSourceResponse<TDocument> : ISelfDeserializable
1212
{
1313
public TDocument Body { get; set; }
1414

src/Elastic.Clients.Elasticsearch/Api/IndexManagement/MappingResponse.cs renamed to src/Elastic.Clients.Elasticsearch/Api/IndexManagement/GetMappingResponse.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
namespace Elastic.Clients.Elasticsearch.IndexManagement;
99

10-
public partial class MappingResponse
10+
public partial class GetMappingResponse
1111
{
1212
public IReadOnlyDictionary<IndexName, IndexMappingRecord> Indices => BackingDictionary;
1313
}
1414

1515
public static class GetMappingResponseExtensions
1616
{
17-
public static TypeMapping GetMappingFor<T>(this MappingResponse response) => response.GetMappingFor(typeof(T));
17+
public static TypeMapping GetMappingFor<T>(this GetMappingResponse response) => response.GetMappingFor(typeof(T));
1818

19-
public static TypeMapping GetMappingFor(this MappingResponse response, IndexName index)
19+
public static TypeMapping GetMappingFor(this GetMappingResponse response, IndexName index)
2020
{
2121
if (index.IsNullOrEmpty())
2222
return null;

0 commit comments

Comments
 (0)