implements es queries