Elastic Query

I have data of last 30 days.. I want avg count of every hour of past 30 days... how can get that data .

Use https://www.elastic.co/guide/en/elasticsearch/reference/5.0/search-aggregations-bucket-datehistogram-aggregation.html and https://www.elastic.co/guide/en/elasticsearch/reference/5.0/search-aggregations-metrics-avg-aggregation.html

Thank You Warkolm,

actually i have data of last 30 days

EX;01-01-2015 00:00:00 - 50
01-01-2015 01:00:00 - 15
02-01-2015 00:00:00 - 20
02-01-2015 01:00:00 - 10
--............ 30-01-2015-500

So hour(00:00:00) wise avg count is (50+20)/2=35
and 01:00:00 avg is (15+10)/2 = 12.5

i want the output in above format.

is it possible

need some suggestions for above scenario.