# Stop-Words analyzers does not work as expected

**URL:** <https://discuss.elastic.co/t/stop-words-analyzers-does-not-work-as-expected/130946>\
**Category:** Elasticsearch\
**Created:** [May 8, 2018, 7:35am UTC](https://discuss.elastic.co/t/stop-words-analyzers-does-not-work-as-expected/130946 "2018-05-08T07:35:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahesh.maney](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mahesh.maney](https://discuss.elastic.co/u/mahesh.maney)\
**Post date:** [May 8, 2018, 7:35am UTC](https://discuss.elastic.co/t/stop-words-analyzers-does-not-work-as-expected/130946/1 "2018-05-08T07:35:50Z")

</div>

Hi,  
I’m facing an issue with implementing stop-words and synonyms on title and description fields. While the synonym works well, the stop-words filter fails. I have defined two custom analyzers namely, NGRAM and SYNONYMS.  
The definition of analysers;  
{  
"synonmizeindex2": {  
"settings": {  
"index": {  
"analysis": {  
"filter": {  
"stopword": {  
"type": "stop",  
"stopwords\_path": "settings/Stop\_Words.txt"  
},  
"synonym": {  
“ignore\_case": "true",  
"type": "synonym",  
"synonyms\_path": "settings/Synonyms\_Words.txt"  
}  
},  
"analyzer": {  
"synonym\_analyzer": {  
"filter": [  
“synonym"  
],  
"tokenizer": "whitespace"  
},  
"ngram": {  
"filter": [  
"lowercase",  
“asciifolding",  
"stopword",  
"kstem"  
],  
"char\_filter": [  
"whitespace\_mapping"  
],  
"type": "custom",  
"tokenizer": "standard"  
},  
"phrase": {  
"filter": [  
"lowercase"  
],  
"char\_filter": [  
"whitespace\_mapping"  
],  
"type": "custom",  
"tokenizer": "standard"  
}  
}  
}  
}  
}  
}  
}

The custom analyzers are mapped to the title and description fields respectively. Below is the mapping for the same.  
{  
"description": {  
"type": "text",  
"fields": {  
"ngrammed": {  
"type": "text",  
"analyzer": "ngram"  
},  
"synonymize": {  
"type": "text",  
"analyzer": "synonym\_analyzer"  
}  
},  
"analyzer": "phrase"  
},  
{  
"title": {  
"type": "text",  
"fields": {  
"ngrammed": {  
"type": "text",  
"analyzer": "ngram"  
},  
"synonymize": {  
"type": "text",  
"analyzer": "synonym\_analyzer"  
}  
},  
"analyzer": "phrase"  
},

Below is my query,  
"query": {  
"query\_string": {  
"query": "("and") AND (\*)",  
"fields": [  
"description.synonymize",  
"description.ngrammed",  
"tags",  
"title"  
]  
}  
}  
The issue now is, the synonyms works fine. However the stop-words isn’t working. The String defined in stop-words are being indexed. I need both, stop-words and synonyms to be implemented on title and description fields.  
What am I doing incorrect here, please suggest.

---

<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:** [June 5, 2018, 7:50am UTC](https://discuss.elastic.co/t/stop-words-analyzers-does-not-work-as-expected/130946/2 "2018-06-05T07:50:19Z")

</div>

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