Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at this from <a href="http://www.elasticsearch.org/guide/reference/index-modules/analysis/ngram-tokenizer/" rel="nofollow">the es docs on nGram token filters</a>:</p> <pre><code> "settings" : { "analysis" : { "analyzer" : { "my_ngram_analyzer" : { "tokenizer" : "my_ngram_tokenizer" } }, "tokenizer" : { "my_ngram_tokenizer" : { "type" : "nGram", "min_gram" : "2", "max_gram" : "3", "token_chars": [ "letter", "digit" ] } } } } </code></pre> <p>A few things to note</p> <ol> <li><p>You need to add <code>mynGram</code> to your analyzer or it won't be used. They way it works is like this. Each indexed field has an analyzer applied to it, an analyzer is <strong>one</strong> tokenizer followed by <strong>zero or more</strong> token filters. You have defined a nice nGram tokenizer (<code>mynGram</code>) to use, but you did not use it in <code>customAnalyzer</code>, it is using the <code>standard</code> tokenizer. (Basically you are just defining but never using <code>mynGram</code>.)</p></li> <li><p>You need to tell elasticsearch to use your <code>customAnalyzer</code> in your mapping: <code>"properties": {"string_field": {"type": "string", "index_analyzer": customAnalyzer" }}</code></p></li> <li><p>You should change the <code>maxGram</code> to a bigger number (maybe 10), otherwise 4 letter searches will not behave exactly as autocomplete (or could return nothing, depends on the search-time analyzer).</p></li> <li><p>Use the <code>_analyze</code> api endpoint to test your analyzer. Something line this should work.</p> <p>curl -XGET '<a href="http://yourserver.com:9200?index_name/_analyze?analyzer=customAnalyzer" rel="nofollow">http://yourserver.com:9200?index_name/_analyze?analyzer=customAnalyzer</a>' -d 'rlewis'</p></li> </ol> <p>Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload