# Create daily index

**URL:** <https://discuss.elastic.co/t/create-daily-index/200053>\
**Category:** Elasticsearch\
**Created:** [September 18, 2019, 4:16pm UTC](https://discuss.elastic.co/t/create-daily-index/200053 "2019-09-18T16:16:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoav\_Ben\_Moha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoav_ben_moha/32/46202_2.png) [@Yoav\_Ben\_Moha](https://discuss.elastic.co/u/Yoav_Ben_Moha)\
**Post date:** [September 18, 2019, 4:16pm UTC](https://discuss.elastic.co/t/create-daily-index/200053/1 "2019-09-18T16:16:19Z")

</div>

I would like to create a daily index in elastic 7  
Somthing like the one in the example bellow:

> [elasticsearch@elk7-lab ~]$ curl -X GET '[http://172.xx.xxx.xx:9200/\_cat/indices?v](http://172.xx.xxx.xx:9200/_cat/indices?v)'  
> health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
> ....  
> green open .monitoring-es-7-2019.09.18 g6zJRXCGR3qK9bRiYjfTNg 1 0 93679 105938 55mb 55mb  
> .....

I run the following command:

```
[elasticsearch@elk7-lab ~]$ curl -X PUT 'http://172.xx.xxx.xx:9200/yoav1_yyyy.mm.dd'
{"acknowledged":true,"shards_acknowledged":true,"index":"yoav1_yyyy.mm.dd"}

```

And it show that the index create as a string and not with the date format :

> [elasticsearch@elk7-lab ~]$ curl -X GET '[http://172.xx.xxx.xx:9200/\_cat/indices?v](http://172.xx.xxx.xx:9200/_cat/indices?v)'  
> yellow open yoav1\_yyyy.mm.dd j85qyv91ToGUCbAl1mbCiA 1 1 0 0 230b 230b

Please advise how create a daily index.  
P.S : I am not using logstash . I am uploading the data into Elasticsearch using spark

Thanks  
Yoav

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 18, 2019, 4:24pm UTC](https://discuss.elastic.co/t/create-daily-index/200053/2 "2019-09-18T16:24:20Z")

</div>

What Logstash does behind the scenes is to calculate the index name based on the template and the @timestamp field and then put this in a bulk request. You probably need to do something similar in Spark. You could also use rollover as this allows you to index into an alias and have Elasticsearch create time-based indices based on age and/or size in the background.

---

<div class="post-metadata">

**Author:** ![Yoav\_Ben\_Moha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoav_ben_moha/32/46202_2.png) [@Yoav\_Ben\_Moha](https://discuss.elastic.co/u/Yoav_Ben_Moha)\
**Post date:** [September 19, 2019, 10:32am UTC](https://discuss.elastic.co/t/create-daily-index/200053/3 "2019-09-19T10:32:29Z")

</div>

Hi,

> [@Christian\_Dahlqvist](#):
>
> You could also use rollover as this allows you to index into an alias

I have followed the rollover documentation but failed to create the index alias

> curl -X PUT '[http://172xx.xx.xx:9200/yoav20](http://172xx.xx.xx:9200/yoav20)'  
> {  
> "aliases": {  
> "logs\_write": {}  
> }  
> }

Its seems like the index created but with no alias.  
What wrong with my syntax ...

> [elasticsearch@elk7-lab ~]$ curl -X PUT '[http://172.xx.xxx.xx:9200/yoav20](http://172.xx.xxx.xx:9200/yoav20)'  
> {"acknowledged":true,"shards\_acknowledged":true,"index":"yoav20"}[elasticsearch@elk7-lab ~]$ {
> 
> > "aliases": {  
> > "logs\_write": {}  
> > }  
> > -bash: aliases:: command not found  
> > -bash: logs\_write:: command not found  
> > [elasticsearch@elk7-lab ~]$

---

<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:** [October 17, 2019, 10:32am UTC](https://discuss.elastic.co/t/create-daily-index/200053/4 "2019-10-17T10:32:52Z")

</div>

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