But still feel abit lost on how complicated an approach I need to do. Its actually a simple mod because I'm relying on data in existing columns to derive new ones.
Index Management
Since this new field is an in-line addition. @timeofday is non-existent in my Index Template.
Should I ingest more months of data (1 index per month), how can ensure this new @timeofday field will be calculated and included in the new data so that when I Discover, everything is seamless / consistent.
Then if you really want to use it in queries etc... then you need to actually add it to the mapping / template... from the docs you link above using a runtime field not the lucene expression. (BTW you linked to a really old document)
OK we can do that as a keyword... filtering and sorting you will need to see if that works... You will need to figure out the timezone stuff if you want to...
Basically with my 6 months of logs, which contain entries 24/7
I want to do such that I filter away entries lasting from 0100-0430hrs in early morning, for every day (ie. 1 Jan - 30 June) (and likewise scaling this to more days when I pipe in additional data.
I wanted my Data View to omit 0100-0430hrs for every day.
EDIT: I tried using @timestamp to Query DSL but it didn't work. Wasn't as straight fwd to only read the time component.
Do I really need the new column to do this filtering?
I can appreciate the result and extent of convenience. So the new field is only present in that specific dataview.
Ok, I'm now thinking further if I could try integrating this into Index Template and make @time_of_day a permanent "scripted" column that will exist inside the Index Template.
It will extract the hh:mm:ss.xxx component from @timestamp and translate to the new column @time_of_day
But yet in the raw csv files, the @time_of_day column will not exist.
Add the mapping to the template and a script process to the ingest pipeline... and you do not need the @ for every timestamp / date that is just and nameing convtion for the special field @timestamp
Let me try your code later for mapping and ingest.
On this note, I understand that even if I update the mapping, existing data will not be re-indexed by the new change?
Because say if I remove the @time_of_day from Discover, the current dataset from Jan-June 2023 will not have this column and will not pick up the new time_of_day that's now present in Index Template?
I come from a "housekeeping / consolidation" pov, if I already had a permanent code inside Index Template, then I technically won't need the "makeshift" field I created on Discover which is at a more front end portion of things.
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.