Invalid NEST response built from a unsuccessful (401) low level call on HEAD: /

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;
        }

A 401 HTTP status code response and the accompanying audit trail indicate that the authentication details provided to the client cannot authenticate with the cluster.

Check that the credentials provided to the client in

can authenticate with the cluster. Could try the credentials with curl, PowerShell, etc. to ensure that they can authenticate as expected.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.