Kibana JSON input - String manipulation


(Alex Buys) #1

I am trying to build a visualization on Kibana to display data per day of the week. In other words, count of transactions for Monday, Tuesday, Wednesday, etc. over a duration.

I tried variations on the following JSON input filter on a histogram graph but nothing seemed to work:

{
  "script": "doc['@timestamp'].value.date.dayOfWeek().getAsText()"
}

I read somewhere that Kibana can't preform term aggregations on strings (only on numbers). Is this true?

Is it possible to retrieve the day of the week from a timestamp as depicted above in Kibana (I don't have access to ElasticSearch or logstash so I can't manipulate the data at those ends).

Using the latest version of Kibana


(Tyler Smalley) #2

Hey Alex,

Create a scripted field under the index pattern at Management > Index Patterns

name; dow
script: doc['@timestamp'].date.dayOfWeek

You can then use the dow in term aggregations. It will be an integer, but you could further enhance the script to return the name of the week.


(Alex Buys) #3

Thank you - this solved my problem


(system) #4

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