I'm sorry I didn't see your original question last month, but as you've since realized you can't use functions like "div" in this way.
The syntax for getting "stats" in the JSON Faceting API doesn't really make this clear, but the outermost function call you make must be somethign that can "aggregate" values across many documents -- a function like "div(x, y)" just operates on a per document basis returning the result of dividing those two fields (or the results of those two nested functions) I created SOLR-10157 to note that the error messages are definitely confusing. Thank you for following up to let us know how you resolved your issue -- it definitely helps us find places the API/error messages are confusing to users. : Date: Tue, 14 Feb 2017 14:04:10 +0800 : From: Zheng Lin Edwin Yeo <edwinye...@gmail.com> : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Re: Division in JSON Facet : : I found that we can't put div(4,2) directly, as it wouldn't work. : : It will work if I put something like max(div(4,2)). : : Regards, : Edwin : : : On 10 January 2017 at 19:59, Zheng Lin Edwin Yeo <edwinye...@gmail.com> : wrote: : : > Hi, : > : > I'm getting this error when I tried to do a division in JSON Facet. : > : > "error":{ : > "msg":"org.apache.solr.search.SyntaxError: Unknown aggregation agg_div in ('div(4,2)', pos=4)", : > "code":400}} : > : > : > Is this division function supported in JSON Facet? : > : > I'm using this in Solr 5.4.0 : > : > Regards, : > Edwin : > : -Hoss http://www.lucidworks.com/