title: Elasticsearch match string to field with fuzziness
body: <p>I'm trying to match a string to a field and only want to apply fuzziness.</p>
  
  <p>For example, with these documents:</p>
  
  <pre><code>{ title: "replace oilfilter" }, { title: "replace motoroil" }
  </code></pre>
  
  <p>The following queries should match only the first document:</p>
  
  <pre><code>"Replace oilfilter", "Replace oilsfilter", "Replaze oilfilter"
  </code></pre>
  
  <p>The following queries should <strong>NOT</strong> match any document:</p>
  
  <pre><code>"replace", "oilfilter", "motoroil"
  </code></pre>
  
  <p>What I got so far is the following:</p>
  
  <h1>index</h1>
  
  <p>I'm using the keyword analyzer so it sees the (potential) phrase as a single word, this way it does not match a document when searching for "replace" but it does find a document when searching for the exact term "Replace oilfilter".</p>
  
  <pre><code>    "mappings": {
          "blacklist": {
              "properties": {
                  "title": {
                      "type": "text",
                      "analyzer": "keyword"
                  }
              }
          }
      }
  </code></pre>
  
  <h1>search</h1>
  
  <p>I've tried multiple queries to search the documents. I got close with the following query:</p>
  
  <pre><code>    "query": {
          "query_string": {
              "default_field": "title",
              "fuzziness": "3",
              "query": query
          }
      }
  </code></pre>
  
  <h1>results</h1>
  
  <p>With this query the following are the results:</p>
  
  <pre><code>&gt; "Replace oilfilter" (exact words)
  &lt; doc: { title: "replace oilfilter" }, score: 0.5753..
  &lt; doc: { title: "replace motoroil" }, score: 0.2876..
  
  &gt; "Replace iolfilter" (typo)
  &lt; doc: { title: "replace oilfilter" }, score: 0.2876..
  
  &gt; "oilfilter" (other term)
  &lt; doc: { title: "replace oilfilter" }, score: 0.2876..
  </code></pre>
  
  <h1>problem</h1>
  
  <p>The results aren't that bad, but I need the scores to be more accurate. The second query with only the simple typo should get a much higher score than the second result in the first query and the only result in the third query.</p>
  
  <p>What I'm trying to achieve is that it matches the <strong>whole</strong> query against the <strong>whole</strong> field in the document, that's why I'm using keyword analyzer. On top of that I only want to apply some fuzziness.</p>
  
  <p>Hope someone can shed some light on this issue.</p>
  
  <p>Thanks!</p>