Partial word matching with query_string and edge ngrams

We are implementing live filtering of a list via elasticsearch. In order to
have the filters be live on every keystroke we need to match partial words.
I'd like to do this with ngrams to speed up queries.

I can't seem to be able to get any matches to work without using wildcards.
I'm not even sure where I should be creating the ngrams. Should they be
done in a filter? Is this even meant to be done on mutli-word description
fields?

Here is a gist of what I'm currently attempting

Any help would be greatly appreciated. Thanks!

--

not sure if the dsl has preserved the behavior of it: try adding explain
to your working query; its in the guide. You'll get a quick view of some of
what's actually in the dictionary.

On Friday, September 14, 2012 3:23:29 PM UTC-4, Jim Mitchener wrote:

We are implementing live filtering of a list via elasticsearch. In order
to have the filters be live on every keystroke we need to match partial
words. I'd like to do this with ngrams to speed up queries.

I can't seem to be able to get any matches to work without using
wildcards. I'm not even sure where I should be creating the ngrams. Should
they be done in a filter? Is this even meant to be done on mutli-word
description fields?

Here is a gist of what I'm currently attempting
edgengram_test.sh · GitHub

Any help would be greatly appreciated. Thanks!

--

Hi Jim

I can't seem to be able to get any matches to work without using
wildcards. I'm not even sure where I should be creating the ngrams.
Should they be done in a filter? Is this even meant to be done on
mutli-word description fields?

You are using the edge-ngrams on the label and description fields, but
then you are searching on the _all field (which is the default if no
field is specified).

Try this instead:

curl -XGET 'http://localhost:9200/ngramtest/footype/_search?pretty' -d '
{
"query" : {
"query_string" : {
"query" : "alask",
"fields" : ["label", "description"]
}
}
}'

clint

--