Subham-KRLX commented on code in PR #66065:
URL: https://github.com/apache/airflow/pull/66065#discussion_r3218767508


##########
providers/elasticsearch/src/airflow/providers/elasticsearch/hooks/elasticsearch.py:
##########
@@ -135,9 +136,9 @@ def __init__(
         netloc = f"{host}:{port}"
         self.url = parse.urlunparse((scheme, netloc, "/", None, None, None))
         if user and password:
-            self.es = Elasticsearch(self.url, basic_auth=(user, password), 
**kwargs)
+            self.es = apply_compat_with(Elasticsearch(self.url, 
basic_auth=(user, password), **kwargs))

Review Comment:
   Small nit you are constructing the Elasticsearch client twice which creates 
two transports and extra side effects. Construct a single instance and pass it 
to apply_compat_with so the wrapper is applied to the actual client and you 
avoid unnecessary work. Example: [self.es = 
apply_compat_with(Elasticsearch(self.url, basic_auth=(user, password), 
**kwargs))](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to