Pulling day of week from a date field then writing a query to return records for a specific day of the week

Hi New to Kibana.
How would I use Lucene or Custom DSL Query in the Kibana environment to
a) change a date type to day of the week , then
b) return only certain days of the week say Saturday for example.

In the query bar for Lucene I tried:

entryDate.date.dayOfWeek = 6

entryDate.date.dayOfWeek: [6]

entryDate is my date field. Thanks.

You'll want to created a scripted field that generates the day of week from your date field. You can then query on that scripted field in KQL or in the filter bar. Scripted fields use Elasticsearch's Painless scripting language, which has extensive documentation on working with date fields. You should also be able to find some example scripts if you search these forums, getting the day of the week is a common ask.

Thanks Matt,
From what I understand this is done in Index Management, right? If so, I currently don't have permissions to use index mgmt. in my organization. Is there a workaround to accomplish this in the Kibana environment?

Scripted fields can be created in the "Index Patterns" section of the Kibana Management page, so you may have access to it. This is the only way to do what you want, other than indexing the data with day of week info in the first place.

Thanks Matt,
I actually don't have the permissions to access that screen or that tab. Thanks though.

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