title: Aggregate Solr facets
body: <p>I need to query Solr 7.4 to extract the "average hourly document count". What i would like is something like a +1HOUR range facet on a time field (so far so good), count documents in each bucket (so far so good) and then count the average value of this count.</p>
  
  <p>I've come up with this really simple json facet:</p>
  
  <pre><code>{
      reference: {
          type: "range",
          field : "time",
          start : "NOW/HOUR-7DAYS",
          end : "NOW/HOUR",
          gap : "+1HOUR"
      }
  }
  </code></pre>
  
  <p>And the result is like this:</p>
  
  <pre><code>...
   "facets": {
      "count": 710104,
      "reference": {
        "buckets": [
          {
            "val": "2020-02-11T09:00:00Z",
            "count": 2097 &lt;------ average on these values
          },
          {
            "val": "2020-02-11T10:00:00Z",
            "count": 2268 &lt;------ average on these values
          },
  ...
  </code></pre>
  
  <p>Is it possible to let solr extract the average of values labeled as "average on these values" on the response?</p>
  
  <p>Any hint is welcome.</p>