def _is_valid_ElasticSearch_query(self, x, bug): query = qb.generic(x['query']) try: results = self.classifier.es.search(query, size='10') except pyelasticsearch.ElasticHttpError: self.fail("Failure to process query for bug %s" % bug) valid_query = len(results) > 0 if not valid_query: print("Didn't find any hits for bug %s" % x['bug']) # don't fail tests if no hits for a bug return True
def hits_by_query(self, query, queue=None, facet=None, size=100): if queue: es_query = qb.single_queue(query, queue, facet=facet) else: es_query = qb.generic(query, facet=facet) return self.es.search(es_query, size=size)
def hits_by_query(self, query, queue=None, facet=None, size=100, days=0): if queue: es_query = qb.single_queue(query, queue, facet=facet) else: es_query = qb.generic(query, facet=facet) return self.es.search(es_query, size=size, days=days)