title: Histogram of timestamps using elasticsearch
body: <p>Assume that that my documents all have a (<em>milliseconds</em>) <code>timestamp</code> field given as an <code>int</code>. I want to find how many documents I have per hour, but starting at half-past an hour. In some more details: Assume that the first interesting time stamp, <code>minTS</code>, is: <code>1423747800000</code> (or Thu, 12 Feb 2015 13:30:00 GMT) and that <code>maxTS</code> is now. If I run the following aggregation:</p>
  
  <pre><code>"aggs": {
    "time": {
      "histogram": {
        "field": "timestamp",
        "interval": 3600000,
        "min_doc_count" : 0,
        "extended_bounds" : {
          "min" : minTS,
          "max" : maxTS
        }
      }
    }
  }
  </code></pre>
  
  <p>the first returned bucket is <code>1423746000000</code> (i.e. Thu, 12 Feb 2015 13:00:00 GMT). If I change the <code>interval</code> to <code>1800000</code>, then I get the first buckets to start on the right time, but it's only 30 minutes long. I cannot manage to get it to work with one hour buckets that start on half past. How can I do it?</p>