title: Elasticsearch wildcard search and relevance
body: <p>I am trying to implement wildcard for a suggestion dropdown. I have a few days already since I try to figure out this. :(</p>
  
  <p>I have a list of restaurants (4000-7000). I want to search with wildcard in restaurant names and to display first the results where search is in front of text.</p>
  
  <p>I tried to index the name field without analyzer, with ngram analyzer and many other solutions I found on the net but without luck. </p>
  
  <p>Best results by now I get by with this setup:</p>
  
  <pre><code>settings:
    analysis: {
      analyzer: {
        default: {
          tokenizer: :keyword, 
          filter: [:lowercase]
        }
      }
    }
  </code></pre>
  
  <p>And index name field like this: </p>
  
  <pre><code>indexes :name, type: :string, analyzer: :default
  </code></pre>
  
  <p><strong>Search</strong>: query: {wildcard: {name: '*le*'}}<br>
  <strong>Result</strong>: Mr. Beef on Orleans, Miller's Pub, Merlo on Maple, Le Bouchon, Les Nomades, Leonardo's Ristorante, Lem's Bar-B-Q House, Le Petit Paris, Joy Yee's Noodles - Chinatown, J. Alexander's (Lincoln Park), Indian Garden - Streeterville, Goose Island Brewpub - Wrigleyville, Tweet ... Let's Eat!, Arco de Cuchilleros, Al's #1 Italian Beef - Little Italy </p>
  
  <p>I want that the results that start with '<strong>le</strong>' to be in front, to have a higher score. Because usually the people search for a restaurant that starts with. But I can not search without * in front because I do want also the results that contain this but with lower score in the results. For example above 'Le Colonial', 'Le Petit Paris', 'Les Nomades' should be in front.</p>
  
  <p>How can I accomplish this?</p>
  
  <p>The other concern I have it's performance. I know that wildcard in booth ends it's the worst case possible but I could not find any solution that gives me something ok in result with ngram or shingle.</p>