# Not able to use templates with Log Stash

**URL:** <https://discuss.elastic.co/t/not-able-to-use-templates-with-log-stash/361777>\
**Category:** Logstash\
**Created:** [June 20, 2024, 7:37am UTC](https://discuss.elastic.co/t/not-able-to-use-templates-with-log-stash/361777 "2024-06-20T07:37:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mradulag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mradulag/32/135420_2.png) [@mradulag](https://discuss.elastic.co/u/mradulag)\
**Post date:** [June 20, 2024, 7:37am UTC](https://discuss.elastic.co/t/not-able-to-use-templates-with-log-stash/361777/1 "2024-06-20T07:37:30Z")

</div>

I am trying to configure the number of shards in Logstash using templates, this is my template:

```auto
{
    "template": "logstash-*",
    "settings": {
        "number_of_shards": 32,
        "number_of_replicas" : 0
    }
}

```

This is my yaml file:

```auto
        output {
          elasticsearch {
            hosts => [""]
            user => ""
            password => ""
            ssl_verification_mode => "none"
            index => "logstash-2"
            manage_template => true
            template => "/mnt/logstash/logstash.json"
            template_name => "logstash"
            template_overwrite => false
          }
        }

```

I am facing this error:

````auto
[index_template] template doesn't support values of type: VALUE_STRING\"}],\"type\":\"x_content_parse_exception\",\"reason\":\"[1:13] [index_template] template doesn't support values of type: VALUE_STRING\"},\"status\":400}"}```
````

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 20, 2024, 12:40pm UTC](https://discuss.elastic.co/t/not-able-to-use-templates-with-log-stash/361777/2 "2024-06-20T12:40:55Z")

</div>

Which logstash version are you using? You didn't say.

Also, the template you shared is not a valid template and it is also not the same file being used based in your error.

This is an [example](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-template.html) of a valid template.

---

<div class="post-metadata">

**Author:** ![mradulag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mradulag/32/135420_2.png) [@mradulag](https://discuss.elastic.co/u/mradulag)\
**Post date:** [June 21, 2024, 3:20am UTC](https://discuss.elastic.co/t/not-able-to-use-templates-with-log-stash/361777/3 "2024-06-21T03:20:22Z")

</div>

Thank you very much for the reply, the template format was wrong and I am now able to use it correctly
