# Phrase suggester is behaving differently

**URL:** <https://discuss.elastic.co/t/phrase-suggester-is-behaving-differently/27175>\
**Category:** Elasticsearch\
**Created:** [August 11, 2015, 5:43am UTC](https://discuss.elastic.co/t/phrase-suggester-is-behaving-differently/27175 "2015-08-11T05:43:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [August 11, 2015, 5:43am UTC](https://discuss.elastic.co/t/phrase-suggester-is-behaving-differently/27175/1 "2015-08-11T05:43:47Z")

</div>

Hi,  
My phrase is not giving any results if the ast\_type have field priority, but when the same type ast\_type without the field priority phrase\_suggester is providing results...

Am having the fields as shown in the mapping:

"ast": {  
"mappings": {  
"ast\_type": {  
"properties": {  
"id": {  
"type": "string",  
"analyzer": "analyzer\_startswith"  
},  
"name": {  
"type": "string",  
"analyzer": "keyword\_analyzer"  
},  
"priority": {  
"type": "long"  
}  
}  
}  
}  
}

And the respective analyzers:

"keyword\_analyzer": {  
"filter": "lowercase",  
"tokenizer": "keyword"  
},  
"analyzer\_startswith": {  
"filter": [  
"lowercase"  
],  
"tokenizer": "whitespace"  
}

Am using the query:

GET ast/ast\_type/\_search  
{  
"size": 0,  
"suggest": {  
"did-you-mean": {  
"text": "engina",  
"phrase": {  
"field": "id",  
"size": 3,  
"direct\_generator": [  
{  
"field": "id",  
"suggest\_mode": "always",  
"post\_filter": "standard"  
}  
]  
}  
}  
}  
}

Output to the above request:

"suggest": {  
"did-you-mean": [  
{  
"text": "engina",  
"offset": 0,  
"length": 6,  
"options": []  
}  
]  
}

And the relevant sample data I have in the ast index :  
"\_source": {  
"id": "engine oil",  
"priority": 1,  
"name": "engine oil"  
}  
"\_source": {  
"id": "engine heater",  
"priority": 3,  
"name": "engine heater"  
}

If I use the data without priority field as shown in the sample data:  
"\_source": {  
"id": "engine oil",  
"name": "engine oil"  
}

"\_source": {  
"id": "engine heater",  
"name": "engine heater"  
}  
Two documents with engine in the field 'id'

When I use the same phrase\_suggester query am getting the results as shown:

"suggest": {  
"did-you-mean": [  
{  
"text": "engune heter",  
"offset": 0,  
"length": 12,  
"options": [  
{  
"text": "engune heater",  
"score": 0.016957704  
},  
{  
"text": "engine heter",  
"score": 0.014474084  
}  
]  
}  
]  
}

May I know the reason for this strange behaviour of phrase\_suggester?????

---

<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, 11:56pm UTC](https://discuss.elastic.co/t/phrase-suggester-is-behaving-differently/27175/2 "2017-07-05T23:56:32Z")

</div>

Closed on July 5, 2017, 11:56pm UTC


