Multiple key_fields for Statistical Facet

I have a need to use two key_fields for a statistical facet, but I'm not
sure if this is possible.

I have several fields that have a name, a date, and a number associated
with them. I'd like to do the SQL equivalent of:

SELECT name, date, SUM(number) FROM es GROUP BY name, date

I'm trying to do something like this is ES but its not working:

"facets": {
"name_date_stats": {
"terms_stats": {
"key_field": ["name","date"],
"value_field": "number",
"order": "term"
}
}
}

I've tried several variations and haven't gotten the result I'm looking
for. Any help would be greatly appreciated!

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,

With the currently released version this is not directly possible. There is
an open issue requesting the ability to script the key field. This would
allow you to combine the two fields into one key as you want. You can watch
the issue here: key_script for term stats facets · Issue #3004 · elastic/elasticsearch · GitHub

Cheers,
Boaz

On Friday, May 17, 2013 4:37:43 PM UTC+2, OffensivelyBad wrote:

I have a need to use two key_fields for a statistical facet, but I'm not
sure if this is possible.

I have several fields that have a name, a date, and a number associated
with them. I'd like to do the SQL equivalent of:

SELECT name, date, SUM(number) FROM es GROUP BY name, date

I'm trying to do something like this is ES but its not working:

"facets": {
"name_date_stats": {
"terms_stats": {
"key_field": ["name","date"],
"value_field": "number",
"order": "term"
}
}
}

I've tried several variations and haven't gotten the result I'm looking
for. Any help would be greatly appreciated!

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.