From af2148281186b1023deda9581858ebae806c47eb Mon Sep 17 00:00:00 2001 From: Ramy Asselin Date: Wed, 13 Jan 2016 15:15:50 -0800 Subject: [PATCH] 10 day count is too high Graphs counts were looking at all history instead of just 10 days as intended. Update the search to only look at the most recent 10 days. Change-Id: I9495888a818986b3ac187bac7fd65fbcad6135a3 --- elastic_recheck/cmd/graph.py | 3 ++- elastic_recheck/elasticRecheck.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/elastic_recheck/cmd/graph.py b/elastic_recheck/cmd/graph.py index 9aee62f1..cbf1750a 100755 --- a/elastic_recheck/cmd/graph.py +++ b/elastic_recheck/cmd/graph.py @@ -184,7 +184,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']) diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index 593d7b35..8c3cc927 100644 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -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."""