azure - 在创建新操作“IndexBatch.New(actions)”时,一个请求中允许多少个文档 Azure 搜索?
问题描述
我没有在一个请求中发布 Azure 最大限制文档。
只是我想知道是否有任何官方链接显示根据购买的计划在 azure 服务器中每个索引器的最大限制点击我。
这里天蓝色的官方索引器限制了链接
在创建批次的代码下方
public virtual void PostBulkDataToAssortmentIndex(ISearchFilterResult result)
{
var itemFilters = _searchManager.GetAllFilters();
IEnumerable<ISearchItem> items;
List<IndexAction<AzureSearchItem>> actionList = new List<IndexAction<AzureSearchItem>>();
for (int i = 0; i < result.Items.Count; i = i + 32000)
{
actionList.Clear();
items = result.Items.Skip(i).Take(32000);
foreach (var item in items)
{
actionList.Add(IndexAction.MergeOrUpload(FormatSearchItem(item, itemFilters)));
}
// Post documents to index
PostBulkAssortmentDocuments(actionList.AsEnumerable());
}
}
public virtual void PostBulkAssortmentDocuments(IEnumerable<IndexAction<AzureSearchItem>> actions)
{
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();
}
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)));
}
}
注意:根据 Azure 文档,我不确定,但仅1000
允许每批次的文档发布限制,但出于测试目的,我通过了0 documents in IndexBatch.New(actions);
然后 Azure 引发异常。
'The request is invalid. Details:
actions: No indexing actions found in the request. Please include between 1 and 32000 indexing actions in your request.
'
如果我通过32001
每份文件IndexBatch.New(actions);
然后 Azure 引发异常。
The request is invalid. Details: actions: Too many indexing actions found in the request: 32001. Please include between 1 and 32000 indexing actions in your request.
解决方案
As per the documentation
, the limit is 1000 documents or 16MB whichever comes first.
This approach is more flexible than the pull model because you can upload documents individually or in batches (up to 1000 per batch or 16 MB, whichever limit comes first). The push model also allows you to upload documents to Azure Cognitive Search regardless of where your data is.
推荐阅读
- ios - 如何将新的 UICollectionViewController 推送到单元格单元格内的 navigationController
- node.js - 有没有办法检查是否刚刚使用 Okta 身份验证 API 创建了新帐户?
- c++ - SDL_GAMECONTROLLERCONFIG 与 SDL_GameControllerAddMappingsFromFile
- java - 仅使用本地锁从 BST 中进行多线程删除
- javascript - 为什么 web worker 版本运行时间更长?
- excel - 刷新数据链接到 MS Access 查询时,需要允许 Excel 中的列顺序(字母顺序)更改
- html - 使用类或id都不会影响这个div的特性
- gerrit - 如何在 Gerrit 中为给定的补丁集添加描述?
- go - 不安全的从字节切片到结构的类型转换
- vim - Vim 持续冻结有几个原因