About elasticsearch DSL Query

hello,

i am new to elasticsearch. I do not know how to implement sql group query using elasticsearch. The following is my sql.

select
col1_,
col2_,
avg(avg_) avg_
from(

select
col1_,
col2_,
col3_,
avg(col4) avg_
from table_
group by
col1_,
col2_,
col3_
) a

group by
col1_,
col2_
;

any idea?
thanks in advance.