title: How to use wildcards with ngrams in ElasticSearch
body: <p>Is it possible to combine wildcard matches and ngrams in ElasticSearch? I'm already using ngrams of length 3-11.</p>
  
  <p>As a very small example, I have records C1239123 and C1230123.  The user wants to return both of these.  This is the only info they know: C123?12</p>
  
  <p>The above case won't work on my full match analyzer because the query is missing the 3 on the end. I was under the impression wildcard matches would work out of the box, but if I perform a search similar to the above I get gibberish.</p>
  
  <p>Query:</p>
  
  <pre><code>.Search&lt;ElasticSearchProject&gt;(a =&gt; a
      .Size(100)
      .Query(q =&gt; q
          .SimpleQueryString(query =&gt; query
              .OnFieldsWithBoost(b =&gt; b
                  .Add(f =&gt; f.Summary, 2.1)
                  .Add(f =&gt; f.Summary.Suffix("ngram"), 2.0)
              .Query(searchQuery))));
  </code></pre>
  
  <p>Analyzer:</p>
  
  <pre><code>var projectPartialMatch = new CustomAnalyzer
  {
      Filter = new List&lt;string&gt; { "lowercase", "asciifolding" },
      Tokenizer = "ngramtokenizer"
  };
  </code></pre>
  
  <p>Tokenizer:</p>
  
  <pre><code>.Tokenizers(t=&gt;t
      .Add("ngramtokenizer", new NGramTokenizer
      {
          TokenChars = new[] {"letter","digit","punctuation"},
          MaxGram = 11,
          MinGram = 3
      }))
  </code></pre>
  
  <p>EDIT:
  The main purpose is to allow the user to tell the search engine exactly where the unknown characters are.  This preserves the match order.  I do not ngram the query, only the indexed fields.</p>
  
  <p>EDIT 2 with more test results:
  I had simplified my prior example a bit too much. The gibberish was being caused by punctuation filters. With a proper example there's no gibberish, but results aren't returned in a relevant order.  Seeing below, I'm unsure why the first 2 results match at all. Ngram is not applied to the query.</p>
  
  <p>Searching for c.a123?.7?0 gives results in this order:</p>
  
  <ul>
  <li>C.A1234.560  </li>
  <li>C.A1234.800   </li>
  <li>C.A1234.700 &lt;--Shouldn't this be first?    </li>
  <li>C.A1234.950</li>
  </ul>