【发布时间】:2021-02-11 16:29:09
【问题描述】:
我在文档中有嵌套数据映射,我想查询嵌套字段是否不存在。
此弹性查询正在运行,但此查询的弹性 DSL 表示形式是什么?
获取产品/_搜索
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "attributes",
"query": {
"exists": {
"field": "attributes.value"
}
}
}
}
]
}
}
}
这个我试过了,还是不行
ProductDocument.search().query(
"nested",
path="attributes",
query=(~Q('exists', field='attributes.value'))
)
这个 DSL 查询表示为,我认为它是错误的
{
"query": {
"nested": {
"path": "attributes",
"query": {
"bool": {
"must_not": [{
"exists": {
"field": "attributes.value"
}
}]
}
}
}
}
}
注意:我使用的是 elastic 6.7,elasticsearch-dsl 6.4.2
【问题讨论】:
标签: elasticsearch elasticsearch-dsl elasticsearch-dsl-py