title: Elasticsearch returns documents with a query must_not exists
body: <p>Elasticsearch: 6.5.4</p>
  
  <p>Issue: I'm executing a bool query (sample to follow) where I'm checking for the existence of a specific field. The issue is, I'm getting results back where the field does exist but has an empty array.</p>
  
  <p>My question is, how do I properly execute a query and only get results where nlp is not added to the document at all.</p>
  
  <p>Sample query:</p>
  
  <pre><code>{
      "size": 100,
      "sort": [{
          "publishedAt": {
              "order": "asc"
          }
      }],
      "_source": {
          "includes": ["nlp"]
      },
      "query": {
          "bool": {
              "must_not": {
                  "exists": {
                      "field": "nlp.categories.gcp"
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Sample Mapping:
  (This was automatically created by Elastic Search, with the exception of the null_value, I tried adding that).</p>
  
  <pre><code>{
      "mapping": {
          "article": {
              "properties": {
                  "nlp": {
                      "properties": {
                          "categories": {
                              "properties": {
                                  "gcp": {
                                      "properties": {
                                          "confidence": {
                                              "type": "float"
                                          },
                                          "name": {
                                              "type": "text",
                                              "fields": {
                                                  "keyword": {
                                                      "type": "keyword",
                                                      "null_value": "[]",
                                                      "ignore_above": 256
                                                  }
                                              }
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Sample Result:</p>
  
  <pre><code>{
      "took": 68,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "skipped": 0,
          "failed": 0
      },
      "hits": {
          "total": 1126581,
          "max_score": null,
          "hits": [
              {
                  "_index": "news",
                  "_type": "article",
                  "_id": "UTuVmmsBE1H01hY9Rn6i",
                  "_score": null,
                  "_source": {
                      "nlp": {
                          "categories": {
                              "gcp": []
                          }
                      }
                  },
                  "sort": [
                      1509940860000
                  ]
              },
              {
                  "_index": "news",
                  "_type": "article",
                  "_id": "2w6PmmsBIpi-jAhhO13F",
                  "_score": null,
                  "_source": {
                      "nlp": {
                          "categories": {
                              "gcp": []
                          }
                      }
                  },
                  "sort": [
                      1510027260000
                  ]
              }
          ]
      }
  }
  </code></pre>
  
  <p>When the nlp.categories.gcp has values in it, a typical response would look like this.</p>
  
  <pre><code>{
      "took": 26,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "skipped": 0,
          "failed": 0
      },
      "hits": {
          "total": 475690,
          "max_score": null,
          "hits": [
              {
                  "_index": "news",
                  "_type": "article",
                  "_id": "6Q6JmmsBIpi-jAhhAlcm",
                  "_score": null,
                  "_source": {
                      "nlp": {
                          "categories": {
                              "gcp": [
                                  {
                                      "confidence": 0.8999999761581421,
                                      "name": "/Travel/Hotels &amp; Accommodations"
                                  }
                              ]
                          }
                      }
                  },
                  "sort": [
                      1510215565000
                  ]
              },
              {
                  "_index": "news",
                  "_type": "article",
                  "_id": "rzunmmsBE1H01hY9sLyE",
                  "_score": null,
                  "_source": {
                      "nlp": {
                          "categories": {
                              "gcp": [
                                  {
                                      "confidence": 0.9399999976158142,
                                      "name": "/Travel/Hotels &amp; Accommodations"
                                  }
                              ]
                          }
                      }
                  },
                  "sort": [
                      1510228881000
                  ]
              }
          ]
      }
  }
  </code></pre>