# Phrase suggester not working well

**URL:** <https://discuss.elastic.co/t/phrase-suggester-not-working-well/47223>\
**Category:** Elasticsearch\
**Created:** [April 13, 2016, 9:26am UTC](https://discuss.elastic.co/t/phrase-suggester-not-working-well/47223 "2016-04-13T09:26:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lato84](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@lato84](https://discuss.elastic.co/u/lato84)\
**Post date:** [April 13, 2016, 9:26am UTC](https://discuss.elastic.co/t/phrase-suggester-not-working-well/47223/1 "2016-04-13T09:26:40Z")

</div>

Hi,  
I am new on Elasticsearch and I was trying to build my little node application to insert some faq documents and to search them. I am trying to use the phrase suggester but the result is not the one I expected but I don't understant what is wrong.

Here are my commands from the beginning to create index and analyzers:

> curl -XPUT 'localhost:9200/myapp?pretty'

> curl -XPOST 'localhost:9200/myapp/\_close'

> curl -XPUT localhost:9200/myapp/\_settings -d'  
> {  
> "settings": {  
> "analysis": {  
> "filter": {  
> "italian\_elision": {  
> "type": "elision",  
> "articles": [  
> "c", "l", "all", "dall", "dell",  
> "nell", "sull", "coll", "pell",  
> "gl", "agl", "dagl", "degl", "negl",  
> "sugl", "un", "m", "t", "s", "v", "d"  
> ]  
> },  
> "italian\_stop": {  
> "type": "stop",  
> "stopwords": "_italian_"  
> },  
> "italian\_stemmer": {  
> "type": "stemmer",  
> "language": "italian"  
> }  
> },  
> "analyzer": {  
> "italian": {  
> "tokenizer": "standard",  
> "filter": [  
> "italian\_elision",  
> "lowercase",  
> "italian\_stop",  
> "italian\_stemmer"  
> ]  
> }  
> }  
> }  
> }  
> }'

> curl -XPOST 'localhost:9200/myapp/\_open'

Everything was successful and I started inserting a type and some rows:

> client.create({  
> index: 'myapp',  
> type: 'faq',  
> body: {  
> title: 'first title',  
> text: 'hello friend'  
> }  
> }, function (err, response) {  
> console.log(err, response)  
> })

Now I am trying to search a wrong phrase to test the phrase suggester: I have tried this search:

> client.search({  
> index: 'myapp',  
> type: 'faq',  
> body: {  
> 'query': {  
> 'match': {  
> 'text': 'helko friund'  
> }  
> },  
> 'suggest': {  
> 'text': 'helko friund',  
> 'simple\_phrase': {  
> 'phrase': {  
> 'field': 'text',  
> 'size': 5,  
> 'real\_word\_error\_likelihood': 0.95,  
> 'gram\_size': 1,  
> 'highlight': {  
> 'pre\_tag': '_',  
> 'post\_tag': '_'  
> },  
> 'direct\_generator': [{  
> 'field': 'text',  
> 'suggest\_mode': 'always',  
> 'min\_word\_len': 1  
> }]  
> }  
> }  
> }  
> }  
> })

and I was expecting to retrieve a suggestion "hello friend" but it returns two different suggestions:

> "suggest": {  
> "simple\_phrase": [  
> {  
> "text": "helko friund",  
> "offset": 0,  
> "length": 12,  
> "options": [  
> {  
> "text": "helko friend",  
> "highlighted": "helko _friend_",  
> "score": 0.36621025  
> },  
> {  
> "text": "hello friund",  
> "highlighted": "_hello_ friund",  
> "score": 0.359775  
> }  
> ]  
> }  
> ]  
> }

What do I have to do to retrieve un unique suggestion with both words correct?

Thanks in advance for the help

Andrea

---

<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 5, 2017, 10:59pm UTC](https://discuss.elastic.co/t/phrase-suggester-not-working-well/47223/2 "2017-07-05T22:59:40Z")

</div>


