Skip to content
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

TypeError: deprecated_search() got an unexpected keyword argument 'headers' #3151

Closed
ashishkaransingh opened this issue Mar 16, 2021 · 6 comments

Comments

@ashishkaransingh
Copy link

Ref: #2725

Getting the following error only when using rule type: Percentage Match

ERROR:root:Uncaught exception running rule test_perc: deprecated_search() got an unexpected keyword argument 'headers'

/cpt/elastalert $ python3 -m elastalert.elastalert --verbose --rule test_perc.yaml --config config.yaml
1 rules loaded
INFO:elastalert:Starting up
INFO:elastalert:Disabled rules are: []
INFO:elastalert:Sleeping for 59.999888 seconds
/home/node/.local/lib/python3.8/site-packages/elasticsearch/connection/base.py:200: ElasticsearchWarning: Camel case format name dateOptionalTime is deprecated and will be removed in a future version. Use snake case name date_cptional_time instead.
warnings.warn(message, category=ElasticsearchWarning)
ERROR:root:Traceback (most recent call last):
File "/cpt/elastalert/elastalert/elastalert.py", line 1283, in handle_rule_execution
num_matches = self.run_rule(rule, endtime, rule.get('initial_starttime'))
File "/cpt/elastalert/elastalert/elastalert.py", line 902, in run_rule
if not self.run_query(rule, tmp_endtime, endtime):
File "/cpt/elastalert/elastalert/elastalert.py", line 636, in run_query
data = self.get_hits_aggregation(rule, start, end, index, rule.get('query_key', None))
File "/cpt/elastalert/elastalert/elastalert.py", line 569, in get_hits_aggregation
res = self.thread_data.current_es.deprecated_search(index=index, doc_type=rule.get('doc_type'),
File "/home/node/.local/lib/python3.8/site-packages/elasticsearch/client/utils.py", line 152, in _wrapped
return func(*args, params=params, headers=headers, **kwargs)
TypeError: deprecated_search() got an unexpected keyword argument 'headers'

@nsano-rururu
Copy link
Contributor

The answer is written in 2725. Do not you understand?
Why not do your best?

@ashishkaransingh
Copy link
Author

Sorry for disappointing you!
I was trying to make sense of the information provided.
In my case it affected operation and disabled the rule.

ERROR:root:Uncaught exception running rule test_perc: deprecated_search() got an unexpected keyword argument 'headers'
INFO:elastalert:Rule test_perc disabled

@nsano-rururu
Copy link
Contributor

@nsano-rururu
Copy link
Contributor

It was a problem if I put in a new version of python's elasticsearch library. The order of the arguments has changed from a certain version, but the correspondence is missing and it is a problem. However, in elastalert 0.2.4, the elasticsearch library of python is fixed at 7.0.0, so if you install it normally, this problem does not occur. all right?

@ashishkaransingh
Copy link
Author

#2725 (comment)
#2725 (comment)
#2725 (comment)

Yes 👍 I was able to cross check file test_rules.py based on a comment made by you in #2725

@ashishkaransingh
Copy link
Author

It was a problem if I put in a new version of python's elasticsearch library. The order of the arguments has changed from a certain version, but the correspondence is missing and it is a problem. However, in elastalert 0.2.4, the elasticsearch library of python is fixed at 7.0.0, so if you install it normally, this problem does not occur. all right?

Sure, I will try after install it. Thank a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants