# Adding compound word token filter to a template results in “Failed to install template - response code 500 contacting Elasticsearch”

**URL:** <https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914>\
**Category:** Logstash\
**Created:** [July 17, 2019, 8:12am UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914 "2019-07-17T08:12:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marta1](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Marta1](https://discuss.elastic.co/u/Marta1)\
**Post date:** [July 17, 2019, 8:12am UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/1 "2019-07-17T08:12:55Z")

</div>

After adding hyphenation decompounder to my custom template, logstash fails to install it: "Got response code '500' contacting Elasticsearch at URL...".

I have already had different token filters like stopwords and stemmers and the template used to work just fine. Also dictionary decompounder with a word list as an array works. Problems start when I supply a path to a word list and for hyphenation decompounder when I supply paths for both word list and hyphenation patterns. I have tried both, absolute and relative paths. As I work with kubernetes, I have made sure that the files exist on the pod with configmap. The elasticsearch version is 7.1.1. and logstash version 6.2.3. My assumption is that either the paths can't be resolved or the files are not compatible with my elasticsearch or logstash version. However, I have implemented the decompounder according to the manual from the elasticsearch documentation: [Compound Word Token Filters | Elasticsearch Guide [7.1] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.1/analysis-compound-word-tokenfilter.html)

Here are the settings for my index:

> "index.refresh\_interval":"5s",  
> "analysis":{  
> "filter":{  
> "english\_stop":{  
> "type":"stop",  
> "stopwords":"_english_"  
> },  
> "light\_english\_stemmer":{  
> "type":"stemmer",  
> "language":"light\_english"  
> },  
> "english\_possessive\_stemmer":{  
> "type":"stemmer",  
> "language":"possessive\_english"  
> },  
> "german\_stop":{  
> "type":"stop",  
> "stopwords":"_german_"  
> },  
> "german\_stemmer":{  
> "type":"stemmer",  
> "language":"light\_german"  
> },  
> "german\_hyphenation\_decompounder": {  
> "type" : "hyphenation\_decompounder",  
> "word\_list\_path": "/user/share/logstash/config/german\_dictionary.txt",  
> "hyphenation\_patterns\_path": "/user/share/logstash/config/hyphentation\_grammar\_ngerman.xml",  
> "max\_subword\_size": 22  
> }  
> },  
> "analyzer":{  
> "custom\_english":{  
> "tokenizer":"standard",  
> "filter":[  
> "lowercase",  
> "english\_stop",  
> "english\_possessive\_stemmer",  
> "light\_english\_stemmer"  
> ]  
> },  
> "custom\_german":{  
> "type": "custom",  
> "tokenizer":"standard",  
> "filter":[  
> "lowercase",  
> "german\_stop",  
> "german\_normalization",  
> "german\_stemmer",  
> "german\_hyphenation\_decompounder"  
> ]  
> }  
> }  
> }  
> },

And this is how I install my custom template:

> template =\> "/user/share/logstash/config/elasticsearch-template.custom.json"  
> template\_overwrite =\> true  
> template\_name =\> "mytemplate"

I would like to know what the error response '500' means and why I receive this.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 17, 2019, 1:14pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/2 "2019-07-17T13:14:18Z")

</div>

Is there an error message logged in the elasticsearch logs associated with this 500 error?

---

<div class="post-metadata">

**Author:** ![Marta1](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Marta1](https://discuss.elastic.co/u/Marta1)\
**Post date:** [July 17, 2019, 4:02pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/3 "2019-07-17T16:02:13Z")

</div>

Yes, this is the whole error message:

> [ERROR] 2019-07-17 16:00:39.612 [Ruby-0-Thread-5: /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/common.rb:42] elasticsearch - Failed to install template. {:message=\>"Got response code '500' contacting Elasticsearch at URL '[http://elasticsearch-master:9200/\_template/mytemplate](http://elasticsearch-master:9200/_template/mytemplate)'", :class=\>"LogStash::Outputs::Elasticsearch::HttpClient::Pool::BadResponseCodeError", :backtrace=\>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http\_client/manticore\_adapter.rb:80:in `perform_request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:291:in `perform\_request\_to\_url'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http\_client/pool.rb:278:in `block in perform_request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:373:in `with\_connection'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http\_client/pool.rb:277:in `perform_request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:285:in `block in put'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http\_client.rb:352:in `template_put'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/http_client.rb:86:in `template\_install'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/template\_manager.rb:28:in `install'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/template_manager.rb:16:in `install\_template'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/common.rb:130:in `install_template'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.1.0-java/lib/logstash/outputs/elasticsearch/common.rb:51:in `block in setup\_after\_successful\_connection'"]}

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 17, 2019, 4:02pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/4 "2019-07-17T16:02:47Z")

</div>

I asked about an error in the elasticsearch logs, not in the logstash logs.

---

<div class="post-metadata">

**Author:** ![Marta1](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Marta1](https://discuss.elastic.co/u/Marta1)\
**Post date:** [July 17, 2019, 4:09pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/5 "2019-07-17T16:09:03Z")

</div>

Then no, I can't see any other errors.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 17, 2019, 4:33pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/6 "2019-07-17T16:33:31Z")

</div>

The word\_list\_path strings refer to files on the elasticsearch server, right?

---

<div class="post-metadata">

**Author:** ![Marta1](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Marta1](https://discuss.elastic.co/u/Marta1)\
**Post date:** [July 18, 2019, 7:01am UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/7 "2019-07-18T07:01:19Z")

</div>

As I use kubernetes, I have pasted the files into the same folder as the template file on the logstash pod. Logstash configuration files are in the same folder too.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 18, 2019, 9:52am UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/8 "2019-07-18T09:52:29Z")

</div>

I cannot test it to be sure, but I think the word list files should be on the elasticsearch server, not the logstash server.

---

<div class="post-metadata">

**Author:** ![Marta1](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Marta1](https://discuss.elastic.co/u/Marta1)\
**Post date:** [July 18, 2019, 12:19pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/9 "2019-07-18T12:19:19Z")

</div>

But then the error should appear on the elasticsearch side and not in logstash right? Do you know the difference between the error 400 and 500, because when I change the paths a bit I receive 400.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 18, 2019, 12:22pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/10 "2019-07-18T12:22:08Z")

</div>

> [@Marta1](#):
>
> But then the error should appear on the elasticsearch side and not in logstash right?

If elasticsearch is returning an error I would always expect it to log something on its side. The status code does not contain enough information to diagnose the problem. You need the error message to do that.

---

<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:** [August 15, 2019, 12:22pm UTC](https://discuss.elastic.co/t/adding-compound-word-token-filter-to-a-template-results-in-failed-to-install-template-response-code-500-contacting-elasticsearch/190914/11 "2019-08-15T12:22:12Z")

</div>

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