title: Elasticsearch: Find substring match
body: <p>I want to perform both exact word match and partial word/substring match. For example if I search for "men's shaver" then I should be able to find "men's shaver" in the result. But in case case I search for "en's shaver" then also I should be able to find "men's shaver" in the result.
  I using following settings and mappings:</p>
  
  <p><strong>Index settings:</strong></p>
  
  <pre><code>PUT /my_index
  {
      "settings": {
          "number_of_shards": 1, 
          "analysis": {
              "filter": {
                  "autocomplete_filter": { 
                      "type":     "edge_ngram",
                      "min_gram": 1,
                      "max_gram": 20
                  }
              },
              "analyzer": {
                  "autocomplete": {
                      "type":      "custom",
                      "tokenizer": "standard",
                      "filter": [
                          "lowercase",
                          "autocomplete_filter" 
                      ]
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Mappings:</strong></p>
  
  <pre><code>PUT /my_index/my_type/_mapping
  {
      "my_type": {
          "properties": {
              "name": {
                  "type":            "string",
                  "index_analyzer":  "autocomplete", 
                  "search_analyzer": "standard" 
              }
          }
      }
  }
  </code></pre>
  
  <p>Insert records:</p>
  
  <pre><code>POST /my_index/my_type/_bulk
  { "index": { "_id": 1            }}
  { "name": "men's shaver" }
  { "index": { "_id": 2            }}
  { "name": "women's shaver" }
  </code></pre>
  
  <p><strong>Query:</strong></p>
  
  <p><strong>1. To search by exact phrase match --> "men's"</strong></p>
  
  <pre><code>POST /my_index/my_type/_search
  {
      "query": {
          "match": {
              "name": "men's"
          }
      }
  }
  </code></pre>
  
  <p>Above query returns "men's shaver" in the return result.</p>
  
  <p><strong>2. To search by Partial word match --> "en's"</strong></p>
  
  <pre><code>POST /my_index/my_type/_search
  {
      "query": {
          "match": {
              "name": "en's"
          }
      }
  }
  </code></pre>
  
  <p>Above query DOES NOT return anything. </p>
  
  <p>I have also tried following query</p>
  
  <pre><code>POST /my_index/my_type/_search
  {
      "query": {
          "wildcard": {
             "name": {
                "value": "%en's%"
             }
          }
      }
  }
  </code></pre>
  
  <p>Still not getting anything.
  I figured it is because of "edge_ngram" type filter on Index which is not able to find "partial word/sbustring match". 
  I tried "n-gram" type filter as well but it is slowing down the search alot.</p>
  
  <p>Please suggest me how to achieve both excact phrase match and partial phrase match using same index setting.</p>