首页 > 解决方案 > Elasticsearch .NET DocumentExists() 返回错误:从 HEAD 上的不成功 (200) 低级别调用构建的无效 NEST 响应

问题描述

我有一个文档已经存在于下面的弹性索引中

在此处输入图像描述

这是我的 C# 代码,用于检查此文档是否存在:

ExistsResponse existsResponse = await _elasticClient.DocumentExistsAsync<T>(type.Id, d => 
                d.Index(index));

但是,每当程序运行到该行时,它总是返回一个带有无效 NEST 响应的错误:(我用 xxxx 将我的节点域地址变灰)

Invalid NEST response built from a unsuccessful (200) low level call on HEAD: /purchaseorders_test/_doc/PO1Z74FVF4
# Audit trail of this API call:
 - [1] BadResponse: Node: https://xxxxxxxxx/ Took: 00:00:00.3388193
# OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 200 from: HEAD /purchaseorders_test/_doc/PO1Z74FVF4
# 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:

我已经设置好DisableDirectStreamingConnectionSettings,但他们似乎没有解决任何问题

    var settings = new ConnectionSettings(new Uri(url))
                .DefaultIndex(defaultIndex).BasicAuthentication("elastic", "xxxxxxx").DisableDirectStreaming();



 var client = new ElasticClient(settings);

我使用的 Elastic NUGET 版本是Elasticsearch.Net 7.13.0

我不知道如何解决这个问题,有人可以帮我解决这个问题吗?

标签: elasticsearch

解决方案


推荐阅读