Skip to content

Commit 0d38d47

Browse files
Respond to Elastic.Transport changes (#6937) (#6940)
* Respond to transport changes * Add transport directly * Response and ApiCallDetails refactoring * Update tests * Fix request types * Refactoring transport to abstract types * Remove IRequestParameters * Remove ITransport * Remove IProduceRegistration * Finalise changes Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent 73c9105 commit 0d38d47

File tree

226 files changed

+1703
-1763
lines changed

Some content is hidden

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

226 files changed

+1703
-1763
lines changed

benchmarks/Benchmarks/packages.lock.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@
6767
},
6868
"Elastic.Transport": {
6969
"type": "Transitive",
70-
"resolved": "0.3.2",
71-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
70+
"resolved": "0.4.0",
71+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
7272
"dependencies": {
7373
"Microsoft.CSharp": "4.7.0",
7474
"System.Buffers": "4.5.1",
7575
"System.Diagnostics.DiagnosticSource": "5.0.1",
76-
"System.Text.Json": "6.0.1"
76+
"System.Text.Json": "6.0.0"
7777
}
7878
},
7979
"Elasticsearch.Net": {
@@ -1035,8 +1035,8 @@
10351035
},
10361036
"System.Text.Json": {
10371037
"type": "Transitive",
1038-
"resolved": "6.0.1",
1039-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
1038+
"resolved": "6.0.0",
1039+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
10401040
"dependencies": {
10411041
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
10421042
"System.Text.Encodings.Web": "6.0.0"
@@ -1195,7 +1195,7 @@
11951195
"elastic.clients.elasticsearch": {
11961196
"type": "Project",
11971197
"dependencies": {
1198-
"Elastic.Transport": "[0.3.2, )"
1198+
"Elastic.Transport": "[0.4.0, )"
11991199
}
12001200
}
12011201
}

benchmarks/Profiling/packages.lock.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
},
3232
"Elastic.Transport": {
3333
"type": "Transitive",
34-
"resolved": "0.3.2",
35-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
34+
"resolved": "0.4.0",
35+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
3636
"dependencies": {
3737
"Microsoft.CSharp": "4.7.0",
3838
"System.Buffers": "4.5.1",
3939
"System.Diagnostics.DiagnosticSource": "5.0.1",
40-
"System.Text.Json": "6.0.1"
40+
"System.Text.Json": "6.0.0"
4141
}
4242
},
4343
"Microsoft.Build.Tasks.Git": {
@@ -121,8 +121,8 @@
121121
},
122122
"System.Text.Json": {
123123
"type": "Transitive",
124-
"resolved": "6.0.1",
125-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
124+
"resolved": "6.0.0",
125+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
126126
"dependencies": {
127127
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
128128
"System.Text.Encodings.Web": "6.0.0"
@@ -131,7 +131,7 @@
131131
"elastic.clients.elasticsearch": {
132132
"type": "Project",
133133
"dependencies": {
134-
"Elastic.Transport": "[0.3.2, )"
134+
"Elastic.Transport": "[0.4.0, )"
135135
}
136136
}
137137
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public class HandleNestTypesOnSourceJsonConverter : JsonConverter
2828
};
2929

3030
private readonly Serializer _builtInSerializer;
31-
private readonly IMemoryStreamFactory _memoryStreamFactory;
31+
private readonly MemoryStreamFactory _memoryStreamFactory;
3232

33-
public HandleNestTypesOnSourceJsonConverter(Serializer builtInSerializer, IMemoryStreamFactory memoryStreamFactory
33+
public HandleNestTypesOnSourceJsonConverter(Serializer builtInSerializer, MemoryStreamFactory memoryStreamFactory
3434
)
3535
{
3636
_builtInSerializer = builtInSerializer;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal static class JTokenExtensions
1414
/// <summary>
1515
/// Writes a <see cref="JToken" /> to a <see cref="MemoryStream" /> using <see cref="ConnectionSettingsAwareSerializer.ExpectedEncoding" />
1616
/// </summary>
17-
public static MemoryStream ToStream(this JToken token, IMemoryStreamFactory memoryStreamFactory)
17+
public static MemoryStream ToStream(this JToken token, MemoryStreamFactory memoryStreamFactory)
1818
{
1919
var ms = memoryStreamFactory.Create();
2020
using (var streamWriter = new StreamWriter(ms, ConnectionSettingsAwareSerializer.ExpectedEncoding,

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/packages.lock.json

+36-36
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
},
3838
"Elastic.Transport": {
3939
"type": "Transitive",
40-
"resolved": "0.3.2",
41-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
40+
"resolved": "0.4.0",
41+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
4242
"dependencies": {
4343
"Microsoft.CSharp": "4.7.0",
4444
"System.Buffers": "4.5.1",
4545
"System.Diagnostics.DiagnosticSource": "5.0.1",
46-
"System.Text.Json": "6.0.1",
46+
"System.Text.Json": "6.0.0",
4747
"System.Threading.Tasks.Extensions": "4.5.4"
4848
}
4949
},
@@ -128,8 +128,8 @@
128128
},
129129
"System.Text.Json": {
130130
"type": "Transitive",
131-
"resolved": "6.0.1",
132-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
131+
"resolved": "6.0.0",
132+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
133133
"dependencies": {
134134
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
135135
"System.Text.Encodings.Web": "6.0.0"
@@ -143,7 +143,7 @@
143143
"elastic.clients.elasticsearch": {
144144
"type": "Project",
145145
"dependencies": {
146-
"Elastic.Transport": "[0.3.2, )"
146+
"Elastic.Transport": "[0.4.0, )"
147147
}
148148
}
149149
},
@@ -183,13 +183,13 @@
183183
},
184184
"Elastic.Transport": {
185185
"type": "Transitive",
186-
"resolved": "0.3.2",
187-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
186+
"resolved": "0.4.0",
187+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
188188
"dependencies": {
189189
"Microsoft.CSharp": "4.7.0",
190190
"System.Buffers": "4.5.1",
191191
"System.Diagnostics.DiagnosticSource": "5.0.1",
192-
"System.Text.Json": "6.0.1",
192+
"System.Text.Json": "6.0.0",
193193
"System.Threading.Tasks.Extensions": "4.5.4"
194194
}
195195
},
@@ -303,8 +303,8 @@
303303
},
304304
"System.Text.Json": {
305305
"type": "Transitive",
306-
"resolved": "6.0.1",
307-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
306+
"resolved": "6.0.0",
307+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
308308
"dependencies": {
309309
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
310310
"System.Buffers": "4.5.1",
@@ -332,7 +332,7 @@
332332
"elastic.clients.elasticsearch": {
333333
"type": "Project",
334334
"dependencies": {
335-
"Elastic.Transport": "[0.3.2, )"
335+
"Elastic.Transport": "[0.4.0, )"
336336
}
337337
}
338338
},
@@ -381,13 +381,13 @@
381381
},
382382
"Elastic.Transport": {
383383
"type": "Transitive",
384-
"resolved": "0.3.2",
385-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
384+
"resolved": "0.4.0",
385+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
386386
"dependencies": {
387387
"Microsoft.CSharp": "4.7.0",
388388
"System.Buffers": "4.5.1",
389389
"System.Diagnostics.DiagnosticSource": "5.0.1",
390-
"System.Text.Json": "6.0.1",
390+
"System.Text.Json": "6.0.0",
391391
"System.Threading.Tasks.Extensions": "4.5.4"
392392
}
393393
},
@@ -506,8 +506,8 @@
506506
},
507507
"System.Text.Json": {
508508
"type": "Transitive",
509-
"resolved": "6.0.1",
510-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
509+
"resolved": "6.0.0",
510+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
511511
"dependencies": {
512512
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
513513
"System.Buffers": "4.5.1",
@@ -529,7 +529,7 @@
529529
"elastic.clients.elasticsearch": {
530530
"type": "Project",
531531
"dependencies": {
532-
"Elastic.Transport": "[0.3.2, )"
532+
"Elastic.Transport": "[0.4.0, )"
533533
}
534534
}
535535
},
@@ -569,13 +569,13 @@
569569
},
570570
"Elastic.Transport": {
571571
"type": "Transitive",
572-
"resolved": "0.3.2",
573-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
572+
"resolved": "0.4.0",
573+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
574574
"dependencies": {
575575
"Microsoft.CSharp": "4.7.0",
576576
"System.Buffers": "4.5.1",
577577
"System.Diagnostics.DiagnosticSource": "5.0.1",
578-
"System.Text.Json": "6.0.1",
578+
"System.Text.Json": "6.0.0",
579579
"System.Threading.Tasks.Extensions": "4.5.4"
580580
}
581581
},
@@ -686,8 +686,8 @@
686686
},
687687
"System.Text.Json": {
688688
"type": "Transitive",
689-
"resolved": "6.0.1",
690-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
689+
"resolved": "6.0.0",
690+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
691691
"dependencies": {
692692
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
693693
"System.Buffers": "4.5.1",
@@ -709,7 +709,7 @@
709709
"elastic.clients.elasticsearch": {
710710
"type": "Project",
711711
"dependencies": {
712-
"Elastic.Transport": "[0.3.2, )"
712+
"Elastic.Transport": "[0.4.0, )"
713713
}
714714
}
715715
},
@@ -749,13 +749,13 @@
749749
},
750750
"Elastic.Transport": {
751751
"type": "Transitive",
752-
"resolved": "0.3.2",
753-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
752+
"resolved": "0.4.0",
753+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
754754
"dependencies": {
755755
"Microsoft.CSharp": "4.7.0",
756756
"System.Buffers": "4.5.1",
757757
"System.Diagnostics.DiagnosticSource": "5.0.1",
758-
"System.Text.Json": "6.0.1"
758+
"System.Text.Json": "6.0.0"
759759
}
760760
},
761761
"Microsoft.Build.Tasks.Git": {
@@ -839,8 +839,8 @@
839839
},
840840
"System.Text.Json": {
841841
"type": "Transitive",
842-
"resolved": "6.0.1",
843-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
842+
"resolved": "6.0.0",
843+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
844844
"dependencies": {
845845
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
846846
"System.Text.Encodings.Web": "6.0.0"
@@ -849,7 +849,7 @@
849849
"elastic.clients.elasticsearch": {
850850
"type": "Project",
851851
"dependencies": {
852-
"Elastic.Transport": "[0.3.2, )"
852+
"Elastic.Transport": "[0.4.0, )"
853853
}
854854
}
855855
},
@@ -889,13 +889,13 @@
889889
},
890890
"Elastic.Transport": {
891891
"type": "Transitive",
892-
"resolved": "0.3.2",
893-
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
892+
"resolved": "0.4.0",
893+
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
894894
"dependencies": {
895895
"Microsoft.CSharp": "4.7.0",
896896
"System.Buffers": "4.5.1",
897897
"System.Diagnostics.DiagnosticSource": "5.0.1",
898-
"System.Text.Json": "6.0.1"
898+
"System.Text.Json": "6.0.0"
899899
}
900900
},
901901
"Microsoft.Build.Tasks.Git": {
@@ -979,8 +979,8 @@
979979
},
980980
"System.Text.Json": {
981981
"type": "Transitive",
982-
"resolved": "6.0.1",
983-
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
982+
"resolved": "6.0.0",
983+
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
984984
"dependencies": {
985985
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
986986
"System.Text.Encodings.Web": "6.0.0"
@@ -989,7 +989,7 @@
989989
"elastic.clients.elasticsearch": {
990990
"type": "Project",
991991
"dependencies": {
992-
"Elastic.Transport": "[0.3.2, )"
992+
"Elastic.Transport": "[0.4.0, )"
993993
}
994994
}
995995
}

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ namespace Elastic.Clients.Elasticsearch;
1616

1717
public partial class BulkRequest : IStreamSerializable
1818
{
19-
internal IRequest Self => this;
19+
internal Request Self => this;
2020

2121
public BulkOperationsCollection Operations { get; set; }
2222

23-
protected override string ContentType => "application/x-ndjson";
23+
internal override string ContentType => "application/x-ndjson";
2424

25-
protected override string Accept => "application/json";
25+
internal override string Accept => "application/json";
2626

2727
public void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None)
2828
{
2929
if (Operations is null)
3030
return;
3131

32-
var index = Self.RouteValues.Get<IndexName>("index");
32+
var index = RouteValues.Get<IndexName>("index");
3333

3434
foreach (var op in Operations)
3535
{
@@ -48,7 +48,7 @@ public async Task SerializeAsync(Stream stream, IElasticsearchClientSettings set
4848
if (Operations is null)
4949
return;
5050

51-
var index = Self.RouteValues.Get<IndexName>("index");
51+
var index = RouteValues.Get<IndexName>("index");
5252

5353
foreach (var op in Operations)
5454
{
@@ -65,9 +65,9 @@ public async Task SerializeAsync(Stream stream, IElasticsearchClientSettings set
6565

6666
public sealed partial class BulkRequestDescriptor : IStreamSerializable
6767
{
68-
protected override string ContentType => "application/x-ndjson";
68+
internal override string ContentType => "application/x-ndjson";
6969

70-
protected override string Accept => "application/json";
70+
internal override string Accept => "application/json";
7171

7272
private readonly BulkOperationsCollection _operations = new();
7373

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public IndexRequest() : this(typeof(TDocument)) { }
2222

2323
public IndexRequest(TDocument document, IndexName index = null, Id id = null) : this(index ?? typeof(TDocument), id ?? Id.From(document)) => Document = document;
2424

25-
internal IRequest<IndexRequestParameters> Self => this;
25+
internal Request<IndexRequestParameters> Self => this;
2626

27-
[JsonIgnore] private Id? Id => Self.RouteValues.Get<Id>("id");
27+
[JsonIgnore] private Id? Id => RouteValues.Get<Id>("id");
2828

2929
void ICustomJsonWriter.WriteJson(Utf8JsonWriter writer, Serializer sourceSerializer) => SourceSerialisation.Serialize(Document, writer, sourceSerializer);
3030

3131
internal static HttpMethod GetHttpMethod(IndexRequest<TDocument> request) =>
32-
request.Id?.StringOrLongValue != null || request.Self.RouteValues.ContainsId ? HttpMethod.PUT : HttpMethod.POST;
32+
request.Id?.StringOrLongValue != null || request.RouteValues.ContainsId ? HttpMethod.PUT : HttpMethod.POST;
3333
}
3434

3535
public sealed partial class IndexRequestDescriptor<TDocument> : ICustomJsonWriter

0 commit comments

Comments
 (0)