1 如果字段就是整个文档json的字段
{
"query": {
"bool": {
"must": [
{
"exists": {
"field": "recordUrl"
}
}
]
}
}
}
2 如果要查询文档的字段下的子字段,
前提是patient是一个objcet,可以涌点访问子属性
{
"query": {
"bool": {
"must": [
{
"exists": {
"field": "patient.recordUrl"
}
}
]
}
}
}
3 如果要查的子字段所在的父节点不是object,而是一个数组呢
需要用到nested了
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "patients",
"query": {
"exists": {
"field": "patients.record"
}
}
}
}
]
}
}
}
