es 查询怎么排除那些只要有一条数据是空的字段

es 查询怎么排除那些只要有一条数据是空的字段
比如我es中的数据是这样的:

{
  "took": 28,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 3,
    "max_score": 1,
    "hits": [
      {
        "_index": "shop",
        "_type": "book",
        "_id": "AWlTdeg9-uKcfYQht2cG",
        "_score": 1,
        "_source": {
          "id": 10006573,
          "name": "Elasticsearch action",
          "author": "Radu Gheorghe",
          "num": 120,
          "content": "这本实战型的书籍聚焦在使用HTTP协议的Elasticsearch REST API代码片段的书写多数是使用cURL的bash脚本,所以很容易翻译成其他编程语言。",
          "price": 39.5,
          "published": "2018-10-01"
        }
      },
      {
        "_index": "shop",
        "_type": "book",
        "_id": "AWlTkwr8-uKcfYQht2cH",
        "_score": 1,
        "_source": {
          "id": 20004812,
          "name": "Spring action",
          "author": "Radu go",
          "num": 120,
          "content": "这是一本简要简介spring d的书籍。",
          "price": 39.5
        }
      },
      {
        "_index": "shop",
        "_type": "book",
        "_id": "AWlTlIUH-uKcfYQht2cI",
        "_score": 1,
        "_source": {
          "id": 20004812,
          "name": "elasticsearch action",
          "author": "john"
        }
      }
    ]
  }
}

我要查询出来每条数据都不为空的字段,正确的结果应该是:
{
"id": 20004812,
"name": "elasticsearch action",
"author": "john"
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐