How difficult would it be to compute a sum by writing a custom facet
handler? For example, the terms facet handler computes a count of the
number of documents with each value of a specified field; instead of
counting the number of documents, for each document I want to look up the
value of another field and sum it. Another way to look at this is: the
terms facet handler allows me to compute "select X, count(*) from T group
by X" and I want to compute "select X, sum(Y) from T group by X". I've
started looking over the code in https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/search/facet
Any pointers to help me get started?
I don't think it's too difficult. I'll see if I can dig up some information
for you. I think there needs to be some "facet handler" to integrate the
new facet into the system. I think they are re-writing the faceting code
for .20.
Craig
On Wed, Sep 19, 2012 at 1:02 PM, Dallan Quass dallan@gmail.com wrote:
How difficult would it be to compute a sum by writing a custom facet
handler? For example, the terms facet handler computes a count of the
number of documents with each value of a specified field; instead of
counting the number of documents, for each document I want to look up the
value of another field and sum it. Another way to look at this is: the
terms facet handler allows me to compute "select X, count(*) from T group
by X" and I want to compute "select X, sum(Y) from T group by X". I've
started looking over the code in https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/search/facet
Any pointers to help me get started?
should work for you.
it returns 'total' it`s just a sum
But i didn't find how to evaluate just selected values. Ex. i don't need
sum_of_sqares
On Thursday, September 20, 2012 1:02:49 AM UTC+6, Dallan Quass wrote:
How difficult would it be to compute a sum by writing a custom facet
handler? For example, the terms facet handler computes a count of the
number of documents with each value of a specified field; instead of
counting the number of documents, for each document I want to look up the
value of another field and sum it. Another way to look at this is: the
terms facet handler allows me to compute "select X, count(*) from T group
by X" and I want to compute "select X, sum(Y) from T group by X". I've
started looking over the code in https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/search/facet
Any pointers to help me get started?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.