# Java API to create scripted templates

**URL:** <https://discuss.elastic.co/t/java-api-to-create-scripted-templates/26235>\
**Category:** Elasticsearch\
**Created:** [July 24, 2015, 11:39am UTC](https://discuss.elastic.co/t/java-api-to-create-scripted-templates/26235 "2015-07-24T11:39:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulnehru](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rahulnehru](https://discuss.elastic.co/u/rahulnehru)\
**Post date:** [July 24, 2015, 11:39am UTC](https://discuss.elastic.co/t/java-api-to-create-scripted-templates/26235/1 "2015-07-24T11:39:55Z")

</div>

We can use the Java API to create indexed templates using the

```
client.admin().indices().preparePutTemplate("template1")
                    .setSource("...") //some source 
                    .execute().actionGet();

```

Is is possible to use the Java API to create or mock creating file (scripts) templates stored in the `config/scripts` folder for testing purposes?

---

<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 5, 2017, 11:59pm UTC](https://discuss.elastic.co/t/java-api-to-create-scripted-templates/26235/2 "2017-07-05T23:59:16Z")

</div>


