I was able to get the new version of Solr installed. This query gets me really close, but it is averaging the rows BEFORE the grouping so it's not totally accurate. I need it to sum the visits and bounces by keyword and then perform the division. The avg here probably seems confusing and pointless, but it wouldn't let me just put the div directly in the facet without wrapping it with a function.
So instead of summing all the rows into one group and performing the divide, it is diving each row one by one and then averaging them together which creates skewed results since one day may have more data than the other. It seems dividing is possible if only I can tell it to divide the grouped by keyword result and not the individual rows and having to average them together, etc. Here is what I have (granted it's a simplified version for testing) json.facet={ keywords:{ type:terms, limit:10, field:keyword, facet:{ bounces_sum:"sum(bounces)", visits_sum:"sum(visits)", bounce_rate:"avg(div(sum(bounces),sum(visits)))" } } } What I really want is: bounce_rate: div(bounces_sum, visits_sum) ... but this doesn't work. -- View this message in context: http://lucene.472066.n3.nabble.com/Division-with-Stats-Component-when-Grouping-in-Solr-tp4211402p4211639.html Sent from the Solr - User mailing list archive at Nabble.com.