Hi,
I need help to order by the division between two sum fields, how can I do ? Something like this
{
"aggs": {
"field1": {
"terms": {
"field": "field1",
"size":50,
"order": division
},
"aggs":{
"field2":{
"sum":{
"field":"field2"
}
},
"field3":{
"sum":{
"field":"field3"
}
},
"division": {
"bucket_script": {
"buckets_path": {
"my_var1": "field2",
"my_var2": "field3"
},
"script": "params.my_var1 / params.my_var2"
}
}
}
}
}
}
This aggregation actually dose not work because the pipeline aggregation cannot be used for order, so how can I do ?