Preventing ngram on query term


(ymous.anon1234) #1

How would you disable the ngramming of the query term:
"match": {"username.ngram": "linus"

the indexer:
"tokenizer": {"customNgram": {"type": "nGram", "min_gram": 3, "max_gram":
5}

I don't want hits for lin, inu, nus as in Xinus but I do want hits for
tlinustorvalds

In other words - I don't what the query term "linus" to be broken down to
[4-2]-grams

Thanks very much.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/196100e8-478c-4eb0-b285-68c3a59c0dbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #2

In http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html:

The analyzer can be set to control which analyzer will perform the analysis process on the text. It default to the field explicit mapping definition, or the default search analyzer.

Also you can define in your mapping a different analyzer for indexing and searching:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html

index_analyzer

The analyzer used to analyze the text contents when analyzed during indexing.

search_analyzer

The analyzer used to analyze the field when part of a query string. Can be updated on an existing field.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 15 mars 2014 à 00:08, ymous.anon1234@gmail.com a écrit :

How would you disable the ngramming of the query term:
"match": {"username.ngram": "linus"

the indexer:
"tokenizer": {"customNgram": {"type": "nGram", "min_gram": 3, "max_gram": 5}

I don't want hits for lin, inu, nus as in Xinus but I do want hits for tlinustorvalds

In other words - I don't what the query term "linus" to be broken down to [4-2]-grams

Thanks very much.

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/196100e8-478c-4eb0-b285-68c3a59c0dbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/57EE8F2E-AE14-4FA2-B1E7-E545AFF63134%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(system) #3