# Best way to create time-series index in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/best-way-to-create-time-series-index-in-elasticsearch/60031>\
**Category:** Elasticsearch\
**Created:** [September 8, 2016, 2:35am UTC](https://discuss.elastic.co/t/best-way-to-create-time-series-index-in-elasticsearch/60031 "2016-09-08T02:35:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mithril](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@mithril](https://discuss.elastic.co/u/mithril)\
**Post date:** [September 8, 2016, 2:35am UTC](https://discuss.elastic.co/t/best-way-to-create-time-series-index-in-elasticsearch/60031/1 "2016-09-08T02:35:23Z")

</div>

I have a news gather system(time base searching), which could fit time series index very well.  
But I wonder what is the best way to create time-series index. Offcial doc only [suggest to using it](https://www.elastic.co/guide/en/elasticsearch/reference/current/date-math-index-names.html) without how.

There are two ways I consider:

1. Just insert data let elasticsearch auto create index

2. Use a crontab to auto create time series index with mapping

As I see `logstash` and `marvel` both create time series index, how do they create index ?  
It would be very nice If I can auto create index with custom mapping .

---

<div class="post-metadata">

**Author:** ![JoarSvensson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joarsvensson/32/8740_2.png) [@JoarSvensson](https://discuss.elastic.co/u/JoarSvensson)\
**Post date:** [September 8, 2016, 7:03am UTC](https://discuss.elastic.co/t/best-way-to-create-time-series-index-in-elasticsearch/60031/2 "2016-09-08T07:03:07Z")

</div>

How are you planning to index the data? Using a custom application or Logstash for example?

The indexing system is responsible by design to create new indices when ever needed, e.g when using Logstash this is the default behaviour.

Just create the mapping you like as a template ([https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)), upload it to ES and then base all your new indices on this template.

---

<div class="post-metadata">

**Author:** ![mithril](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@mithril](https://discuss.elastic.co/u/mithril)\
**Post date:** [September 8, 2016, 7:24am UTC](https://discuss.elastic.co/t/best-way-to-create-time-series-index-in-elasticsearch/60031/3 "2016-09-08T07:24:03Z")

</div>

I use a python script to index the data, `template` sulotion is exact what I looking for , thanks!

---

<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, 10:21pm UTC](https://discuss.elastic.co/t/best-way-to-create-time-series-index-in-elasticsearch/60031/4 "2017-07-05T22:21:54Z")

</div>


