Query with union and group in elasticsearch

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!

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