【问题标题】:Azure search FindFailedActionsToRetry returning empty actions?Azure 搜索 FindFailedActionsToRetry 返回空操作?
【发布时间】:2018-01-27 13:52:45
【问题描述】:

我正在 c# 客户端上测试 FindFailedActionsToRetry 函数以进行 azure 搜索,但没有得到预期的结果。

在我的函数中,我尝试对批处理进行索引,并且我有一个处理 IndexBatchException 的 try-catch。 我在里面做的:

var retryBatch = e.FindFailedActionsToRetry(batch, id => id["Identifier"].ToString());

我第一次编制索引时得到: 999 out of the 1000 documents failed to index(这是预期的)。

然后我尝试再次索引该批次,但没有抛出相同的 indexbatchexception(因为我故意将 merge 设置为原始 1k 文档的操作),我得到另一个异常:

The request is invalid. Details: actions : No indexing actions found in the request. Please include between 1 and 1000 indexing actions in your request.

知道为什么FindFailedActionsToRetry 函数没有返回正确的结果吗?或者我做错了什么?

编辑

为了显示更多上下文,当我展开我创建的包含IndexBatch 对象的retrybatch 对象时,我可以看到Actions。然后我进一步展开,点击结果视图,我得到:Enumeration yielded no results

我第一次发送的原始批次确实有结果。事实上,我可以看到:Action,document。动作、文档等

为什么我没有看到任何结果?

【问题讨论】:

  • 您使用的是什么版本的 SDK?在对FindFailedActionsToRetry 的调用中,id 是什么类型?
  • 我使用的是 3.0.3。我首先使用没有类型的 findfailedactionstoretry,所以我只是说“标识符”,这是我在天蓝色搜索中的关键字段。那不起作用,所以我使用了也不起作用的 Typed 版本。 id 是一个文档

标签: azure azure-cognitive-search azure-search-.net-sdk


【解决方案1】:

您正在以一种非暂时的方式引发索引失败,因此无法重试。 FindFailedActionsToRetry 足够聪明,可以检测到这一点。看看ShouldRetry方法in the code

【讨论】:

  • 哇,我花了很长时间才找到那个。非常感谢。我得到了 404,正如你提到的那样,这是不可重试的。感谢您的帮助!
  • 啊,很抱歉建议这种方法。我忘了FindFailedActionsToRetry 考虑了重试能力。
猜你喜欢
  • 1970-01-01
  • 2021-09-08
  • 2018-02-21
  • 1970-01-01
  • 1970-01-01
  • 2017-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多