Timelion filter data by hour


(Rodrigo Javier Ubal Dahl) #1

Hi, I have the following problem, I need to compare the data of the current week with the past one, but the data I have to retrieve are only the ones that are between 10:00 AM to 2:00 PM.
I tried with range(), but I get the error that the code is incorrect, If somebody have a clue how to accomplish this to track me to the correct path it will be appreciated.

regards


(Lukas Olson) #2

Could you send a screenshot or copy/paste in here what you've got so far, and we can go from there? Thanks!


(Rodrigo Javier Ubal Dahl) #3

sadly I didn't save the timelion, but what I want to do its something like this:
.es(q="@timestamp:[2017-01-01 TO 2018-02-11]")

but with hour instead like

.es(q="@timestamp:[10:00 TO 14:00]") but it doesn't give any result


(Tim Roes) #4

Hi Rodrigo,

something like that is not possible in Elasticsearch. If you want to filter out for specific hours of the day, you need to either create a scripted field, that extracts the hour of the day from the actual @timestamp date field - but scripted fields won't work in timelion!

Even better - and faster - if you know you need to access these values for querying, you need to extract them before indexing, i.e. let your index infrastructure create a field, hourOfDay, that contains that numeric value. That's the only way how you can filter for those.

Cheers,
Tim


(Rodrigo Javier Ubal Dahl) #5

Ow what a pity

@timroes thanks for the quick reply, and to give me a clue on how to circumvent this particular problem.

Thanks

Rod


(system) #6

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