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’re constructing the 
[Elasticsearch](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
 client twice (creating two transports and extra side‑effects). Construct a 
single instance and pass it to apply_compat_with, e.g. [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)
 so the wrapper is applied to the actual client used and you avoid unnecessary 
work.



-- 
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