Terms stats facet on multiple fields?

If I understand the documentation on the Terms Stats Facet, I can create sums, counts and averages of a value given in one field, aggregated by all values of another field. It's a way of creating statistical cross-tabs.

Does this feature work on more than one aggregation field? In other words, if I had a data set of: Building type, year built, area. Could I somehow calculate average area, by building type, by year?

Building type Year built Avg. area
Residential 2004 3500
Residential 2005 3600
Residential 2006 3700
Residential 2007 3800
Residential 2008 3700
Residential 2009 3650
Commerical 2004 14,000
Commercial 2005 15,000

etc....

My guess is that Shay would have listed the syntax if this were already do-able. So, if it's not there, please consider this a humble feature request. Thanks in advance. (I should say, also, thank you for introducing the term-stat facet in the first place! It's a powerful tool.)

Steve

Hi,

The terms stats only supports "two levels", the terms, and then the field to do the stats on. The whole question of starting to support multiple "levels" becomes very interesting, but as you can see, the options are basically limitless (histogram -> terms -> stats, or terms->terms->histogram->stats). It even gets more interesting to try and support pivot table like stats (and I am taking about true pivot table here...).

Its not something terribly difficult to do, requires a lot of implementation to be done in an optimized manner (specific handling for data types), and figuring out how to represent a pivot table in the most optimized manner in the response.

I do want to try and tackle pivot table faceting support. But a bit more down the road from now.

-shay.banon

On Monday, June 27, 2011 at 11:00 PM, searchersteve wrote:

If I understand the
Elasticsearch Platform — Find real-time answers at scale | Elastic
documentation on the Terms Stats Facet, I can create sums, counts and
averages of a value given in one field, aggregated by all values of another
field. It's a way of creating statistical cross-tabs.

Does this feature work on more than one aggregation field? In other words,
if I had a data set of: Building type, year built, area. Could I somehow
calculate average area, by building type, by year?

Building type Year built Avg. area
Residential 2004 3500
Residential 2005 3600
Residential 2006 3700
Residential 2007 3800
Residential 2008 3700
Residential 2009 3650
Commerical 2004 14,000
Commercial 2005 15,000

etc....

My guess is that Shay would have listed the syntax if this were already
do-able. So, if it's not there, please consider this a humble feature
request. Thanks in advance. (I should say, also, thank you for introducing
the term-stat facet in the first place! It's a powerful tool.)

Steve

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Terms-stats-facet-on-multiple-fields-tp3115086p3115086.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com (http://Nabble.com).

Ahh, thanks much. Good to hear you're thinking about it for the future.

Best,
Steve

Hi,

The terms stats only supports "two levels", the terms, and then the field to do the stats on. The whole question of starting to support multiple "levels" becomes very interesting, but as you can see, the options are basically limitless (histogram -> terms -> stats, or terms->terms->histogram->stats). It even gets more interesting to try and support pivot table like stats (and I am taking about true pivot table here...).

Its not something terribly difficult to do, requires a lot of implementation to be done in an optimized manner (specific handling for data types), and figuring out how to represent a pivot table in the most optimized manner in the response.

I do want to try and tackle pivot table faceting support. But a bit more down the road from now.

-shay.banon

On Monday, June 27, 2011 at 11:00 PM, searchersteve wrote:

If I understand the
Elasticsearch Platform — Find real-time answers at scale | Elastic
documentation on the Terms Stats Facet, I can create sums, counts and
averages of a value given in one field, aggregated by all values of another
field. It's a way of creating statistical cross-tabs.

Does this feature work on more than one aggregation field? In other words,
if I had a data set of: Building type, year built, area. Could I somehow
calculate average area, by building type, by year?

Building type Year built Avg. area
Residential 2004 3500
Residential 2005 3600
Residential 2006 3700
Residential 2007 3800
Residential 2008 3700
Residential 2009 3650
Commerical 2004 14,000
Commercial 2005 15,000

etc....

My guess is that Shay would have listed the syntax if this were already
do-able. So, if it's not there, please consider this a humble feature
request. Thanks in advance. (I should say, also, thank you for introducing
the term-stat facet in the first place! It's a powerful tool.)

Steve

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Terms-stats-facet-on-multiple-fields-tp3115086p3115086.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com (http://Nabble.com).