title: Elasticsearch long phrases search
body: <p>I'm using Elasticsearch for a full text search and I'm trying to find a better way to search for a long phrases.</p>
  
  <p>For example i have a field "Seller" that can be up to 250 chars and i want to find all items with Seller = 'some seller name with spaces'.</p>
  
  <p>If i understand correctly, in order to search text that contains spaces, i have to use NGramTokenizer that basically creates tokens like:</p>
  
  <pre><code>'s', 'so', 'som', 'some', 'some ', 'some s' etc. 
  </code></pre>
  
  <p>I know that i can define min and max gram, but i need to be able to search for 'a b', so my min gram has to be at least 3 and max gram as my field max length.</p>
  
  <p>So i have to create a lot of tokens per one item, and it's only seller, but what about description with 4k chars?</p>
  
  <p>This solution has a very low performance.</p>
  
  <p>Can anyone suggest a better solution to work with long phrases with spaces?</p>
  
  <p>My index settings:</p>
  
  
  
  <pre><code>analysis: {
    analyzer: {
      autoComplete: {
        filter: [
          "lowercase"
        ],
        type: "custom",
        tokenizer: "autoComplete"
      },
      caseInsensitive: {
        type: "custom",
        filter: [
          "lowercase"
        ],
        tokenizer: "keyword"
      }
    },
    tokenizer: {
      autoComplete: {
        type: "nGram",
        min_gram: "1",
        max_gram: "40"
      }
    }
  },
  </code></pre>
  
  
  
  <p>I use "autoComplete" as an index analyzer and "caseInsensitive" as search analyzer</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I use an NGramTokenizer in order to be able to search parts of the words</p> 
  
  <p>real word example:</p>
  
  <pre><code>Title: 'Huge 48" Bowtie LED Opti neon wall sign. 100,000 hours Bar lamp light'
  
  search query: 'Huge 48" Bowt'
  </code></pre>
  
  <p>With whitespace tokenizer you can't search parts of the words if you search for a phrase.</p>