# Phrase suggester returns unexpected result when first letter is misspelled

**URL:** https://discuss.elastic.co/t/phrase-suggester-returns-unexpected-result-when-first-letter-is-misspelled/136801
**Category:** Elasticsearch
**Created:** [June 21, 2018, 8:40am UTC](https://discuss.elastic.co/t/phrase-suggester-returns-unexpected-result-when-first-letter-is-misspelled/136801 "2018-06-21T08:40:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![NarimanN2](https://avatars.discourse-cdn.com/v4/letter/n/5fc32e/32.png) [@NarimanN2](https://discuss.elastic.co/u/NarimanN2)
#### Post date: [June 21, 2018, 8:40am UTC](https://discuss.elastic.co/t/phrase-suggester-returns-unexpected-result-when-first-letter-is-misspelled/136801/1 "2018-06-21T08:40:22Z")

</div>

I'm using Elasticsearch Phrase Suggester for correcting user's misspellings. everything is working as I expected unless user enters a query which it's first letter is misspelled. At this situation phrase suggester returns nothing or returns unexpected results.

My query for suggestion:

> {  
> "suggest": {  
> "text": "user\_query",  
> "simple\_phrase": {  
> "phrase": {  
> "field": "title.phrase",,  
> "collate": {  
> "query": {  
> "inlile" : {  
> "bool": {  
> "should": [  
> { "match": {"title": "{{suggestion}}"}},  
> { "match": {"participants": "{{suggestion}}"}}  
> ]  
> }  
> }  
> }  
> }  
> }  
> }

Example when first letter is misspelled:

> "simple\_phrase" : [  
> {  
> "text" : "گاشانچی",  
> "offset" : 0,  
> "length" : 11,  
> "options" : [ {  
> "text" : "گارانتی",  
> "score" : 0.00253151  
> }]  
> }  
> ]

Example when fifth letter is misspelled:

> "simple\_phrase" : [  
> {  
> "text" : "کاشاوچی",  
> "offset" : 0,  
> "length" : 11,  
> "options" : [ {  
> "text" : "کاشانچی",  
> "score" : 0.1121  
> },  
> {  
> "text" : "کاشانجی",  
> "score" : 0.0021  
> },  
> {  
> "text" : "کاشنچی",  
> "score" : 0.0020  
> }]  
> }  
> ]

I expect that these two misspelled queries have same suggestions(my expected suggestions are second one). what is wrong?

P.S: I'm using this feature for Persian language.

---

<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 19, 2018, 8:40am UTC](https://discuss.elastic.co/t/phrase-suggester-returns-unexpected-result-when-first-letter-is-misspelled/136801/2 "2018-07-19T08:40:26Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
