Thanks Binh,

The problem is that these aren't not the only one case which I want to 
aggregating them that way is rather complicated.

So, there is a chance to do that in ES 1.0. I'm going to start its 
installation.

Chers,
Raúl.

On Friday, February 7, 2014 2:41:22 PM UTC+1, Binh Ly wrote:
>
> Raul,
>
> Unfortunately, the terms_stats facet does not support scripting the terms 
> key. You can try aggregations (ES 1.0) or if you want to use term_stats 
> facet, you will need to introduce an extra field that is a combination of 
> product and campaign to your JSON documents.
>
> {"total": 10,"product": 1,"campaign": 1,"product_campaign": "11"},
> {"total": 10,"product": 1,"campaign": 2,"product_campaign": "12"},
> {"total": 10,"product": 1,"campaign": 1,"product_campaign": "11"},
> {"total": 10,"product": 2,"campaign": 1,"product_campaign": "21"}
>
> And then
>
>     "x": {
>       "terms_stats": {
>         "key_field": [
>           "product_campaign"
>         ],
>         "value_field": "total"
>       }
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1a74ce8e-fc6f-4e2b-98ce-374c37c33f42%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to