I'd like to print a diagram which will show the most popular/unpopular visit time over working days.
I.e. from monday till friday only for last months it should print a diagram with Y - amount of logs, X - 00-01h 01-02h 02-03h 03-04h 04-05h 05-06h 06-07h ... 23-24h
It is not a problem when you use Elasticsearch 5.x and Kibana 5.x.
But for old ES 2.4.x and Kibana 4.6.1 it's kinda challenge, but I found the solution:
Alter Elasticsearch security config:
script:
engine:
groovy:
inline:
search: true # you'll be able to get value of this field in search results
aggs: true # you'll be able to use this field in search aggregation in histogram
Create two numeric scripted fields in Kibana:
time.hourOfDay -> doc['time'].getHourOfDay() - it is a simple Lucene expression
time.dayOfWeek -> doc['time'].date.dayOfWeek - it is a groovy script which won't work without a hack below:
Then in Chrome open the developer tools -> network and find the query which applies these rules and using right click choose Copy as cURL
Alter this command and set groovy instead of expression inside the lang field for the time.dayOfWeek field and run the command.
Then try to discover the logs and you should find time.dayOfWeek and time.hourOfDay in log fields.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.