Misc ESQuery additions and bugfixes
Merge pull request #4048 from dimagi/es-query

Misc ESQuery additions and bugfixes