Query From Elastic Search for Completed work items and save them to Secondary storage(Oracle/Mysql)

Hi Friends,
I am trying to find a way in C8 to read Elastic search data over a period of time for Completed work items and then write the same data to a secondary data store.

Details of Data I was looking to extract is below.
Process Id,
Process attributes,
all process variable and
history/audit trail of the same processIntance Id

Appreciate your help on this.

Regards
Ravi Babu Kakani