Skip to content

[Backport 8.5] Respond to Elastic.Transport changes #6943

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
Nov 9, 2022
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
12 changes: 6 additions & 6 deletions benchmarks/Benchmarks/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1"
"System.Text.Json": "6.0.0"
}
},
"Elasticsearch.Net": {
Expand Down Expand Up @@ -1035,8 +1035,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0"
Expand Down Expand Up @@ -1195,7 +1195,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/Profiling/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1"
"System.Text.Json": "6.0.0"
}
},
"Microsoft.Build.Tasks.Git": {
Expand Down Expand Up @@ -121,8 +121,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0"
Expand All @@ -131,7 +131,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class HandleNestTypesOnSourceJsonConverter : JsonConverter
};

private readonly Serializer _builtInSerializer;
private readonly IMemoryStreamFactory _memoryStreamFactory;
private readonly MemoryStreamFactory _memoryStreamFactory;

public HandleNestTypesOnSourceJsonConverter(Serializer builtInSerializer, IMemoryStreamFactory memoryStreamFactory
public HandleNestTypesOnSourceJsonConverter(Serializer builtInSerializer, MemoryStreamFactory memoryStreamFactory
)
{
_builtInSerializer = builtInSerializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class JTokenExtensions
/// <summary>
/// Writes a <see cref="JToken" /> to a <see cref="MemoryStream" /> using <see cref="ConnectionSettingsAwareSerializer.ExpectedEncoding" />
/// </summary>
public static MemoryStream ToStream(this JToken token, IMemoryStreamFactory memoryStreamFactory)
public static MemoryStream ToStream(this JToken token, MemoryStreamFactory memoryStreamFactory)
{
var ms = memoryStreamFactory.Create();
using (var streamWriter = new StreamWriter(ms, ConnectionSettingsAwareSerializer.ExpectedEncoding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1",
"System.Text.Json": "6.0.0",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
Expand Down Expand Up @@ -128,8 +128,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0"
Expand All @@ -143,7 +143,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
},
Expand Down Expand Up @@ -183,13 +183,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1",
"System.Text.Json": "6.0.0",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
Expand Down Expand Up @@ -303,8 +303,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
"System.Buffers": "4.5.1",
Expand Down Expand Up @@ -332,7 +332,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
},
Expand Down Expand Up @@ -381,13 +381,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1",
"System.Text.Json": "6.0.0",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
Expand Down Expand Up @@ -506,8 +506,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
"System.Buffers": "4.5.1",
Expand All @@ -529,7 +529,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
},
Expand Down Expand Up @@ -569,13 +569,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1",
"System.Text.Json": "6.0.0",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
Expand Down Expand Up @@ -686,8 +686,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
"System.Buffers": "4.5.1",
Expand All @@ -709,7 +709,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
},
Expand Down Expand Up @@ -749,13 +749,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1"
"System.Text.Json": "6.0.0"
}
},
"Microsoft.Build.Tasks.Git": {
Expand Down Expand Up @@ -839,8 +839,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0"
Expand All @@ -849,7 +849,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
},
Expand Down Expand Up @@ -889,13 +889,13 @@
},
"Elastic.Transport": {
"type": "Transitive",
"resolved": "0.3.2",
"contentHash": "saT+26tm2xsXEbCnZHP0bsQNUQbWrLQ2J9tlzAnxPHKsrnNbcuegNDTfZy8GJdrQNbg4tsnLerzThgkU8rYHbA==",
"resolved": "0.4.0",
"contentHash": "4uqaeeZOboqs8nSvYnQXnGOSTyPo4SvV4NH3o+Ls3OEV1d9VipYS09/8/DcmcklK7hWuQXhrdsQd1b6Vi0a//w==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "5.0.1",
"System.Text.Json": "6.0.1"
"System.Text.Json": "6.0.0"
}
},
"Microsoft.Build.Tasks.Git": {
Expand Down Expand Up @@ -979,8 +979,8 @@
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
"resolved": "6.0.0",
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0"
Expand All @@ -989,7 +989,7 @@
"elastic.clients.elasticsearch": {
"type": "Project",
"dependencies": {
"Elastic.Transport": "[0.3.2, )"
"Elastic.Transport": "[0.4.0, )"
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/Elastic.Clients.Elasticsearch/Api/BulkRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ namespace Elastic.Clients.Elasticsearch;

public partial class BulkRequest : IStreamSerializable
{
internal IRequest Self => this;
internal Request Self => this;

public BulkOperationsCollection Operations { get; set; }

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

protected override string Accept => "application/json";
internal override string Accept => "application/json";

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

var index = Self.RouteValues.Get<IndexName>("index");
var index = RouteValues.Get<IndexName>("index");

foreach (var op in Operations)
{
Expand All @@ -48,7 +48,7 @@ public async Task SerializeAsync(Stream stream, IElasticsearchClientSettings set
if (Operations is null)
return;

var index = Self.RouteValues.Get<IndexName>("index");
var index = RouteValues.Get<IndexName>("index");

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

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

protected override string Accept => "application/json";
internal override string Accept => "application/json";

private readonly BulkOperationsCollection _operations = new();

Expand Down
6 changes: 3 additions & 3 deletions src/Elastic.Clients.Elasticsearch/Api/IndexRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public IndexRequest() : this(typeof(TDocument)) { }

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

internal IRequest<IndexRequestParameters> Self => this;
internal Request<IndexRequestParameters> Self => this;

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

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

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

public sealed partial class IndexRequestDescriptor<TDocument> : ICustomJsonWriter
Expand Down
Loading