# No matching index template found for data streamd

**URL:** <https://discuss.elastic.co/t/no-matching-index-template-found-for-data-streamd/307485>\
**Category:** Beats\
**Tags:** metricbeat, datastreams\
**Created:** [June 17, 2022, 9:12am UTC](https://discuss.elastic.co/t/no-matching-index-template-found-for-data-streamd/307485 "2022-06-17T09:12:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maksym\_Postument](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maksym_postument/32/106661_2.png) [@Maksym\_Postument](https://discuss.elastic.co/u/Maksym_Postument)\
**Post date:** [June 17, 2022, 9:12am UTC](https://discuss.elastic.co/t/no-matching-index-template-found-for-data-streamd/307485/1 "2022-06-17T09:12:33Z")

</div>

Hello, i am trying to run metricbeat setup command to create datastream but i am getting an error

```auto
./metricbeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["https://${ES_URL}"]' -E 'output.elasticsearch.ssl.certificate_authorities=[${CA_CERT}]' -E 'setup.template.pattern="metricbeat-8.*"' -E 'setup.template.name="metricbeat"'
Overwriting ILM policy is disabled. Set `setup.ilm.overwrite: true` for enabling.

Exiting: error loading template: failed to put data stream: could not put data stream: 400 Bad Request: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no matching index template found for data stream [metricbeat]"}],"type":"illegal_argument_exception","reason":"no matching index template found for data stream [metricbeat]"},"status":400}. Response body: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no matching index template found for data stream [metricbeat]"}],"type":"illegal_argument_exception","reason":"no matching index template found for data stream [metricbeat]"},"status":400}

```

Any ideas how can i specify custom template and pattern without getting this error?  
Also i tired as this doc suggested [Change the index name | Metricbeat Reference [8.2] | Elastic](https://www.elastic.co/guide/en/beats/metricbeat/current/change-index-name.html)

To change datastream name but still getting the same error

---

<div class="post-metadata">

**Author:** ![Silver137](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Silver137](https://discuss.elastic.co/u/Silver137)\
**Post date:** [June 21, 2022, 5:59am UTC](https://discuss.elastic.co/t/no-matching-index-template-found-for-data-streamd/307485/2 "2022-06-21T05:59:32Z")

</div>

After fighting a lot with index templates auto-load and setups:

Disable all the auto-setup.

```auto
setup.template.enabled: false

```

Export the JSON configuration:

```auto
./metricbeat export template > metricbeat.template.json

```

Copy the content of the file and go to the Kibana Console:

```auto
PUT /_index_template/the_name_for_your_template
{
/* The content of metricbeat.template.json */
/* Customize everything you want, like number of shards or ILM policy, or pattern */
}

```

For more friendly tweaks go to Kibana =\> Stack Mangement =\> Index Templates and make the changes you need when debuging the indexing.

This is the most handy method, for my point of view.

---

<div class="post-metadata">

**Author:** ![Maksym\_Postument](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maksym_postument/32/106661_2.png) [@Maksym\_Postument](https://discuss.elastic.co/u/Maksym_Postument)\
**Post date:** [June 21, 2022, 8:29am UTC](https://discuss.elastic.co/t/no-matching-index-template-found-for-data-streamd/307485/3 "2022-06-21T08:29:47Z")

</div>

I tried with export but json is too big to store it in config map. I am executing metricbeat setup using kubernetes job when i am running helm install. And as output i am using logstash and not elasticsearch that's why i need separate job which will have elasticsearch output to setup template

---

<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 19, 2022, 10:30am UTC](https://discuss.elastic.co/t/no-matching-index-template-found-for-data-streamd/307485/4 "2022-07-19T10:30:18Z")

</div>

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