Re: Combining two aggregations to get term percentage

2015-02-17 Thread Jari Bakken
Yes! If I have to do the division on my own I might as well stick with the two aggregations, AFAICT. But if it was available as a scoring heuristic I could effectively use {size: N} so I don’t have to fetch the full set of countries to do this calculation. I’ve opened a feature request here

Re: Combining two aggregations to get term percentage

2015-02-17 Thread Mark Harwood
You can choose to ignore the score and compute your own by dividing doc_count by bg_count. Your post has made me think we should add this more easily explainable metric as one of the scoring heuristics we offer for this aggregation. On Tuesday, February 17, 2015 at 10:44:12 AM UTC, Jari Bakken

Re: Combining two aggregations to get term percentage

2015-02-17 Thread Jari Bakken
Thanks Mark! I've been planning to look into `significant_terms`, but didn't know it could help me with this. I'm a bit concerned that a too clever scoring could be hard to explain to users, but I'll give it a shot. On Tue, Feb 17, 2015 at 9:41 AM, Mark Harwood < mark.harw...@elasticsearch.com>

Re: Combining two aggregations to get term percentage

2015-02-17 Thread Mark Harwood
Nice to see someone taking the trouble to put their stats in context. Drives me nuts every time I see the equivalent of this: http://xkcd.com/1138/ So we have a feature that does some of what you are after - it's called the "significant_terms" aggregation. Your query would look like this: { "q

Combining two aggregations to get term percentage

2015-02-16 Thread jari
Hi, I'm looking for a way to have Elasticsearch calculate the percentage of docs that match a query *within* a terms aggregation. That is, given two aggregations where one is filtered and the other is not: { aggregations: { countries: { filter: { q