Applying timezones after results


#1

I want to return some data for the month of April using a date histogram, with the PST timezone applied. The data comes back like this:

{"buckets"=>
[{"key_as_string"=>"2015-03-01", "key"=>1425193200000, "doc_count"=>35},
{"key_as_string"=>"2015-04-01", "key"=>1427871600000, "doc_count"=>4660}]}

I do not want the first hash since it's referring to March. I want the results to be compiled just into April. I've tried playing around with pre/post timezones and offsets and nothing seems to be working. How can I do what I want without manually doing it in application code?


(Adrien Grand) #2

I haven't looked at this code recently but the time_zone option should do the job? Ie. "time_zone": "-08:00" on the date_histogram.


#3

It applies it correctly for the calculation but after playing around with it, I can't seem to get it to consolidate all my results into just 1 month. Since I use PST, it'll always have the last few hours of the previous month.


(system) #4