# Custom elasticsearch template

**URL:** <https://discuss.elastic.co/t/custom-elasticsearch-template/142643>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 1, 2018, 7:12pm UTC](https://discuss.elastic.co/t/custom-elasticsearch-template/142643 "2018-08-01T19:12:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_Metcalf](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@Brandon\_Metcalf](https://discuss.elastic.co/u/Brandon_Metcalf)\
**Post date:** [August 1, 2018, 7:12pm UTC](https://discuss.elastic.co/t/custom-elasticsearch-template/142643/1 "2018-08-01T19:12:06Z")

</div>

I'm trying to load a custom elasticsearch template when filebeat starts up. The relevant part of my latest filebeat.yml looks like:

```auto
output.elasticsearch:
  enabled: true
  hosts: ["<%= @elasticsearch %>:443"]
  protocol: "https"
  index: "audit-%{+yyyyMMdd}"

setup.template:
  name: 'audit'
  pattern: 'audit-*'
  json:
    enabled: true
    path: 'audit.template.json'
    name: 'audit'
  enabled: true
  settings:
    index.number_of_shards: 3

```

But a default mapping is applied to the index and no template is defined. The docs say the setup.template.json.\* options are experimental, so not sure if they do indeed work.

Regardless, how can I load a json template defined in audit.template.json? I've tried every option combination based on reading the docs and can't get it to work.

Thanks.

---

<div class="post-metadata">

**Author:** ![Magnus\_Kessler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnus_kessler/32/42001_2.png) [@Magnus\_Kessler](https://discuss.elastic.co/u/Magnus_Kessler)\
**Post date:** [August 1, 2018, 7:26pm UTC](https://discuss.elastic.co/t/custom-elasticsearch-template/142643/2 "2018-08-01T19:26:58Z")

</div>

Assuming that the template has the structure expected by the [`_template` API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html), you can simply upload your template with `curl` or the Kibana console.

See the [metricbeat documentation](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-template.html#load-template-manually-alternate) on how to export templates from metricbeat.

---

<div class="post-metadata">

**Author:** ![Brandon\_Metcalf](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@Brandon\_Metcalf](https://discuss.elastic.co/u/Brandon_Metcalf)\
**Post date:** [August 1, 2018, 8:45pm UTC](https://discuss.elastic.co/t/custom-elasticsearch-template/142643/3 "2018-08-01T20:45:50Z")

</div>

Thanks. Yes, I'm able to install the template manually, but just hoping to have filebeat do it. I'm doing all of this in chef, so I just added some curl goodness to do it that way.

---

<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 29, 2018, 8:46pm UTC](https://discuss.elastic.co/t/custom-elasticsearch-template/142643/4 "2018-08-29T20:46:00Z")

</div>

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