# Stopword syntax with custom analyzer

**URL:** <https://discuss.elastic.co/t/stopword-syntax-with-custom-analyzer/21313>\
**Category:** Elasticsearch\
**Created:** [December 18, 2014, 1:24pm UTC](https://discuss.elastic.co/t/stopword-syntax-with-custom-analyzer/21313 "2014-12-18T13:24:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alix\_Martin](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Alix\_Martin](https://discuss.elastic.co/u/Alix_Martin)\
**Post date:** [December 18, 2014, 1:24pm UTC](https://discuss.elastic.co/t/stopword-syntax-with-custom-analyzer/21313/1 "2014-12-18T13:24:37Z")

</div>

Hi !

I tried to define a stopword list for my custom analyzer like this :

```
 "analysis" : {
    "tokenizer" : {
      "host_tokenizer" : {
        "type": "pattern",
        "pattern": "[a-zA-Z0-9]+",
        "group": 0
      }
    },
    "analyzer" : {
      "host_analyzer" : {
        "type" : "custom",
        "tokenizer" : "host_tokenizer",
        "filter" : ["lowercase"],
        "stopwords": ["www", "fr", "com"]
      }
    }
  }

```

But when I do this, the "stopwords" line is ignored.

Apparently you need to do

"analysis" : {  
"filter": {  
"hostname\_stop": {  
"type": "stop",  
"stopwords": ["www", "fr", "com"]  
}  
},  
"tokenizer" : {  
"host\_tokenizer" : {  
"type": "pattern",  
"pattern": "[a-zA-Z0-9]+",  
"group": 0  
}  
},  
"analyzer" : {  
"host\_analyzer" : {  
"type" : "custom",  
"tokenizer" : "host\_tokenizer",  
"filter" : ["lowercase", "hostname\_stop"],  
}  
}  
}

This is confusing because the first syntax is closer with what you find in  
the guide for standard analyzers  
[http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/using-stopwords.html](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/using-stopwords.html)

And there is no error or warning telling me that my "stopwords":  
["www", "fr", "com"]  
line got ignored.

Gist :

Alix Martin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d9ccb329-59e2-42af-9c86-6c11adeba2c0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d9ccb329-59e2-42af-9c86-6c11adeba2c0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alix\_Martin](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Alix\_Martin](https://discuss.elastic.co/u/Alix_Martin)\
**Post date:** [December 18, 2014, 1:29pm UTC](https://discuss.elastic.co/t/stopword-syntax-with-custom-analyzer/21313/2 "2014-12-18T13:29:49Z")

</div>

Gist link is [https://gist.github.com/Alix-Martin/7186e38459e88a474e13](https://gist.github.com/Alix-Martin/7186e38459e88a474e13)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/42895b25-8cf5-40ac-a12e-431e6a05e8d4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/42895b25-8cf5-40ac-a12e-431e6a05e8d4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:42am UTC](https://discuss.elastic.co/t/stopword-syntax-with-custom-analyzer/21313/3 "2017-07-06T00:42:55Z")

</div>


