Invalid NEST response built from a unsuccessful
See original GitHub issueThe sample code is as follows:
var settings = new ConnectionSettings(new Uri("https://xx.xx.xxx.xxx:9200"))
.BasicAuthentication("elastic", "0fjaNokbmHSeS4kXeFV")
.DefaultIndex("people")
.RequestTimeout(TimeSpan.FromSeconds(300));
var client = new ElasticClient(settings);
var person = new Person
{
Id = 1,
FirstName = "Martijn",
LastName = "Laarman"
};
var indexResponse = client.IndexDocument(person);
if (!indexResponse.IsValid)
{
var debugInfo = indexResponse.DebugInformation;
var error = indexResponse.OriginalException;
}
environment: 1、ElasticSearch 8.0.1 2、NEST 7.17.0 3、NET 6.0
ps: Entering the account number and password through https://xx.xx.xxx.xxx:9200 can be accessed, but it cannot be accessed through the .net client, and the package error is as follows
The stack information is as follows:
Invalid NEST response built from a unsuccessful () low level call on PUT: /people/_doc/1
Audit trail of this API call:
- [1] ProductCheckOnStartup: Took: 00:00:00.6003806
- [2] ProductCheckFailure: Node: https://xx.xx.xxx.xxx:9200/ Took: 00:00:00.5720633
OriginalException: Elasticsearch.Net.ElasticsearchClientException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code unknown from: GET /
—> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.
—> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
—> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch, RemoteCertificateChainErrors
at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
— End of inner exception stack trace —
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData) --- End of inner exception stack trace --- at Elasticsearch.Net.RequestPipeline.ThrowIfTransientProductCheckFailure() at Elasticsearch.Net.RequestPipeline.Ping(Node node) at Elasticsearch.Net.Transport
1.Ping(IRequestPipeline pipeline, Node node)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
— End of inner exception stack trace —
Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Response:
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
I have exact same error using Single Node, got Certificate Fingerprint from server , connecting via the basic authentication username , password and certificate fingerprint. However no issues browsing to the endpoint (certificate is valid)
@shuangbaojun and @Sen-Gupta - The most likely cause when communicating with Elasticsearch 8.0 is that the server now starts with security enabled and HTTPS using a self-signed certificate in use by default. I have just added a short guide that covers the steps required to configure the client using the new CA fingerprint information. Please let me know if that helps you get started.