使用nest client 7.2.1连接到azure中的elastic db内部负载均衡器。
异常:无法为报警事件创建数据库索引。从HEAD上的不成功(401)低级调用生成的无效NEST响应:/ #该API调用的审计跟踪:- [1] BadResponse:节点:http://192.168.0.4:9200/PipelineException Took:00:00:00.0506796 # OriginalException:搜索引擎异常:无法使用指定的节点进行身份验证。请尝试验证您的凭据或检查您的Shield配置。调用:状态代码401来自:HEAD / ---〉Elasticsearch.Net.PipelineException:无法使用指定的节点进行身份验证。请尝试验证您的凭据或检查您的Shield配置。at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails详细信息,IElasticsearchResponse响应)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 method,String path,PostData data,请求参数请求参数)#请求:#响应:PUT上的不成功(401)低级调用:/asx-sleepquality #本次API调用的审计线索:- [1] BadResponse:节点:http://192.168.0.4:9200/PipelineException Took:00:00:00.4294201 # OriginalException:搜索引擎异常:无法使用指定的节点进行身份验证。请尝试验证您的凭据或检查您的Shield配置。调用:状态代码401来自:PUT /asx-sleepquality. ServerError:类型:security_exception原因:“缺少REST请求的身份验证凭据[/asx-sleepquality]”---〉Elasticsearch.Net.PipelineException:无法使用指定的节点进行身份验证。请尝试验证您的凭据或检查您的Shield配置。at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails详细信息,IElasticsearchResponse响应)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 method,String path,PostData data,请求参数请求参数)#请求:#响应:
const string Url = "http://192.168.0.4:9200";
var settings = new ConnectionSettings(new Uri(Url));
ElasticSearchClient = new ElasticClient(settings);
var indexes = GetAsxIndexes();
var response = ElasticSearchClient.Ping().DebugInformation;
3条答案
按热度按时间vecaoik11#
下面的代码解决了我的问题
gcxthw6b2#
您正在尝试根据错误消息向启用了安全性的Elasticsearch集群发出请求
无法使用指定的节点进行身份验证。请尝试验证您的凭据或检查您的Shield配置。调用:状态代码401来自:头部/
您需要在
ConnectionSettings
中提供身份验证凭据以供客户机使用kgsdhlau3#
当我启用细粒度访问控制时,我遇到了错误401。使用AwsSigV4HttpConnection对请求进行签名对我有效。参考:https://opensearch.org/blog/aws-sigv4-support-for-clients/