Could not connect to Elasticsearch: Could not create SSL/TLS secure channel

Hi Team,
I am unable to connect to my elasticsearch URL using
.NET runtime is 4.6.2
ES .NET client is 8.13.8
Elasticsearch 8.12.2
Kibana 8.12.2

The error i got is
Invalid Elasticsearch response built from a unsuccessful () low level call on POST: /search-ocr-poc/_search Exception: The request was aborted: Could not create SSL/TLS secure channel. Call: Status code unknown

here are my code snippets:

public async Task<ElasticsearchDocs> SearchDocumentsByContent()
{
	var settings = new ElasticsearchClientSettings(new Uri("https://localhost:9200"))
		.CertificateFingerprint("79:5B:70:9A:3A:0F:70:EE:69:F1:23:20:A5:D7:3C:49:C2:46:5A:5D:FC:F4:E1:C1:3A:92:8C:EF:4C:6E:6C:2E")
		.Authentication(new BasicAuthentication("elastic", "password"));


	var client = new ElasticsearchClient(settings);

	var request = new SearchRequest("search-ocr-poc")
	{
		From = 0,
		Size = 100,
		Query = new TermQuery("title") { Value = "All Drafts Documents" }
	};

	var response = await client.SearchAsync<ElasticsearchDocs>(request);
	ElasticsearchDocs esDocs = new ElasticsearchDocs();

	if (response.IsValidResponse)
	{
		esDocs = response.Documents.FirstOrDefault();
	}
	return esDocs;
}

i can get result from https://localhost:9200/search-ocr-poc/_search and i gotten my CA fingerprints from running this command openssl x509 -fingerprint -sha256 -in /mnt/c/ElasticSearch/elasticsearch-8.12.2/config/certs/http_ca.crt and the output is

sha256 Fingerprint=79:5B:70:9A:3A:0F:70:EE:69:F1:23:20:A5:D7:3C:49:C2:46:5A:5D:FC:F4:E1:C1:3A:92:8C:EF:4C:6E:6C:2E
-----BEGIN CERTIFICATE-----
MIIFWjCCA0KgAwIBAgIVAMY/07s97pRdC1IWwwAUNA7FvPSWMA0GCSqGSIb3DQEB
CwUAMDwxOjA4BgNVBAMTMUVsYXN0aWNzZWFyY2ggc2VjdXJpdHkgYXV0by1jb25m
aWd1cmF0aW9uIEhUVFAgQ0EwHhcNMjQwMjI3MDYyNDU0WhcNMjcwMjI2MDYyNDU0
WjA8MTowOAYDVQQD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D/oTEwZIsf+fEuUQKfVVAyKeP28
ejv9HVZSrk4KzTXcrvuRPW0u8tIHZHfWHAW8izRgojZwRSF8IUiR87s+p7pI0GnZ
diNp+rWkYyIWQKlj1ya4x3Hu5BU1gcQhWSDl/x3V2G1vcGBgrkMAQCPBb4xCmDJR
3rXukTJnUJrBYqJgbeIbxxrJw14mUeuELsaK3PfFcKmOpwB8SmWEDFYYJOyu8Rom
JHn9Z8pBz1LYqKVBZFK1LSY8kv8W+mLcnSH+M6wLcf2mzRHzxVQ+r2bQczfXq8xb
+DxR6ArSEb1BbNOrYNxsdZwPflH2g28AccG/JbJXAt8b6wIYMBPr3U2fneLQoE88
pxYOzT6mjkizvbCH0m2KJyEQw9nGJlY+tHTapE22PccW81fpSw1kKKprC+FnexAr
nm1uiT+gEJWumKdESIGByOCDZOk8ICtu9CGNvbujbN5CC47NUmzWhwa7gLNP0gFO
RPw/LoOp5g4yiZSwbAv9S0YEcAjGVmmQhozN7tNpyKmFWbpwF79/zhIyzb2xvAIL
5/hbPJw06aSX0m8755yBzWx9+RAhzuUinFU3q/sG
-----END CERTIFICATE-----

i realised .NET 7.x can use NEST but .NET 8.x theres no NEST. whats the different between the 2 ?

Thanks for any assistance

Hi @hiilmiee,

could you please provide the complete call stack of the exception?

i realised .NET 7.x can use NEST but .NET 8.x theres no NEST. whats the different between the 2 ?

You can use NEST with net7, because it targets netstandard2.0 which is compatible, but I would highly recommend to go for the Elastic.Clients.Elasticsearch client. NEST is deprecated and will reach end of life at the end of the year. Besides that, NEST only connects in backwards compatibility mode to Elasticsearch 8 servers, while the new client provides a lot more functionality.