Hi All,
Using Terms Stats Facet we can create sums, counts and averages etc. 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. I want to apply
term stat facets on Year and area.
If my data looks like (this is just sample data):
*BuildingType Year 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
Then i want output as:
Residential min(Year)=2004, max(year)= 2009, min(area)=3500,
max(area)=3800
Commerical min(Year)=2004, max(year)= 2004, min(area)=14000,
max(area)=15000
To apply term stat facet on single column (lets say "area") my query is:
TermsFacetBuilder termsFacetBuilder = FacetBuilders.termsFacet("facet1");
termsFacetBuilder.keyField("BuildingType").valueField("area");
SearchRequestBuilder srb
=client.prepareSearch("TweetIndex").setQuery(qb).setSearchType(SearchType.QUERY_THEN_FETCH).addFacet(termsFacetBuilder);
searchResponse = srb.execute().actionGet();
In search response i am able to get my result if apply facet on single
column.
Could I somehow apply term stat facets on two fields?
--
Thanks & Regards
Hanish Bansal
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Zntuh3k-1eOX9tckHO4eaCyDnbc0H9%3DjqCRFSLbW94ew%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.