title: Empty String elastic search
body: <p>I'm using Elastic 6.5 .</p>
  
  <p>I need to include an empty string search with one of the criteria i'm passing. </p>
  
  <p>primaryKey = 1, 2, 3</p>
  
  <p>subKey = "" or subKey = "A"   along with a bunch of other criteria.  </p>
  
  <p>I've been unable to get the record that has the empty subKey. </p>
  
  <p>i've tried using the MUST_NOT EXISTS but it doesn't fetch the record in question.</p>
  
  <p>So below should return any records that have primarykey of 1, 2, or 3. and subKey of 'A' or Empty String. Filtered by the Date provided.  I get all the records Except the record where the subKey is blank.</p>
  
  <p>so i've tried this: </p>
  
  <pre><code>{
    "size": 200, "from": 0,
    "query": {
      "bool": {
        "must": [{
                  "bool": {
                    "should": [{ "terms": {"primaryKey": [1,2,3] }}]
                  }
                },
                {
                  "bool": {
                    "should": [ 
                                {"match": {"subKey": "A"}}, 
                                {
                                  "bool" : {
                                    "must_not": [{ "exists": { "field": "subKey"} }]
                                  }
                                }
                              ]
                  }
                }],
        "filter": [{"range": {"startdate": {"lte": "2018-11-01"}}}]
      }
    }
  }
  </code></pre>
  
  <p>The subkey field is special.. where it's actually searched by LETTER.  But i don't think that effects anything.. but here is the NEST coding i have for that index.</p>
  
  <pre><code>new CreateIndexDescriptor("SpecialIndex").Settings(s =&gt; s
                  .Analysis(a =&gt; a
                          .Analyzers(aa =&gt; aa
                              .Custom("subKey_analyzer", ma =&gt; ma
                                  .Tokenizer("subKey_tokenizer")
                                  .Filters("lowercase")
                              )
                          )
                          .Tokenizers(ta =&gt; ta
                              .NGram("subKey_tokenizer", t =&gt; t
                                  .MinGram(1)
                                  .MaxGram(1)
                                  .TokenChars(new TokenChar[] { TokenChar.Letter, TokenChar.Whitespace })
                              )
                          )
                      )
                  )
                  .Mappings(ms =&gt; ms
                      .Map&lt;SpecialIndex&gt;(m =&gt; m
                          .Properties(p =&gt; p
                              .Text(s =&gt; s
                                  .Name(x =&gt; x.subKey)
                                  .Analyzer("subKey_analyzer")
                              )
                          )
                      ));
  </code></pre>
  
  <p>Any ideas on how to resolve this?  Thank you very much!</p>
  
  <p>NOTE: i've seen posts saying this can be done with a filter, using missing. But as you can see from the query, i need the Query to do this, not the filter.</p>
  
  <p>i've also tried the following rather than the MUST_NOT EXISTS</p>
  
  <pre><code>{
      "term": { "subKey": { "value": "" }}
  }
  </code></pre>
  
  <p>but doesn't work. I'm thinking I need another tokenizer to get this working.</p>