# Best way to disable only one stopword in Elastic search

**URL:** <https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605>\
**Category:** Elasticsearch\
**Created:** [September 6, 2017, 2:55pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605 "2017-09-06T14:55:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramchandram](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@Ramchandram](https://discuss.elastic.co/u/Ramchandram)\
**Post date:** [September 6, 2017, 2:55pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/1 "2017-09-06T14:55:32Z")

</div>

HI Team, As we know 'AN' is stopword in Elastic search. I have executed the below query.

{  
“from”: 0,  
“size”: 100,  
“query”: {  
“bool”: {  
“must”: [  
{  
“match”: {  
“receiver”: {  
“query”: “AN”,  
“type”: “boolean”  
}  
}  
}  
]  
}  
}  
}

The query returns an empty results even though the document is available in ES

ES has the below document  
{  
\_index: messages  
\_type: ABCType  
\_id: 4571b1a9-d0eb-4e98-bc3f-562d2ee8e206  
\_version: 1  
\_score: 1  
\_source: {  
sender\_name: Unknown  
receiver: AN  
}  
}

here, What could be the best way to disable the stopword 'AN' only. Which analyzer i should use? Were to configure the analyzer?

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [September 6, 2017, 3:30pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/2 "2017-09-06T15:30:43Z")

</div>

Try this link  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-stop-tokenfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-stop-tokenfilter.html)

---

<div class="post-metadata">

**Author:** ![Ramchandram](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@Ramchandram](https://discuss.elastic.co/u/Ramchandram)\
**Post date:** [September 6, 2017, 3:48pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/3 "2017-09-06T15:48:38Z")

</div>

Thank you so much. Here I just need to disable only one stopword. So I will follow the above link and can create the analyzer.But, after adding the analyzer to index, does it really affects ES performance?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 6, 2017, 4:17pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/4 "2017-09-06T16:17:10Z")

</div>

There is no way to remove a stopword, you need to redefine a standard analyzer and provide the whole list of stop words that you need. [https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-analyzer.html#\_configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-analyzer.html#_configuration)

Here is the current list: [https://github.com/apache/lucene-solr/blob/e2521b2a8baabdaf43b92192588f51e042d21e97/lucene/core/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java#L45](https://github.com/apache/lucene-solr/blob/e2521b2a8baabdaf43b92192588f51e042d21e97/lucene/core/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java#L45)

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [September 6, 2017, 4:30pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/5 "2017-09-06T16:30:00Z")

</div>

the idea here is to use your own "stop words" list which does not include the ones you don't want, instead of using the standard "stop words" list. Once you define your own, you need to define your own "analyzer" and apply or use it where it is appropriate.

---

<div class="post-metadata">

**Author:** ![Ramchandram](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@Ramchandram](https://discuss.elastic.co/u/Ramchandram)\
**Post date:** [September 6, 2017, 4:38pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/6 "2017-09-06T16:38:24Z")

</div>

Thank you so much, guys.  
The below code snippet am going to use, is that fine? Also, What about the performance issues?

index :  
analysis :  
analyzer :  
default :  
type : standard  
stopwords : [ "a", "and", "are", "as", "at", "be", "but", "by",  
"for", "if", "in", "into", "is", "it",  
"no", "not", "of", "on", "or", "such",  
"that", "the", "their", "then", "there", "these",  
"they", "this", "to", "was", "will", "with"]

Note: I am using ES version 1.3.4 only.

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [September 6, 2017, 4:43pm UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/7 "2017-09-06T16:43:19Z")

</div>

the performance should not be worse than a longer stop words list (if I have to guess)

---

<div class="post-metadata">

**Author:** ![Ramchandram](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@Ramchandram](https://discuss.elastic.co/u/Ramchandram)\
**Post date:** [September 7, 2017, 6:44am UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/8 "2017-09-07T06:44:32Z")

</div>

Thank you so much, @thn .

Also, Can any one from elastic team confirms that the above one is correct?

---

<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:** [October 5, 2017, 6:44am UTC](https://discuss.elastic.co/t/best-way-to-disable-only-one-stopword-in-elastic-search/99605/9 "2017-10-05T06:44:48Z")

</div>

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