# Using synonyms with Auto Suggest - Search won't work , Analyze will

**URL:** <https://discuss.elastic.co/t/using-synonyms-with-auto-suggest-search-wont-work-analyze-will/115924>\
**Category:** Elasticsearch\
**Created:** [January 17, 2018, 4:25pm UTC](https://discuss.elastic.co/t/using-synonyms-with-auto-suggest-search-wont-work-analyze-will/115924 "2018-01-17T16:25:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SKing](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@SKing](https://discuss.elastic.co/u/SKing)\
**Post date:** [January 17, 2018, 4:25pm UTC](https://discuss.elastic.co/t/using-synonyms-with-auto-suggest-search-wont-work-analyze-will/115924/1 "2018-01-17T16:25:25Z")

</div>

I am using the Kibana Dev Tools Console.  
Elastic 6.1.1  
Kibana 6.1.1  
Running on windows

I am setting up an index with synonyms and auto-suggest:  
PUT /hotels  
{  
"settings": {  
"analysis": {  
"filter": {  
"my\_synonym\_filter": {  
"type": "synonym",  
"synonyms": [  
"courtyard, marriot"  
]  
}  
},  
"analyzer": {  
"my\_synonyms": {  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"my\_synonym\_filter"  
]  
}  
}  
}  
},  
"mappings": {  
"hotel" : {  
"properties" : {  
"name" : { "type" : "text" },  
"city" : { "type" : "text" },  
"name\_suggest" : {  
"type" : "completion"  
}  
}  
}  
}  
}

Analyzing using the synonym work  
GET /hotels/\_analyze  
{  
"analyzer" : "my\_synonyms",  
"text" : "I like the Marriot hotel"  
}

.... {  
"token": "marriot",  
"start\_offset": 11,  
"end\_offset": 18,  
"type": "",  
"position": 3  
},  
{  
"token": "courtyard",  
"start\_offset": 11,  
"end\_offset": 18,  
"type": "SYNONYM",  
"position": 3  
},......

However, I am then populating, using a synonym

PUT /hotels/hotel/3  
{  
"name" : "Courtyard by Marriot Munich City",  
"city" : "Munich",  
"name\_suggest" : {  
"input" : [  
"Courtyard by Marriot Munich City"  
],  
"weight": 15  
}  
}

If I search using auto-complete it will not work  
POST /hotels/\_search?pretty  
{  
"suggest" : {  
"name\_suggest" : {  
"prefix" : "m",  
"completion": {  
"field": "name\_suggest"  
}  
}  
}  
}

(no hits)

---

<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:** [February 14, 2018, 4:25pm UTC](https://discuss.elastic.co/t/using-synonyms-with-auto-suggest-search-wont-work-analyze-will/115924/2 "2018-02-14T16:25:41Z")

</div>

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