# How to create index template or pipeline in an es plugin

**URL:** <https://discuss.elastic.co/t/how-to-create-index-template-or-pipeline-in-an-es-plugin/212582>\
**Category:** Elasticsearch\
**Created:** [December 20, 2019, 1:57am UTC](https://discuss.elastic.co/t/how-to-create-index-template-or-pipeline-in-an-es-plugin/212582 "2019-12-20T01:57:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yanchun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yanchun/32/35596_2.png) [@Yanchun](https://discuss.elastic.co/u/Yanchun)\
**Post date:** [December 20, 2019, 1:57am UTC](https://discuss.elastic.co/t/how-to-create-index-template-or-pipeline-in-an-es-plugin/212582/1 "2019-12-20T01:57:38Z")

</div>

Hi, is there any example to create index template or pipeline in an es plugin?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 20, 2019, 9:13am UTC](https://discuss.elastic.co/t/how-to-create-index-template-or-pipeline-in-an-es-plugin/212582/2 "2019-12-20T09:13:52Z")

</div>

you can create a class in `Plugin.createComponents`, that uses the `Client` handed over in the arguments to create an index template or an pipeline.

Note that you may need to deal with retries (or implement this class as a cluster state listener) to make sure you only add those, when they are not added yet and when your node is part of a cluster.

---

<div class="post-metadata">

**Author:** ![Yanchun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yanchun/32/35596_2.png) [@Yanchun](https://discuss.elastic.co/u/Yanchun)\
**Post date:** [December 26, 2019, 2:35am UTC](https://discuss.elastic.co/t/how-to-create-index-template-or-pipeline-in-an-es-plugin/212582/3 "2019-12-26T02:35:22Z")

</div>

Many Thanks, I will have a try.

---

<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 23, 2020, 2:35am UTC](https://discuss.elastic.co/t/how-to-create-index-template-or-pipeline-in-an-es-plugin/212582/4 "2020-01-23T02:35:24Z")

</div>

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