Elasticsearch query generator