Calculating multiple totals with facets

Hi everyone I have a question:

I have a data structure to map invoices and for each invoice i store
its currency and the total amount:

{
"document": {
properties: {
currencycode: {type: "string", index: "not_analyzed",
include_in_all: false},
total: {type: "double"},
....
}
}
}

I would like to create a facets that will return me the totals for the
invoices divided by currencies:

EUR : 20300
USD : 13300
.....

Is it possible?

Thanks!

Sounds like you want the term stats facets

currencycode will be the term facet and total will be the value_field

--
Ivan

On Thu, Aug 18, 2011 at 8:11 AM, nicco nicco82@gmail.com wrote:

Hi everyone I have a question:

I have a data structure to map invoices and for each invoice i store
its currency and the total amount:

{
"document": {
properties: {
currencycode: {type: "string", index: "not_analyzed",
include_in_all: false},
total: {type: "double"},
....
}
}
}

I would like to create a facets that will return me the totals for the
invoices divided by currencies:

EUR : 20300
USD : 13300
.....

Is it possible?

Thanks!

Works perfectly thanks you!

On Aug 18, 10:15 pm, Ivan Brusic i...@brusic.com wrote:

Sounds like you want the term stats facetshttp://www.elasticsearch.org/guide/reference/api/search/facets/terms-...

currencycode will be the term facet and total will be the value_field

--
Ivan

On Thu, Aug 18, 2011 at 8:11 AM, nicco nicc...@gmail.com wrote:

Hi everyone I have a question:

I have a data structure to map invoices and for each invoice i store
its currency and the total amount:

{
"document": {
properties: {
currencycode: {type: "string", index: "not_analyzed",
include_in_all: false},
total: {type: "double"},
....
}
}
}

I would like to create a facets that will return me the totals for the
invoices divided by currencies:

EUR : 20300
USD : 13300
.....

Is it possible?

Thanks!