title: elasticsearch ngram analyzer/tokenizer not working?
body: <p>it seems that the ngram tokenizer isn't working or perhaps my understanding/use of it isn't correct.</p>
  
  <p>my tokenizer is doing a mingram of 3 and maxgram of 5. i'm looking for the term 'madonna' which is definitely in my documents under artists.name. i can find the term with other techniques (using simple analyzer and related), but not using ngram.</p>
  
  <p>what i'm trying to accomplish by using the ngram is to find names and accounting for misspellings.</p>
  
  <p>please see a shortened version of my mappings, my settings, and my query, and if you have any ideas, please let me know - it's driving me nuts!</p>
  
  <p>settings...</p>
  
  <pre><code>{
     "myindex": {
        "settings": {
           "index": {
              "analysis": {
                 "analyzer": {                  
                    "ngramAnalyzer": {
                       "type": "custom",
                       "filter": [
                          "lowercase"
                       ],
                       "tokenizer": "nGramTokenizer"
                    }  
                 },
                 "tokenizer": {
                    "nGramTokenizer": {
                       "type": "nGram",
                       "min_gram": "3",
                       "max_gram": "5"
                    }
                 }
              },
              "number_of_shards": "5",
              "number_of_replicas": "1",
              "version": {
                 "created": "1020199"
              },
              "uuid": "60ggSr6TREaDTItkaNUagg"
           }
        }
     }
  }
  </code></pre>
  
  <p>mappings ...</p>
  
  <pre><code>{
     "myindex": {
        "mappings": {
           "mytype": {
              "properties": { 
                 "artists.name": {
                    "type": "string",
                    "analyzer": "simple",
                    "fields": {
                       "ngram": {
                          "type": "string",
                          "analyzer": "ngramAnalyzer"
                       },
                       "raw": {
                          "type": "string",
                          "index": "not_analyzed"
                       }
                    }
                 }
              }
           }
        }
     }
  }
  </code></pre>
  
  <p>query ...</p>
  
  <pre><code>{"query": {"match": {"artists.name.ngram": "madonna"}}}
  </code></pre>
  
  <p>document ...</p>
  
  <pre><code>{
     "_index": "myindex",
     "_type": "mytype",
     "_id": "602537592951",
     "_version": 1,
     "found": true,
     "_source": {
        "artists": [
           {
              "name": "Madonna",
              "id": "P    64565"
           }
        ]
     }
  }
  </code></pre>
  
  <p><strong>EDIT</strong>
  incidentally, this query works (without ngram):</p>
  
  <pre><code>{"query": {"match": {"artists.name": "madonna"}}}
  </code></pre>
  
  <p>this obviously has something to do with the nested object here. i'm apparently not applying the ngram to the nested object properly.</p>
  
  <p>ideas?</p>