Migrating From Facets to Aggregations (Both Key & Value Scripts)

Facets supported both key_script and value_script in this manner:
{
"size": 0,
"facets": {
"by-hour": {
"histogram": {
"key_script": "doc['media.created_time'].date.hourOfDay",
"value_script": "doc['media.likes.count'].value +
doc['media.comments.count'].value"
}
}
},
"query": {
"bool": {
"must": [
{
"term": {
"stream_id": {
"value": "1b883b7b-364b-4b5d-b099-9e7ef329a445"
}
}
}
]
}
}
}

What's the equivalent of this for aggregations under 1.2.2.?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fb3df9e3-2a96-4b94-8247-1c6f896c455f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The equivalent would likely be a terms agg on the key_script expression
(using the terms agg script capability), and then followed by a nested
stats agg on the value_script expression (using the stats agg script
capability). Something like this:

"aggs": {
"by-hour": {
"terms": {
"script": "doc['media.created_time'].date.hourOfDay"
},
"aggs": {
"bytes_stats": {
"stats": {
"script": "doc['media.likes.count'].value +
doc['media.comments.count'].value"
}
}
}
}
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7d285a99-84f0-430b-a86d-1365cc05e13f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.