Date Histogram in Kibana


#1

Hi,
I have data indexed in Elastisearch. The data is sensors readings per hour for multiple stations and it has the following shape
{ "type": "Temperature", "time": "2012-01-01T01:00:00", "station": "stationX", "value": -9.24249 }

I have the data of around 5 years. What I want to do is to build a visualization where I can have the average of the values on the Y-axis and the time on the X-axis, I managed to build this visualization easily using Line Visualization, Y-axis as Average of field value, and X-axis as Date Histogram. What I want to do is to modify this visualization, so I can show the data of each year in a separate series, and where X-axis are the month and days like it is shown in the image below:


(Bryan Stuhlsatz) #2

You could easily do this if you had a field in your data that was called month. Your first bucket would be a histogram using that field. Then you would split the series using a date range filter specifying your years. Lastly, your kibana index pattern can not be time series based because your x-axis you want is based on months and not the whole span of 5 years of time. I would re-index the data, and you could do a painless script to accomplish creating the field.


(Bryan Stuhlsatz) #3

On splitting the series, i mentioned using a date range filter. That works if you want like a rolling week, month, etc. You would use date histogram to split the series if you wanted your series to be weekly, yearly, etc.


#4

Thanks for your answer!
I am aware of that solution but this is not what I really interested in doing, because then I will have to do it for every time level (Year, Month, Day, Hour, Minute). What I am more interested in is to find a way in Kibana to do so instead of having a new field in my data.
I think the solution somewhere around splitting the series again using date ranges but I am not very sure about how to do this


(Bryan Stuhlsatz) #5

If you don't re-index, then the only thing i can think of is you can create a scripted field to do this, or in your visualization write an inline painless script to get the month that is in your date field. I believe that should be doable as well.