# Need help understanding index templates

**URL:** <https://discuss.elastic.co/t/need-help-understanding-index-templates/258127>\
**Category:** Elasticsearch\
**Created:** [December 9, 2020, 1:18pm UTC](https://discuss.elastic.co/t/need-help-understanding-index-templates/258127 "2020-12-09T13:18:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhan0618](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@madhan0618](https://discuss.elastic.co/u/madhan0618)\
**Post date:** [December 9, 2020, 1:18pm UTC](https://discuss.elastic.co/t/need-help-understanding-index-templates/258127/1 "2020-12-09T13:18:18Z")

</div>

I have metricbeat installed/set up. I wanted my own index name so i put the below in metricbeat.yml file

```auto

index: "adm_jkafka"

```

this gave me an error stating that when i want to use my own index, i need to mention the

```auto

setup.template.name and setup.template.pattern

```

i put the below

```auto

setup.template.name: "adm_jkafka"
setup.template.pattern: "*jkafka*"

```

I dont have a template with this name.

when i start metricbeat it is throwing the below error

```auto

ERROR [publisher_pipeline_output] pipeline/output.go:154 Failed to connect to backoff(elasticsearch(http:// **** :9200)): Connection marked as failed because the onConnect callback failed: resource 'metricbeat-7.10.0' exists, but it is not an alias

```

this looks like is trying to use the default template becuase i havent defined one.

How do i define a template called adm\_jkafka with the same fields as metricbeat since this is going to be metricbeat.

OR

should i be creating an alias called adm\_jkafka pointing to metricbeat-7.10.0 if i do create an alias what should be the setup.template.pattern field set to?

---

<div class="post-metadata">

**Author:** ![madhan0618](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@madhan0618](https://discuss.elastic.co/u/madhan0618)\
**Post date:** [December 9, 2020, 3:43pm UTC](https://discuss.elastic.co/t/need-help-understanding-index-templates/258127/2 "2020-12-09T15:43:13Z")

</div>

Update:

did a export of metric beat template and made the below change to the JSON on the top

```auto

 "index_patterns": [
    "mftadm_jkafka*"
  ],

```

then used below

```auto
curl -XPUT -u mftadm:mftadm -H 'Content-Type: application/json' http:// ***** :9200/_template/mftadm_jkafka -d@metricbeat.template.json

```

this i see created an index template

then when i start metricbeat i still see the below error

```auto

2020-12-09T10:33:18.924-0500 ERROR [publisher_pipeline_output] pipeline/output.go:154 Failed to connect to backoff(elasticsearch(http:// ***** :9200)): Connection marked as failed because the onConnect callback failed: resource 'metricbeat-7.10.0' exists, but it is not an alias

```

---

<div class="post-metadata">

**Author:** ![madhan0618](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@madhan0618](https://discuss.elastic.co/u/madhan0618)\
**Post date:** [December 9, 2020, 5:55pm UTC](https://discuss.elastic.co/t/need-help-understanding-index-templates/258127/3 "2020-12-09T17:55:54Z")

</div>

Update:

i had to add this to the metricbeat.yml for it use my custom index name

setup.ilm.enabled: false

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 9, 2020, 10:31pm UTC](https://discuss.elastic.co/t/need-help-understanding-index-templates/258127/4 "2020-12-09T22:31:35Z")

</div>

It's not recommended to use a single index to hold time based data. You cannot easily remove old data from such an index.

---

<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:** [January 6, 2021, 10:31pm UTC](https://discuss.elastic.co/t/need-help-understanding-index-templates/258127/5 "2021-01-06T22:31:39Z")

</div>

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