传统sql查询返回某个字段为空值的结果写法是select * from 表名 where 字段名 is null
    在elasticsearch中查询语句为

    1. GET index/type/_search
    2. {
    3. "query": {
    4. "bool": {
    5. "must_not": {
    6. "exists": {
    7. "field": "字段名"
    8. }
    9. }
    10. }
    11. }
    12. }

    反之,查询字段不为空值的语句为

    1. GET index/type/_search
    2. {
    3. "query": {
    4. "bool": {
    5. "must": {
    6. "exists": {
    7. "field": "字段名"
    8. }
    9. }
    10. }
    11. }
    12. }