NOJIRA Clean up ElasticSearch code

More importantly, properly wrap term queries in quotes. At some point
we might wanna rewrite all this using the ElasticSearch DSL.