Azure Search S3 HD 定价层的文档数限制

Limitation on document count for azure search S3 HD pricing tier

当我阅读 article 时,我看到以下信息

"For S3 High Density services created after late 2017, the 200 million document per partition has been removed but the 1 million document per index limit remains."

我想确认 S3 HD 索引是否仍然存在 100 万个文档的限制,或者这个限制最近也被取消了吗?

我在将数据转换成批次时遇到了同样的问题。

请根据您的要求修改代码。

for (int i = 0; i < result.Items.Count; i = i + 31500)
{
    searchItems = result.Items.Skip(i).Take(31500);
    actionList = new List<IndexAction<AzureSearchItem>>();
    foreach (var item in searchItems)
    {
        actionList.Add(IndexAction.MergeOrUpload(AzureHelper.FormatSearchItem(item)));
    }
    PostBulkAssortmentDocuments(actionList.AsEnumerable());
}

public virtual void PostBulkAssortmentDocuments(IEnumerable<IndexAction<AzureSearchItem>> actions)
{
    if (actions.Count() == 0)
        return;

    var batch = IndexBatch.New(actions);

    try
    {
        var data = GetIndexClient(IndexName).Documents.Index(batch);

        var passResultCount = data.Results.Where(x => x.Succeeded).Count();
        var failResultCount = data.Results.Where(x => x.Succeeded == false).Count();
        var MessageResult = data.Results.Where(x => !string.IsNullOrEmpty(x.ErrorMessage));
        var keyResult = data.Results.Where(x => !string.IsNullOrEmpty(x.Key)).Select(x => x.Key).ToList();
        var unikKey = keyResult.Distinct().ToList();
        string json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
    }
    catch (IndexBatchException e)
    {
        // Sometimes when your Search service is under load, indexing will fail for some of the documents in
        // the batch. Depending on your application, you can take compensating actions like delaying and
        // retrying. For this simple demo, we just log the failed document keys and continue.
        Console.WriteLine(
            "Failed to index some of the documents: {0}",
            String.Join(", ", e.IndexingResults.Where(r => !r.Succeeded).Select(r => r.Key)));

        this.WriteToFile("Error - PostBulkAssortmentDocuments -" + e.Message);
    }
}

文章内容仍然有效。因此,S3 HD 服务层中搜索索引的 100 万个文档上限现在仍然有效。