Need help setting up autocomplete suggestions using phrase suggester


(Paul Bormans) #1

After days of reading ... i'm still confused and need some help setting up
an autocomplete function.

My intention is to provide search suggestions (as-you-type) to a twitter
typeahead search box. So this means i don't want to return actual documents
but ranked suggestion instead. The three suggesters seem to target exactly
that so i thought to try the phrase suggester.

{
"accoms_unittest" : {
"settings" : {
"index" : {
"uuid" : "t6hW60RoSmyS7sf8_GBrwg",
"analysis" : {
"filter" : {
"filter_shingle" : {
"type" : "shingle",
"min_shingle_size" : "1",
"max_shingle_size" : "4",
"output_unigrams" : "true"
}
},
"analyzer" : {
"shingle_analyzer" : {
"type" : "custom",
"filter" : [ "standard", "lowercase", "filter_shingle" ],
"tokenizer" : "standard"
}
}
},
"number_of_replicas" : "1",
"number_of_shards" : "5",
"version" : {
"created" : "1000299"
}
}
}
}
}

{
"accoms_unittest" : {
"mappings" : {
"modelresult" : {
"_boost" : {
"name" : "boost",
"null_value" : 1.0
},
"properties" : {

<...>
"text_nl" : {
"type" : "string",
"store" : true,
"term_vector" : "with_positions_offsets",
"analyzer" : "snowball"
},
"text_suggest_nl" : {
"type" : "string",
"store" : true,
"term_vector" : "with_positions_offsets",
"analyzer" : "shingle_analyzer"
},
}
}
}
}
}

GET accoms_unittest/_search
{
"query": {
"match_all": {}
},
"suggest": {
"text": "levendige kleu",
"simple_phrase" : {
"phrase": {
"field": "text_suggest_nl",
"size": 5,
"analyzer": "standard",
"real_word_error_likelihood": 0.95,
"max_errors": 1,
"gram_size": 4,
"direct_generator" : [ {
"field" : "text_nl",
"suggest_mode" : "always",
"min_word_len" : 1
} ]
}

}

},
"from": 0,
"size": 0
}

{
"took": 8,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 12,
"max_score": 0,
"hits": []
},
"suggest": {
"simple_phrase": [
{
"text": "levendige kleu",
"offset": 0,
"length": 14,
"options": []
}
]
}
}

I know one of the objects has following input text: "De levendige kleuren en de etc...", so i run following search experiments:

"text": "levendige kleure" yields a suggestion "levendige kleuren" with score: 2854.164

"text": "levendig kleure" yields no results?

"text": "levendi" also yields no suggestions?

Obviously when a user starts typing i would like to see a suggestion like "levendige" based on input search text "lev".

What am i missing here?

  • is this the way to go?

Paul Bormans

--
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/2ed471f3-bf44-4b05-911e-f5540f9f5fb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Paul Bormans) #2

I just wanted to let anyone know i didn't succeed with the phrase suggester
and i switched to the completion suggester, that actually works very well
to my purpose.
Paul

--
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/e0410cb8-60df-428c-8225-6ea00146630f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Nik Everett) #3

Yeah, sorry for not getting back to you earlier. The phrase and term
suggesters are more for providing "did you mean:" style spelling
corrections then typeahead. The completion suggester is for typeahead.

On Fri, Jun 6, 2014 at 5:05 PM, Paul Bormans peebor@gmail.com wrote:

I just wanted to let anyone know i didn't succeed with the phrase
suggester and i switched to the completion suggester, that actually works
very well to my purpose.
Paul

--
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/e0410cb8-60df-428c-8225-6ea00146630f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/e0410cb8-60df-428c-8225-6ea00146630f%40googlegroups.com?utm_medium=email&utm_source=footer
.

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/CAPmjWd1ABJgLx62CaHCUX%3Du1ztv-jdm%2BdLVcoZjt%3DOfLNdcruA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4