Elasticsearch Aggregation question

Can i implement the following mysql query with elasticsearch?

select sum(column1)/sum(column2) v1, min(column3) v2, sum(column4) v3 
from mytable 
group by column5, column6

Thank you for writing an example!

Should be doable! I'm on the run so I can't work out a full example, but I would do:

  • Terms aggregation on column5
    • Terms aggregation on column6
      • min agg on column3
      • sum agg on column1, column2, column3
      • bucket_script which divides sum(column1) / sum(column2)
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.