Skip to content

Commit

Permalink
Merge pull request #5 from nsano-rururu/fix_test_rule_error
Browse files Browse the repository at this point in the history
Fix test_rule.py error
  • Loading branch information
jertel authored Jan 12, 2021
2 parents 4b6e09d + c62c1a7 commit 7a69cd9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions elastalert/test_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_file(self, conf, args):

# Get one document for schema
try:
res = es_client.search(index, size=1, body=query, ignore_unavailable=True)
res = es_client.search(index=index, size=1, body=query, ignore_unavailable=True)
except Exception as e:
print("Error running your filter:", file=sys.stderr)
print(repr(e)[:2048], file=sys.stderr)
Expand All @@ -109,7 +109,7 @@ def test_file(self, conf, args):
five=conf['five']
)
try:
res = es_client.count(index, doc_type=doc_type, body=count_query, ignore_unavailable=True)
res = es_client.count(index=index, doc_type=doc_type, body=count_query, ignore_unavailable=True)
except Exception as e:
print("Error querying Elasticsearch:", file=sys.stderr)
print(repr(e)[:2048], file=sys.stderr)
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_file(self, conf, args):
# Download up to max_query_size (defaults to 10,000) documents to save
if (args.save or args.formatted_output) and not args.count:
try:
res = es_client.search(index, size=args.max_query_size, body=query, ignore_unavailable=True)
res = es_client.search(index=index, size=args.max_query_size, body=query, ignore_unavailable=True)
except Exception as e:
print("Error running your filter:", file=sys.stderr)
print(repr(e)[:2048], file=sys.stderr)
Expand Down

0 comments on commit 7a69cd9

Please sign in to comment.