Create per frame index


(Jorge Ramirez) #1

Hello, how to make a template for the automatic creation of indexes . For example, if the index is called test , I want an automatic index was created with the name test- 03.15.2016 . If anyone can help me with a simple example and explain it, I appreciate it.


(Mark Walkom) #2

You can't request an index called test and have it renamed to test-$DATE, you need to ask for the latter.


(Jorge Ramirez) #3

Apologies , I think that I could not explain myself well . What I need is to create an index that automatically every day make the index name- yyy - mm -dd form . Just as it does when creating their indices logstash.

I do not know if I need to do , I could do with a template ?


(Mark Walkom) #4

Right, then yes a template can do that.
Check the _templates API endpoint and you can copy the existing Logstash one.


(Christian Dahlqvist) #5

As mark suggested you can create a template that will apply e.g. to all indices that start with 'test'. Whenever an index with a name matching this pattern is created, the mapping will be automatically applied. Logstash does this for indices starting with 'logstash' by default. This does by itself not create any indices though.

When Logstash writes a document, it looks at the timestamp (if time-based indices are used) and determines the full name of the index to write to, e.g. 'test-2016.03.17'. When this record is indexed into Elasticsearch the index is automatically created if it does not already exist.


(system) #6