I am new to ElasticSearch. I have been translating SQL queries to ElasticSearch queries. I encountered a SQL query that I'm not able to translate. The query is as follows.
SELECT subtable.f_date, ROUND(sum(subtable.var*subtable.num_games)/sum(subtable.num_games), 1) as points FROM (SELECT f_pl_id, f_date, sum(colX)*100/sum(colY) as var, count(f_g_id) as num_games FROM database WHERE f_date >= '2018-04-01' AND f_date <= '2018-04-10' GROUP BY f_pl_id, f_date) as subtable GROUP BY f_date;