Azure 搜索获取多条记录

Azure search fetch multiple records

我想使用其中一个字段从 Azure 索引中获取多条记录,但我不确定在单个查询中可以使用多少个过滤器。假设如果我想获取 1000 条记录,我可以在搜索查询中添加 1000 个过滤器吗?

例如:我有一个名为 field_document_id 的字段,我想获取多个文档,因为我有文档的 ID。为此,我正在查询:*&$filter=field_document_id eq '1',这将获取 field_document_id 值为 1 的文档,假设我想像这样在单个请求中获取多个文档,我还有别的办法吗?如果我使用多个过滤器,是否有任何限制?

我相信您可以定义的过滤子句的数量是有限的,但是我找不到确切的数量。这就是提到的here:

There are limits to the size and complexity of filter expressions that you can send to Azure Cognitive Search. The limits are based roughly on the number of clauses in your filter expression. A good guideline is that if you have hundreds of clauses, you are at risk of exceeding the limit. We recommend designing your application in such a way that it doesn't generate filters of unbounded size.

Microsoft 建议您在单个字段上有大量筛选子句时使用search.in 函数。根据文档,它不仅克服了过滤器大小的限制,而且在性能方面也更好。