在C#中 NEST查询类型为List 且为空的数据
你可以使用以下语法来查询类型为List且为空的数据:
var response = client.Search<MyDocument>(s => s
.Query(q => q
.Bool(b => b
.Must(m => m
.MatchAll(),
m => m
.Nested(n => n
.Path(p => p.MyList)
.Query(qq => qq
.Bool(bb => bb
.MustNot(mn => mn
.Exists(ex => ex
.Field(f => f.MyList)
)
)
)
)
)
)
)
)
);
在这个查询中,我们使用了Nested查询并指定了List字段的路径。然后我们使用了Bool查询来组合MatchAll和MustNot查询,以查找List为空的文档
原文地址: https://www.cveoy.top/t/topic/cihY 著作权归作者所有。请勿转载和采集!