Maybe we can just merge this function with `es-query-region`? By default it will send the query under the mark, but if you give it a prefix `C-u` you send the whole buffer no matter what. If there is a selected region it sends that region.