Invalid NEST response built from a unsuccessful (401) low level call on HEAD: /
Audit trail of this API call:
- [1] BadResponse: Node: http://es.test.dev/ Exception: PipelineException Took: 00:00:00.1126819
OriginalException: Elasticsearch.Net.ElasticsearchClientException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration.. Call: Status code 401 from: HEAD / ---> Elasticsearch.Net.PipelineException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration.
at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails details, IElasticsearchResponse response)
at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData requestData)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
--- End of inner exception stack trace ---
Audit exception in step 1 BadResponse:
Elasticsearch.Net.PipelineException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration.
at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails details, IElasticsearchResponse response)
at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData requestData)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
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.>
public ElasticClient EsClient()
{
var nodes = new Uri[]
{
new Uri($"{_settings.ServerUrl}"),
};
var connectionPool = new StaticConnectionPool(nodes);
var elasticClient = new ElasticClient(new ConnectionSettings(connectionPool)
.DisableDirectStreaming()
.BasicAuthentication(_settings.ServerUser, _settings.ServerPassword)
.DisablePing());
var resp = elasticClient.Ping().DebugInformation;
return elasticClient;
}