You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何查询Azure搜索索引中Collection类型字段为null或空数组的记录

Azure 索引Collection类型字段OData筛选解决方案

Collection(Edm.String)是多值类型,OData二元运算符要求操作数为单值,因此直接使用Skills eq null的写法会触发如下错误:

The operand for a binary operator 'NotEqual' is not a single value. Binary operators require both operands to be single values. Parameter name: $filter

两种常见筛选场景的正确写法如下:

  • 筛选集合字段存在至少一个元素的记录:使用无参数的any()运算符,判断集合至少包含一个元素,请求示例如下:
{
    "searchMode": "any",
    "queryType": "full",
    "select": "QualifiedFor",
    "count": true,
    "filter": "Skills/any()"
}
  • 筛选集合字段为空数组或为null的记录:对any()的结果取反即可,请求示例如下:
{
   "search": "*",
   "queryType": "full",
   "select": "Email",
   "count": true,
   "filter": "not Skills/any()"
}

内容的提问来源于stack exchange,提问作者Mark

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 21:06:07