Advanced date query in Elasticsearch using Kibana


I am using Kibana to vizualize data stored in my Elasticsearch cluster. I want to know if it is possible to query for a particular day of the week on a date type field.

For example, I want to fetch all records that came in on Saturdays for last one year. Is this possible?


Kibana scripted fields might be of help here, but the current default scripting language based on Lucene expressions currently does not support date math. You could consider using static Groovy scripts instead, as described here, but it's really convoluted (note that using dynamic Groovy scripts is not secure).

As a result, at this time, I'd recommend simply indexing day-of-week as a separate field in Elasticsearch.