Updated queries for elasticsearch 1.0+ (bug 1041709)

To be merged in coordination with the ES upgrade on the backend.