diff --git a/airflow/providers/elasticsearch/log/es_task_handler.py b/airflow/providers/elasticsearch/log/es_task_handler.py index c9d3a180e1edc..227148e52b921 100644 --- a/airflow/providers/elasticsearch/log/es_task_handler.py +++ b/airflow/providers/elasticsearch/log/es_task_handler.py @@ -71,14 +71,17 @@ def get_es_kwargs_from_config() -> dict[str, Any]: if elastic_search_config else {} ) - # For elasticsearch>8 retry_timeout have changed for elasticsearch to retry_on_timeout - # in Elasticsearch() compared to previous versions. - # Read more at: https://elasticsearch-py.readthedocs.io/en/v8.8.2/api.html#module-elasticsearch + # TODO: Remove in next major release (drop support for elasticsearch<8 parameters) if ( elastic_search_config and "retry_timeout" in elastic_search_config and not kwargs_dict.get("retry_on_timeout") ): + warnings.warn( + "retry_timeout is not supported with elasticsearch>=8. Please use `retry_on_timeout`.", + AirflowProviderDeprecationWarning, + stacklevel=2, + ) retry_timeout = elastic_search_config.get("retry_timeout") if retry_timeout is not None: kwargs_dict["retry_on_timeout"] = retry_timeout diff --git a/docs/apache-airflow-providers-elasticsearch/logging/index.rst b/docs/apache-airflow-providers-elasticsearch/logging/index.rst index eb2acc55d224b..fcb943a3d8734 100644 --- a/docs/apache-airflow-providers-elasticsearch/logging/index.rst +++ b/docs/apache-airflow-providers-elasticsearch/logging/index.rst @@ -61,7 +61,6 @@ cert, etc.) use the ``elasticsearch_configs`` setting in your ``airflow.cfg`` remote_logging = True [elasticsearch_configs] - use_ssl=True verify_certs=True ca_certs=/path/to/CA_certs diff --git a/tests/providers/elasticsearch/log/test_es_task_handler.py b/tests/providers/elasticsearch/log/test_es_task_handler.py index ec2bd3016a217..4a6e551b5d1b9 100644 --- a/tests/providers/elasticsearch/log/test_es_task_handler.py +++ b/tests/providers/elasticsearch/log/test_es_task_handler.py @@ -671,14 +671,11 @@ def test_retrieve_config_keys(): """ with conf_vars( { - ("elasticsearch_configs", "use_ssl"): "True", ("elasticsearch_configs", "http_compress"): "False", ("elasticsearch_configs", "timeout"): "10", } ): args_from_config = get_es_kwargs_from_config().keys() - # use_ssl is removed from config - assert "use_ssl" not in args_from_config # verify_certs comes from default config value assert "verify_certs" in args_from_config # timeout comes from config provided value @@ -698,8 +695,6 @@ def test_retrieve_retry_on_timeout(): } ): args_from_config = get_es_kwargs_from_config().keys() - # use_ssl is removed from config - assert "retry_timeout" not in args_from_config # verify_certs comes from default config value assert "retry_on_timeout" in args_from_config