ELK,萌萌哒

nested嵌套数组全部匹配怎么查

Elasticsearch | 作者 yangyao | 发布于2021年03月18日 | 阅读数:1086


{
  "name": "baba",
  "childrens": [
    {
      "name": "William",
      "sex": 0,
    },
    {
      "name": "John",
      "sex": 1,
    }
  ]
}
我如何拿出 sex值全是0的数据?
已邀请:

- Elasticsearch,php

赞同来自:

GET 索引名或别名/_search
{
"query": {
"bool": {
"filter": {
"nested": {
"path": "childrens",
"query": {
"term": {
"childrens.sex": {
"value": 0
}
}
}
}
}
}
}
}

Ombres

赞同来自:

反过来想,"非男"不就是全部是"女"了吗 ?

要回复问题请先登录注册