Elastic query also uses sql queries to take data from db. So, you can see where the actual sql queries are stored and can take help from that