How to perform sql group by and sum query in elasticsearch

Hi Team,
I want to perform below query in elasticsearch using dev tool in kibana:

select pd.product,sum(wallet) wallet_2,sum(revenue) revenue_2,ef.time_id from entity_fact ef
inner join product_dim pd on pd.product_id=ef.product_id
inner join wallet_location_dim wld on ef.wallet_location_id=wld.wallet_location_id
inner join entity_dim ed on ef.entity_id=ed.entity_id
inner join clients_dim cd on ef.client_id=cd.client_id
inner join sector_dim sd on ef.sector_id=sd.sector_id
inner join gap_tox_dim gtxd on ef.gap_tox_id=gtxd.gap_tox_id
inner join rank_dim rd on ef.rank_id=rd.rank_id
inner join data_version_dim dvd on ef.data_version_id=dvd.data_version_id
where ef.client_id=262
and ef.wallet_location_id=5
and ef.gap_tox_id=1
and ef.time_id in (20111,20121)
and ef.data_version_id=1
and ef.sector_id in(1,2,3,4,6,7)
and ef.product_id in(39,1,13,6,2,9,12,14,20,24,29,33,37,38,7,8,3,4,5,10,11,15,16,17,18,19,125,21,22,23,25,26,27,28,30,31,32,34,35,36)
group by pd.product,ef.time_id

how can i use aggregate function and term query.

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