Fix ES query generation

I suck. These must have crept in while I was rebasing and cleaning up
commits.