Owen-CH-Leung commented on code in PR #33135:
URL: https://github.com/apache/airflow/pull/33135#discussion_r1285877721


##########
airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -292,27 +292,24 @@ def es_read(self, log_id: str, offset: int | str, 
metadata: dict) -> list | Elas
         }
 
         try:
-            max_log_line = self.client.count(index=self.index_patterns, 
body=query)["count"]
+            max_log_line = self.client.count(index=self.index_patterns, 
body=query)["count"]  # type: ignore

Review Comment:
   So - if we look at the official ES package, the `count` API from the 
`ElasticSearch` class actually didn't have the `body` as parameter. See this 
link: 
https://github.com/elastic/elasticsearch-py/blob/main/elasticsearch/_sync/client/__init__.py#L801
   
   But the body parameter is still accepted because there's a decorator at the 
beginning, which modifies the function to accept `body` as the argument. See 
this few lines : 
https://github.com/elastic/elasticsearch-py/blob/main/elasticsearch/_sync/client/__init__.py#L798-L800
   
   Therefore, without type ignore, the pre-commit job `mypy at provider` will 
actually get failed because it thinks that body is not an accepted parameter 
(which actually is)



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