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/9f6fde1c-c424-4a96-ae72-6142b52018b5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to