# Filebeat fails to connect because template

**URL:** https://discuss.elastic.co/t/filebeat-fails-to-connect-because-template/188038
**Category:** Beats
**Tags:** filebeat
**Created:** [June 28, 2019, 11:22am UTC](https://discuss.elastic.co/t/filebeat-fails-to-connect-because-template/188038 "2019-06-28T11:22:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![acematrix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/acematrix/32/47036_2.png) [@acematrix](https://discuss.elastic.co/u/acematrix)
#### Post date: [June 28, 2019, 11:22am UTC](https://discuss.elastic.co/t/filebeat-fails-to-connect-because-template/188038/1 "2019-06-28T11:22:07Z")

</div>

Hi elastic community,

I have a elasticsearch cluster running version `"number": "7.1.1"`

I have followed the instructions to install filebeat found here: [https://www.elastic.co/docker-kubernetes-container-monitoring](https://www.elastic.co/docker-kubernetes-container-monitoring)

^ the problem with these instructions is that it applies version `6.3.2` of filebeat, so it wasnt working.

I edited the yaml, and made it filebeat version `7.1.1`, then applied it with `kubectl delete -f <file> ; kubectl apply -f <file>`

* * *

* * *

**Now, filebeat is having this error:**

```auto
2019-06-28T09:04:33.254Z	ERROR	pipeline/output.go:74	Failed to connect: Connection marked as failed because the onConnect callback failed: Error loading Elasticsearch template: could not load template. Elasticsearh returned: couldn't load template: couldn't load json.

Error: 400 Bad Request: err_400_bad_request.json

Response body: response_body.json

Template is: template.json

```

I have extracted the json files from the error message and attached them here:

`err_400_bad_request.json`: [https://bin.privacytools.io/?3cbfd54af020b060#7cPwR9ixYklImqbWWg/lV1cJvpYUUkuY6BDMkFbF2Yw=](https://bin.privacytools.io/?3cbfd54af020b060#7cPwR9ixYklImqbWWg/lV1cJvpYUUkuY6BDMkFbF2Yw=)

`response_body.json`: [https://bin.privacytools.io/?183dfc854ed7f198#bZgZR49vL7Jaj6n+77mYMCYtinqQ1fPuHyExFTtLGhc=](https://bin.privacytools.io/?183dfc854ed7f198#bZgZR49vL7Jaj6n+77mYMCYtinqQ1fPuHyExFTtLGhc=)

`template.json`: [https://bin.privacytools.io/?b71586ac8d2be1a7#D08XYpC15r3R02YPPT19BSl1ahfMP+e7aptAYB7CuGo=](https://bin.privacytools.io/?b71586ac8d2be1a7#D08XYpC15r3R02YPPT19BSl1ahfMP+e7aptAYB7CuGo=)

* * *

* * *

What do I need to do to fix this?  
My goal is to use filebeat on my kubernetes cluster, and see the data in kibana.

I have tried to delete the templates, but I am new to kibana and I am unsure if that helped or didnt.

---

<div class="post-metadata">

### Author: ![acematrix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/acematrix/32/47036_2.png) [@acematrix](https://discuss.elastic.co/u/acematrix)
#### Post date: [June 28, 2019, 11:36am UTC](https://discuss.elastic.co/t/filebeat-fails-to-connect-because-template/188038/2 "2019-06-28T11:36:34Z")

</div>

i found the issue:

it was this config: `output.elasticsearch.hosts: ["elasticsearch-hostname:9200"]`

it needed to be this: `output.elasticsearch.hosts: ["http://elasticsearch-hostname:9200"]`

it was missing this: `http://` on the hostname

---

<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 26, 2019, 11:38am UTC](https://discuss.elastic.co/t/filebeat-fails-to-connect-because-template/188038/3 "2019-07-26T11:38:08Z")

</div>

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