Day of Week


(Erik Stephens) #1

I'm able to define scripted field like so in Kibana 4.2 and Elasticsearch 2.0:

doc['@timestamp'].getDayOfMonth()
doc['@timestamp'].getHourOfDay()

but can't figure out how to get the day of the week. I've tried:

doc['@timestamp'].getDayOfWeek()
doc['@timestamp'].dayOfWeek()

Which generates "Member method [getDayOfWeek] does not exist" in the error logs. Anyone able to get the day of the week in kibana scripted fields? Thanks!


(Isabel Drost-Fromm) #2

You might be better of asking your question in the Kibana forum here: https://discuss.elastic.co/c/kibana


(Mark Walkom) #3

I've moved it :slight_smile:


(Erik Stephens) #4

It's my understanding that this is more of an elasticsearch feature that kibana happens to expose. I thought I read that timestamps adhere to the joda time interface but maybe elasticsearch only exposes a subset? If so, is there a reason why getDayOfWeek() was left out?


How to print popular hour diagram in Kibana
(Shelby Sturgis) #5

Kibana uses Lucene Expressions due to security concerns with what was previously used, Groovy (see https://github.com/elastic/kibana/issues/3180).
Lucene expressions do not support getDayOfWeek(), https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_lucene_expressions_scripts.


(Erik Stephens) #6

Sounds like more of a Lucene issue to dive into. Strange that getDayOfWeek() is omitted - it's pretty important. If anyone comes up with a workaround, I'd love to see it.


(kay kay) #7

one year late, but here is the solution: How to print popular hour diagram in Kibana


(system) #8