Aggregation using the results of an aggregation?


(Greg Day) #1

Hi guys

Im wondering if it is possible to use the results of an aggregation in a
aggregation calculation?
eg: How would I calculate stocktosales in the example below?

....
"aggregations": {
"product": {
"aggregations": {
"sales": {
"sum": {
"field": "Sale"
}
},
"onhand": {
"avg": {
"field": "Onhand"
}
},
"stocktosales" : {
* should be onhand/sales*
}
}
}
}

Thanks!

Greg

--
Watch the fun new 2 minute and 2 second video tour of Vend
http://youtu.be/zh2X8FyKyMI

--
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/723d04b4-68b3-4290-92f4-d391a514e48b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Rémi Nonnon) #2

Hi,

If I am not wrong it's not possible yet to use the result of an aggregation
in another one.
You have to do that outside elasticsearch.

Regards,
Rémi

Le vendredi 11 juillet 2014 02:39:16 UTC+2, Greg Day a écrit :

Hi guys

Im wondering if it is possible to use the results of an aggregation in a
aggregation calculation?
eg: How would I calculate stocktosales in the example below?

....
"aggregations": {
"product": {
"aggregations": {
"sales": {
"sum": {
"field": "Sale"
}
},
"onhand": {
"avg": {
"field": "Onhand"
}
},
"stocktosales" : {
* should be onhand/sales*
}
}
}
}

Thanks!

Greg

Watch the fun new 2 minute and 2 second video tour of Vend
http://youtu.be/zh2X8FyKyMI

--
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/0e701b9f-068d-4410-8eaf-51903bc08b2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3