safer es queries
Merge pull request #637 from dimagi/cz

safer es queries