A workaround to use the current date in Kibana

Hi all,

is there a way to get the current date in Kibana? We need to calculate the days between a date inside an index and the current date. We haven't been able to find a proper Lucene expression to get the current date. We have thought about adding a field in the source ES index to get this date or adding a scripted field to the query in order to get this date. Has any one of you got this current date before inside Kibana? Could there be a workaround using ES to get the date in Kibana?

Thanks!

I want to make sure I understand what you're asking. Are you trying to use the current date/time in your query, at query time? That's what it sounds like to me, but this comment is a bit confusing:

We have thought about adding a field in the source ES index to get this date

If you index a date, then it won't be "current", it will be a static, simply whatever you put in that field.

Thanks for the reply. Yes you're right, if we add the field in the index it would be static. I would like to have the current date in a scripted field in Kibana or in the query that uses Kibana to access the ES index.

Unfortunately, that's not currently possible. Ideally you'd do it with a scripted field, but that doesn't currently support any kind of date formatting. It's something we're working on in Elasticsearch, but it's probably a little ways off still.