My elastic search setup is something like this
:analyzer => {
:default => {
:type => "custom",
:tokenizer => "whitespace",
:filter => ["lowercase", "standard", "my_ngram"]
}
}
where my_gram is specified like this
:my_ngram => {
:type => "nGram",
:min_gram => 1,
:max_gram => 20
}
The problem is that when I search for something like “cre” im getting “crib” as a result as well as “crew” and “remember” … which appears like its matching on ‘re’ and ‘cr’ … I want it to be an exact match for ‘cre’ inside the word if there is a match.
what am I doing wrong?
Found the answer to this … just specify
:default_operator => ANDin thequery_stringoptions. So something like this (using Tire gem, because I’m lazy)