How do I do ngram searches?


(Arthur Pemberton) #1

I am finding myself unable to do ngram searches. And by that, I mean I
can't find 'heating' when I do a search for 'heat'.

I have setup the index with the following settings:

{
'settings': {
"analysis": {
"analyzer": {
"ngram_analyzer": {
"type": "custom",
"tokenizer": "lowercase",
"filter": ["standard", "lowercase", "stop", "kstem", "haystack_ngram"]
}
},
"tokenizer": {
"haystack_ngram_tokenizer": {
"type": "nGram",
"min_gram": 3,
"max_gram": 15,
"token_chars": ["letter", "digit"],
}
},
"filter": {
"haystack_ngram": {
"type": "nGram",
"min_gram": 3,
"max_gram": 15
}
}
}
}

And I have data in there. I can do searches on heating and receive results,
but no results when I search for heat using a query_string search.

I have used the contents of the stored/index data and ran it against
_analyze with analyzer=ngram_analyzer and the tokens look good. But doing
a search using any of the generated tokens yield no results. I'm very
confused.

I have set 'analyzer', 'index_analyzer', and '' to 'search_analyzer' -- no
go. I've rebuilt the index after ever change -- no go.

I'm in need of help, please advise.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2