gpt4 book ai didi

elasticsearch - Elasticsearch + Nest:在MultiGetRequests中忽略错误

转载 作者:行者123 更新时间:2023-12-02 22:57:42 31 4
gpt4 key购买 nike

在一个应用程序中,我使用索引别名“my_alias”按ID(“doc1”和“doc2”)查询2个文档

var multiGetRequest = new MultiGetRequest
{
Documents = new [] {
new MultiGetOperation<Product>("doc1") {Index = "my_alias" },
new MultiGetOperation<Product>("doc2") {Index = "my_alias" }
}

};

var result = client.MultiGet(multiGetRequest);
if (!response.IsValid){
throw new Exception();
}

var documents = result.Documents;

一切都很好,直到有人在Elasticsearch中弄乱别名并将第二个索引添加到别名为止。新索引还包含ID为“doc1”和“doc2”的文档。

立即使用MultiGet将导致
Alias [,y_alias] has more than one indices associated 
with it [[demo_index, demo_index2]], can't execute a single index op"

这是预期的-但是在使用MultiGet操作时如何捕获错误?

上面的代码仍然可以执行,没有任何错误,但是现在返回 没有结果

任何提示表示赞赏!

最佳答案

这是NEST中的错误。

当前,客户端不会在error数组中的项目上反序列化docs属性,此外,在确定响应是否有效时,不会考虑这些因素。 I've opened an issue to address this.

关于elasticsearch - Elasticsearch + Nest:在MultiGetRequests中忽略错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46682274/

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