# How to get a continuous transform to write to multiple indexes

**URL:** <https://discuss.elastic.co/t/how-to-get-a-continuous-transform-to-write-to-multiple-indexes/238391>\
**Category:** Elasticsearch\
**Created:** [June 24, 2020, 6:24am UTC](https://discuss.elastic.co/t/how-to-get-a-continuous-transform-to-write-to-multiple-indexes/238391 "2020-06-24T06:24:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mykael](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@mykael](https://discuss.elastic.co/u/mykael)\
**Post date:** [June 24, 2020, 6:24am UTC](https://discuss.elastic.co/t/how-to-get-a-continuous-transform-to-write-to-multiple-indexes/238391/1 "2020-06-24T06:24:53Z")

</div>

When I load my data through logstash I specify an index name pattern, to split the index up by time.

I now have a continuous transform running, grouping by a 1 hour date histogram, against that data. Problem is it's writing it all to a single index. How do I do the equivalent of logstash putting date elements into the index name? sales\_hourly-2020-02, sales\_hourly-2020-03, sales\_hourly-2020-04 etc...

---

<div class="post-metadata">

**Author:** ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)\
**Post date:** [June 24, 2020, 7:24pm UTC](https://discuss.elastic.co/t/how-to-get-a-continuous-transform-to-write-to-multiple-indexes/238391/2 "2020-06-24T19:24:59Z")

</div>

Transform creates the destination index for you if you haven't. That means, you can create the destination index yourself or for this case use aliases and [index life-cycle management](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-management.html).

---

<div class="post-metadata">

**Author:** ![mykael](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@mykael](https://discuss.elastic.co/u/mykael)\
**Post date:** [June 25, 2020, 3:35am UTC](https://discuss.elastic.co/t/how-to-get-a-continuous-transform-to-write-to-multiple-indexes/238391/3 "2020-06-25T03:35:11Z")

</div>

Thanks, looks like it'll work, even if it's not quite a smooth as the time based logstash naming (mostly a concern when bulk indexing historical data).

You've got a typo on this page: [https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html)

The sample template ( \_template/timeseries\_template) shown is incorrect. The settings section needs to be inside a template object.

```
{
  "index_patterns": ["timeseries-*"], 
  "template": {  
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 1,
      "index.lifecycle.name": "timeseries_policy",      
      "index.lifecycle.rollover_alias": "timeseries"    
    }
  }  
}
```

---

<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 23, 2020, 3:35am UTC](https://discuss.elastic.co/t/how-to-get-a-continuous-transform-to-write-to-multiple-indexes/238391/4 "2020-07-23T03:35:14Z")

</div>

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