Yelp / elastalert

Easy & Flexible Alerting With ElasticSearch
https://elastalert.readthedocs.org
Apache License 2.0
7.99k stars 1.73k forks source link

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

Closed ashishkaransingh closed 3 years ago

ashishkaransingh commented 3 years ago

Ref: https://github.com/Yelp/elastalert/issues/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 commented 3 years ago

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

ashishkaransingh commented 3 years ago

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 commented 3 years ago

https://github.com/Yelp/elastalert/issues/2725#issuecomment-614311117 https://github.com/Yelp/elastalert/issues/2725#issuecomment-730473357 https://github.com/Yelp/elastalert/issues/2725#issuecomment-730474393

nsano-rururu commented 3 years ago

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 commented 3 years ago

#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 commented 3 years ago

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!