gpt4 book ai didi

elasticsearch 在 C# Nest 客户端中的 VerifyRepositoryRequest 失败

转载 作者:行者123 更新时间:2023-12-03 02:30:45 24 4
gpt4 key购买 nike

更新到 elasticsearch 7.5.1 后,以下代码现在导致异常
“未找到入口点”

//old code worked just fine
var verifyRepositoryResponse = this.elasticClient.VerifyRepository(new VerifyRepositoryRequest("C__MYFOLDER_Backup"));

//new code throws

var verifyRepositoryResponse = this.elasticClient.Snapshot.VerifyRepository(new VerifyRepositoryRequest("C__MYFOLDER_Backup"));

请注意,通过 fiddler 提出以下请求
POST http://localhost:9200/_snapshot/C__MYFOLDER_Backup/_verify HTTP/1.1
User-Agent: Fiddler
Host: localhost:9200
Content-Type: application/json
Content-Length: 0

返回
{"nodes":{"1cWG9trDRi--6I-46lOlBw":{"name":"DESKTOP-5L01F6I"}}}

任何想法是什么导致了这里的问题?
不幸的是,关于这件事的文档为零。

更新 :
使用不存在的目录作为参数调用代码
var verifyRepositoryResponse = this.elasticClient.Snapshot.VerifyRepository(new VerifyRepositoryRequest("C__DOESNOTEXIST_Backup"));

在这种情况下,我会得到预期的 4xx 响应。
在所有测试之前,已清理存储库和数据库。

更新 :
高级错误信息:
"# FailureReason: Unrecoverable/Unexpected BadResponse while attempting POST on http://localhost:9200/_snapshot/C__MYFOLDER_Backup/_verify\r\n - [1] BadResponse: Node: http://localhost:9200/ Exception: EntryPointNotFoundException Took: 00:00:00.1859931\r\n# Audit 
exception in step 1 BadResponse:\r\nSystem.EntryPointNotFoundException: Entry point was not found.\r\n at Elasticsearch.Net.Utf8Json.IJsonFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)\r\n at Deserialize(Object[] ,
JsonReader& , IJsonFormatterResolver )\r\n at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, Int32 offset, IJsonFormatterResolver resolver)\r\n at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Stream stream,
IJsonFormatterResolver resolver)\r\n at Elasticsearch.Net.DiagnosticsSerializerProxy.Deserialize[T](Stream stream)\r\n at Elasticsearch.Net.ResponseBuilder.SetBody[TResponse](ApiCallDetails details, RequestData requestData, Stream responseStream, String
mimeType)\r\n at Elasticsearch.Net.ResponseBuilder.ToResponse[TResponse](RequestData requestData, Exception ex, Nullable`1 statusCode, IEnumerable`1 warnings, Stream responseStream, String mimeType)\r\n at
Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)\r\n at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData requestData)\r\n at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method,
String path, PostData data, IRequestParameters requestParameters)\r\n# Inner Exception: Entry point was not found.\r\nSystem.EntryPointNotFoundException: Entry point was not found.\r\n at Elasticsearch.Net.Utf8Json.IJsonFormatter`1.Deserialize(JsonReader&
reader, IJsonFormatterResolver formatterResolver)\r\n at Deserialize(Object[] , JsonReader& , IJsonFormatterResolver )\r\n at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, Int32 offset, IJsonFormatterResolver resolver)\r\n at
Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Stream stream, IJsonFormatterResolver resolver)\r\n at Elasticsearch.Net.DiagnosticsSerializerProxy.Deserialize[T](Stream stream)\r\n at
Elasticsearch.Net.ResponseBuilder.SetBody[TResponse](ApiCallDetails details, RequestData requestData, Stream responseStream, String mimeType)\r\n at Elasticsearch.Net.ResponseBuilder.ToResponse[TResponse](RequestData requestData, Exception ex, Nullable`1
statusCode, IEnumerable`1 warnings, Stream responseStream, String mimeType)\r\n at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)\r\n at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData
requestData)\r\n at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)\r\n# Exception:\r\nElasticsearch.Net.UnexpectedElasticsearchClientException: Entry point was not found. --->
System.EntryPointNotFoundException: Entry point was not found.\r\n at Elasticsearch.Net.Utf8Json.IJsonFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)\r\n at Deserialize(Object[] , JsonReader& , IJsonFormatterResolver
)\r\n at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, Int32 offset, IJsonFormatterResolver resolver)\r\n at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Stream stream, IJsonFormatterResolver resolver)\r\n at
Elasticsearch.Net.DiagnosticsSerializerProxy.Deserialize[T](Stream stream)\r\n at Elasticsearch.Net.ResponseBuilder.SetBody[TResponse](ApiCallDetails details, RequestData requestData, Stream responseStream, String mimeType)\r\n at
Elasticsearch.Net.ResponseBuilder.ToResponse[TResponse](RequestData requestData, Exception ex, Nullable`1 statusCode, IEnumerable`1 warnings, Stream responseStream, String mimeType)\r\n at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData
requestData)\r\n at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData requestData)\r\n at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)\r\n ---
End of inner exception stack trace ---\r\n at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)\r\n at
Nest.Specification.SnapshotApi.SnapshotNamespace.VerifyRepository(IVerifyRepositoryRequest request)\r\n at InforsHT.Genesis.Infrastructure.Data.Repositories.ElasticBackupAndRestoreProxy.IsBackupLocationPresent(String backupLocation) in
C:\\work\\eve\\Source\\InforsHT.Genesis.Infrastructure.Data\\Repositories\\ElasticBackupAndRestoreProxy.cs:line 44\r\n"

最佳答案

这是一个错误。 VerifyRepositoryResponseNode属性的属性是 JsonFormatterAttribute期望反序列化 IDictionary<string, CompactNodeInfo>当属性类型为 IReadOnlyDictionary<string, CompactNodeInfo> 时.这对于使用强类型格式化程序的底层 JSON 序列化程序来说是有问题的,IJsonFormatter<T> , 其中类型 T必须完全匹配。

我有 opened an issue跟踪和a pull request to fix问题。现在,您可以通过使用在高级客户端上公开的低级客户端来解决该错误

var response = client.LowLevel.Snapshot.VerifyRepository<DynamicResponse>("C__MYFOLDER_Backup");

并遍历 DynamicResponse .或者,使用 StringResponse并使用 JObject 解析或 JsonDocument并穿越。

关于elasticsearch 在 C# Nest 客户端中的 VerifyRepositoryRequest 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60062480/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com