select table.x, sum(table.y) from(
select a x, sum(b) y from table1 group by a
union all
select c x, sum(d) y from table1 group by c
)
I don't know how to implement the SQL above in elasticsearch(5.5),
Does anyone know how it works? Thank you very much!