We have a cluster running Elasticsearch v5.0.0. Recently active directory functionality is turn on in ES so, the way connection string was written earlier it is not working and giving following error when perform Search/ Insert operation from .NET client. Could anyone give suggestion in what way the connection string should be written to authenticate with AD.
connectionPool = new StaticConnectionPool(nodes);
connectionSettings = new ConnectionSettings(connectionPool);
elasticClient = new ElasticClient(connectionSettings);
Error:
Invalid NEST response built from a unsuccessful low level call on POST: /twitter/boo/_search
OriginalException: Elasticsearch.Net.ElasticsearchClientException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node.
at Elasticsearch.Net.RequestPipeline.Ping(Node node) in C:\code\elasticsearch-net\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 247
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Ping(Node node) in C:\code\elasticsearch-net\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 254
at Elasticsearch.Net.Transport1.Ping(IRequestPipeline pipeline, Node node) in C:\code\elasticsearch-net\src\Elasticsearch.Net\Transport\Transport.cs:line 179 at Elasticsearch.Net.Transport1.Request[TReturn](HttpMethod method, String path, PostData`1 data, IRequestParameters requestParameters) in C:\code\elasticsearch-net\src\Elasticsearch.Net\Transport\Transport.cs:line 67
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
Audit exception in step 1 PingFailure:
Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node.
at Elasticsearch.Net.RequestPipeline.Ping(Node node) in C:\code\elasticsearch-net\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 247
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.>
It looks like you're just using Basic Authentication and sending the username/password as part of the URI. Have you tried
using Elasticsearch.Net;
using Nest;
var nodes = new [] {
new Uri("http://1.2.3.4:9200/")
};
var connectionPool = new StaticConnectionPool(nodes);
var connectionSettings = new ConnectionSettings(connectionPool)
.BasicAuthentication("username", "password");
var elasticClient = new ElasticClient(connectionSettings);
Since you only have a single node, you can also use SingleNodeConnectionPool
var connectionPool = new SingleNodeConnectionPool(new Uri("http://1.2.3.4:9200/"));
Can you tell me why "StaticConnectionPool" cannot working after activating Active Directory? Because earlier when AD was not active single node with "StaticConnectionPool" was working.
Did you try using .BasicAuthentication() on ConnectionSettings?
By enabling Active Directory, have firewall settings on the machine been changed?
To rule out it being any issue with NEST, can you ping the cluster from the machine that is using NEST to connect to Elasticsearch, to see if the cluster can be reached. Use curl or PowerShell's Invoke-RestMethod for this.
Yes. Username and Password is passed there. And ping is working cluster can be rechable.
But this is not working with multiple node connection pooling. Using SingleNodeConnectionPoll can connect one node. But I need connection with fail over. That is not working with the above code in the first that I posted.
connectionPool = new StaticConnectionPool(nodes);
connectionSettings = new ConnectionSettings(connectionPool).BasicAuthentication("johndoe", "123456").DisablePing();
elasticClient = new ElasticClient(connectionSettings);
return elasticClient;
In the above code if I disable Ping, it is working. Can this be a solution?
Any idea why ping causing issue?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.