For some reason, although the index naming convention is set in the Filebeat clients' configuration, the timestamp of the date isn't change when the index is rolled over on the next day.
For example let's say I had index "index-2020.04.02-000001" and "index-2020.04.02-000002" already created, the day following it created "index-2020.04.02-000003" instead of "index-2020.04.03-000001".
Okay, in that case it looks like the first index was not created with date math, rollover will only perpetuate the date math in the name if the initial index was created with date math (it would be named something like <index-{now/d}-000001> if it were created with date math.
In order to migrate it, it depends on what version of ES you're running, what version are you using? (Alternatively, if you're just testing, you can start over, but I understand that's not feasible with live data)
ILM is built around the date in the index name being the date the first index in the policy was created. There's currently no way to change that to have subsequent index names created with the date it was then created on.
If it's something you would like, it'd be worth creating a feature request so we can track it
If the client you are using can translate that into an actual index name, yes. Elasticsearch cannot calculate that for you via the REST API.
So you are basically saying that the only way would be delete all the productive indices and let the Filebeat client generate the next index with the date math, correct?
That's not very realistic for me, as I don't want to delete all the data, considering those are productive data.
It has been a pattern we have used for such a long time now, so it makes sense. But ILM removes that requirement, and Kibana now uses the field_caps API to get that info from an index when it needs to.
I do not think Kibana has used field caps in quite some time. A while back querying indices with no matches was made much more efficient so I think it now just queries all matching indices.
Date-based indices are much easier to deal with as an administrator when doing things like trying to figure out what index to restore from a snapshot, having index-2018-05-21-000234 gives a better idea of when the index was created and what data it has than index-000234.
So where does that leave me? As I said dakrone hinted that there is way to migrate my index with the desired behaviour, depending on the version of the ES stack I'm using. (btw, we recently updated to 7.6.2). Refer to the quote below to see what I mean. And as I am productive, I'm loathe to throw simply all my data away.
Create the new index with date math (don't change the alias yet)
(replace 999 with the number needed, whichever is the next number in your sequence):
PUT %3Cindex-%7Bnow%2Fd%7D-000999%3E
Update the aliases to correct the write_alias pointer
(replace the index-2020.07.30-000999 index name with the index created in step 2 and replace index-2020.06.19-000NNN with the latest index that exists, replace youralias with your alias name):
I had to do a re-index yesterday, due to another issue I had, and I adapter your index creation call formula in the re-index call. Last night a new index was created and it took the newest date.
Thanks @dakrone for your support and your patience with me.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.