Merge "10 day count is too high"

This commit is contained in:
Jenkins 2016-07-20 20:36:25 +00:00 committed by Gerrit Code Review
commit 9c468aedc0
2 changed files with 4 additions and 3 deletions

View File

@ -188,7 +188,8 @@ def main():
try:
results = classifier.hits_by_query(query['query'],
args.queue,
size=3000)
size=3000,
days=days)
except pyelasticsearch.exceptions.InvalidJsonResponseError:
LOG.exception("Invalid Json while collecting metrics for query %s"
% query['query'])

View File

@ -386,12 +386,12 @@ class Classifier(object):
self.queries_dir = queries_dir
self.queries = loader.load(self.queries_dir)
def hits_by_query(self, query, queue=None, facet=None, size=100):
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)
return self.es.search(es_query, size=size, days=days)
def most_recent(self):
"""Return the datetime of the most recently indexed event."""