-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing get_hits_count for es 7.x #333
Changes from all commits
b9ff8b8
901b5d0
04b90e2
56c3a28
4f5d7c6
6a95eb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,8 +456,21 @@ def get_hits_count(self, rule, starttime, endtime, index): | |
five=rule['five'] | ||
) | ||
|
||
es_client = self.thread_data.current_es | ||
try: | ||
res = self.thread_data.current_es.count(index=index, doc_type=rule['doc_type'], body=query, ignore_unavailable=True) | ||
if es_client.is_atleastsixtwo(): | ||
res = es_client.count( | ||
index=index, | ||
body=query, | ||
ignore_unavailable=True | ||
) | ||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With
This is silently just not matching any documents in 7.x. :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks to match if you use the implicit |
||
res = es_client.count( | ||
index=index, | ||
doc_type=rule['doc_type'], | ||
body=query, | ||
ignore_unavailable=True | ||
) | ||
except ElasticsearchException as e: | ||
# Elasticsearch sometimes gives us GIGANTIC error messages | ||
# (so big that they will fill the entire terminal buffer) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without
doc_type
: