Re: json.facet without a facet ...
On 26/09/16 17:06, Yonik Seeley wrote: > Statistics are now fully integrated into faceting. Since we start off > with a single facet bucket with a domain defined by the main query and > filters, we can even ask for statistics for this top level bucket, > before breaking up into further buckets via faceting. Example: > > json.facet={ > x : "avg(price)", // the average of the price field will Aaaah! Thanks, that explains it. I was trying to put the statistics under "facet":{}, instead of on the top level. Much appreciated :-) - Bram
Re: json.facet without a facet ...
On Mon, Sep 26, 2016 at 9:44 AM, Bram Van Damwrote: > Howdy, > > I realize that this might be a strange question, so please bear with me > here. > > I've been replacing my usage of the old Stats Component (stats=true, > stats.field=foo, [stats.facet=bar]) with the new json.facet sugar. This > has been a great improvement on all fronts. > > However, with the stats component I could calculate stats on a field > *without* having to facet. The new json.facet API doesn't seem to > support that in any way that I can see. >From http://yonik.com/json-facet-api/ Statistics are facets Statistics are now fully integrated into faceting. Since we start off with a single facet bucket with a domain defined by the main query and filters, we can even ask for statistics for this top level bucket, before breaking up into further buckets via faceting. Example: json.facet={ x : "avg(price)", // the average of the price field will appear under "x" y : "unique(manufacturer)" // the number of unique manufacturers will appear under "y" } -Yonik
json.facet without a facet ...
Howdy, I realize that this might be a strange question, so please bear with me here. I've been replacing my usage of the old Stats Component (stats=true, stats.field=foo, [stats.facet=bar]) with the new json.facet sugar. This has been a great improvement on all fronts. However, with the stats component I could calculate stats on a field *without* having to facet. The new json.facet API doesn't seem to support that in any way that I can see. Which, admittedly, makes sense, given the name. Faceting on a random field and setting allBuckets:true kind of approximates the behaviour I'm after, but that's pretty ugly and difficult (because I don't know which field to facet on and it would have to be present in all documents etc). Is there any way to do this that I'm not seeing? TL;DR; Trying to calculate statistics using json.facet without faceting. Thanks, - Bram