# \[ERROR\]\[logstash.outputs.elasticsearch\] Failed to install template. {:message=\>"Got response code '400' contacting Elasticsearch at URL 'http://localhost:9200/\_template/jose\_prueba\_v14'"

**URL:** <https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582>\
**Category:** Logstash\
**Created:** [October 19, 2020, 4:45pm UTC](https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582 "2020-10-19T16:45:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joseantonio.sanchez](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@joseantonio.sanchez](https://discuss.elastic.co/u/joseantonio.sanchez)\
**Post date:** [October 19, 2020, 4:45pm UTC](https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582/1 "2020-10-19T16:45:59Z")

</div>

Good afternoon,

I'm having problems with logstash when putting a template file to perform a mapping.

in my logstash .conf file, I put "output {  
elasticsearch {  
hosts =\> ['localhost: 9200']  
index =\> 'jose\_test\_v14'  
manage\_template =\> true  
template =\> '/etc/logstash/conf.d/v14.json'  
template\_name =\> 'jose\_test\_v14'  
template\_overwrite =\> true

}  
stdout {}  
}

and within V14, I have the structure of the:  
{  
"template": "jose\_pruebe\_v14",  
"settings": {  
"number\_of\_shards": 1,  
"number\_of\_replicas": 0,  
"index": {  
"query": {"default\_field": "@message"},  
"store": {"compress": {"stored": true, "tv": true}}  
}  
},  
"mapping": {  
"\_Doc": {  
"\_all": {"enabled": false},  
"\_source": {"compress": true},  
"dynamic\_templates": [  
{  
"string\_template": {  
"match": "\*",  
"mapping": {"type": "string", "index": "not\_analyzed"},  
"match\_mapping\_type": "string"  
}  
}  
],  
"properties": {  
"location": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},

but when I run:  
Failed to install template. {: message =\> "Got response code '400' contacting Elasticsearch at URL 'http: // localhost: 9200 / \_template / jose\_pruebe\_v14'",

I do not know what is wrong so that I do not get the template for the mapping, since the dates, I do not want them with the elastic format it sets by default but

```
    "date_variable": {
      "type": "date",
      "format": "yyyy-MM-DD"
    },

```

any guidance that can help me to find the problem?  
I have been looking at some people who have had the same problem, but I have not found the solution so that this does not happen.

attentively

José

---

<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:** [October 19, 2020, 5:39pm UTC](https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582/2 "2020-10-19T17:39:04Z")

</div>

What error is logged in the elasticsearch log?

---

<div class="post-metadata">

**Author:** ![joseantonio.sanchez](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@joseantonio.sanchez](https://discuss.elastic.co/u/joseantonio.sanchez)\
**Post date:** [October 20, 2020, 7:48am UTC](https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582/3 "2020-10-20T07:48:27Z")

</div>

Hello Badger,

in the elasticsearch log, i havent error.  
the error is in the log of logstash.

[2020-10-20T07:42:44,095][INFO][logstash.outputs.elasticsearch] Installing elasticsearch template to \_template/jose\_prueba\_v15  
[2020-10-20T07:42:44,135][ERROR][logstash.outputs.elasticsearch] Failed to install template. {:message=\>"Got response code '400' contacting Elasticsearch at URL '[http://localhost:9200/\_template/jose\_prueba\_v15](http://localhost:9200/_template/jose_prueba_v15)'", :class=\>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError", :backtrace=\>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-9.4.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-9.4.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-9.4.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-9.4.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-9.4.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-9.4.0-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:285:in `block in Pool'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-9.4.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-9.4.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-9.4.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-9.4.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-9.4.0-java/lib/logstash/outputs/elasticsearch/common.rb:129:in `install_template'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-9.4.0-java/lib/logstash/outputs/elasticsearch/common.rb:50:in `block in setup\_after\_successful\_connection'"]}  
[2020-10-20T07:42:44,235][INFO][logstash.pipeline] Pipeline started successfully {:pipeline\_id=\>"main", :thread=\>"#\<Thread:0x556ebe27 run\>"}  
[2020-10-20T07:42:44,275][INFO][filewatch.observingtail] START, creating Discoverer, Watch with file and sincedb collections  
[2020-10-20T07:42:44,278][INFO][logstash.agent] Pipelines running {:count=\>1, :running\_pipelines=\>[:main], :non\_running\_pipelines=\>}  
[2020-10-20T07:42:44,496][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9605}

---

<div class="post-metadata">

**Author:** ![joseantonio.sanchez](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@joseantonio.sanchez](https://discuss.elastic.co/u/joseantonio.sanchez)\
**Post date:** [October 20, 2020, 7:54am UTC](https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582/4 "2020-10-20T07:54:26Z")

</div>

I have a elasticsearch:  
Version: 6.8.11, Build: default/deb/00bf386/2020-07-09T19:08:08.940669Z, JVM: 11.0.8

and Logstash:  
logstash 6.8.12

and my template.json  
{  
"template": "jose\_prueba\_v15",  
"settings" : {  
"number\_of\_shards" : 1,  
"number\_of\_replicas" : 0,  
"index" : {  
"query" : { "default\_field" : "@message" },  
"store" : { "compress" : { "stored" : true, "tv": true } }  
}  
},  
"mapping": {  
"\_doc": {  
"\_all": { "enabled": false },  
"\_source": { "compress": true },  
"dynamic\_templates": [  
{  
"string\_template" : {  
"match" : "\*",  
"mapping": { "type": "string", "index": "not\_analyzed" },  
"match\_mapping\_type" : "string"  
}  
}  
],  
"properties": {  
"Localidad": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"Fecha": {  
"type": "date",  
"format": "yyyy-MM-DD"  
}  
}  
}  
}  
}  
it is validated and say me that it 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:** [November 17, 2020, 7:54am UTC](https://discuss.elastic.co/t/error-logstash-outputs-elasticsearch-failed-to-install-template-message-got-response-code-400-contacting-elasticsearch-at-url-http-localhost-9200-template-jose-prueba-v14/252582/5 "2020-11-17T07:54:32Z")

</div>

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