# Need help setting up autocomplete suggestions using phrase suggester

**URL:** <https://discuss.elastic.co/t/need-help-setting-up-autocomplete-suggestions-using-phrase-suggester/17656>\
**Category:** Elasticsearch\
**Created:** [May 21, 2014, 9:07pm UTC](https://discuss.elastic.co/t/need-help-setting-up-autocomplete-suggestions-using-phrase-suggester/17656 "2014-05-21T21:07:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Bormans](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@Paul\_Bormans](https://discuss.elastic.co/u/Paul_Bormans)\
**Post date:** [May 21, 2014, 9:07pm UTC](https://discuss.elastic.co/t/need-help-setting-up-autocomplete-suggestions-using-phrase-suggester/17656/1 "2014-05-21T21:07:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Paul\_Bormans](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@Paul\_Bormans](https://discuss.elastic.co/u/Paul_Bormans)\
**Post date:** [June 6, 2014, 9:05pm UTC](https://discuss.elastic.co/t/need-help-setting-up-autocomplete-suggestions-using-phrase-suggester/17656/2 "2014-06-06T21:05:42Z")

</div>

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](mailto: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).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [June 6, 2014, 9:34pm UTC](https://discuss.elastic.co/t/need-help-setting-up-autocomplete-suggestions-using-phrase-suggester/17656/3 "2014-06-06T21:34:49Z")

</div>

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](mailto: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](mailto: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)  
> [https://groups.google.com/d/msgid/elasticsearch/e0410cb8-60df-428c-8225-6ea00146630f%40googlegroups.com?utm\_medium=email&utm\_source=footer](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](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](mailto: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](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](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:24am UTC](https://discuss.elastic.co/t/need-help-setting-up-autocomplete-suggestions-using-phrase-suggester/17656/4 "2017-07-06T01:24:04Z")

</div>


