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.

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?

--

--

…

CRAIG BROWN

youwho, Inc.

www.youwho.com

T: 801.855. 0921

M: 801.913. 0939

--

http://www.elasticsearch.org/guide/reference/api/search/facets/statistical-facet.html

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?

--

Thank you! That looks that will give me a good start.

Dallan

On Sep 19, 2012, at 2:09 PM, Max Melentiev printercu@gmail.com wrote:

http://www.elasticsearch.org/guide/reference/api/search/facets/statistical-facet.html

should work for you.

it returns 'total' it`s just a sum

--

View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Computing-sums-with-a-custom-facet-handler-tp4022902p4022903.html

Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--

--