Aggregations in logstash

Hi all,
How can we use aggregations in logstash .conf file.My input is a csv file from 2 different sources.I need to group by a field and perform aggregations like sum,average,etc.
1st csv file has fields:
2nd csv file has fields:
So I need to get output like:

The only way I can think of would be to index each file separately, then query the data from ES and then reindex it.

There's currently no way to do this in LS I can think of. Someone else might have something though.

I am new to elasticsearch.Can you expain where to query data in elasticsearch which you mentioned above.

To compute sum, avg, etc, you could use metrics filter