问题描述
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "attributes","query": {
"exists": {
"field": "attributes.value"
}
}
}
}
]
}
}
}
我已经尝试过了,但是没有用
ProductDocument.search().query(
"nested",path="attributes",query=(~Q('exists',field='attributes.value'))
)
{
"query": {
"nested": {
"path": "attributes","query": {
"bool": {
"must_not": [{
"exists": {
"field": "attributes.value"
}
}]
}
}
}
}
}
N.B:我使用的是Elastic 6.7,elasticsearch-dsl 6.4.2
解决方法
最后,我找到了查询
ProductDocument.search().query(~Q(
"nested",path="attributes",query=Q("exists",field='attributes.value'))
))
这可能对某人有帮助