# Metricbeat and Heartbeat 8.x custom index Name should pickup from template ,but creates always bedefault index name

**URL:** <https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 4, 2023, 12:11pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557 "2023-07-04T12:11:41Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 5, 2023, 2:38pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557/9 "2023-07-05T14:38:25Z")

</div>

can you please try exactly my example

> [@PRASHANT\_MEHTA](#):
>
> ` **index: "cis-metric-%{+yyyy.MM.dd}"** `

Not correct that is what is causing the issue..

Can you please try _ **Exactly** _ my config just change the host and u/p.

```auto
output.elasticsearch:
  hosts: ["https://localhost:9200"]
  index: "cis-metric-%{[agent.version]}" 
  username: "elastic"
  password: "password"
  ssl.verification_mode: "none"

setup.ilm.enabled: true
setup.ilm.check_exists: true
setup.ilm.rollover_alias: cis-metric
setup.ilm.pattern: '{now/d}-000001'
setup.ilm.overwrite: false

setup.template.enabled: true  
setup.template.name: "cis-metric-%{[agent.version]}" 
setup.template.pattern: "cis-metric-%{[agent.version]}" 
setup.template.overwrite: false 
setup.ilm.policy_name: cis-metric

```

---

_[View the full topic](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557)._
