Azure 搜索 FindFailedActionsToRetry 返回空操作?

Azure search FindFailedActionsToRetry returning empty actions?

我正在 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。行动、文件等

为什么我看不到任何结果?

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