我正在尝试搜索字段为空的文档。以下尝试无效:
var searchResult1 = client.Search<Doc>(s => s
.From(0)
.Size(10)
.Query(q => q
.Match(m => m
.Field(f => f.Attachment.Content)
.Query("")
)
)
);
var searchResult2 = client.Search<Doc>(x => x
.Query(query => query
.Term(term => term
.Field(new Field("Attachment.Content"))
.Value("")
)
)
);
请注意,附件的类型为Nest.Attachment。
2条答案
按热度按时间hgtggwj01#
你已经试过
Verbatim()
了吗mlnl4t2r2#
只是添加到@fubo的asnwer。确保将字段索引为
Keyword
THEN对术语进行查询搜索,否则将不会返回任何文档。(正如问题作者@cs0815对链接答案的回复)