diff --git a/elasticsearch/_sync/client/utils.py b/elasticsearch/_sync/client/utils.py index 1444adf05..f778b35a9 100644 --- a/elasticsearch/_sync/client/utils.py +++ b/elasticsearch/_sync/client/utils.py @@ -379,15 +379,6 @@ def wrapped(*args: Any, **kwargs: Any) -> Any: f"'{body_name}' parameter. See https://github.com/elastic/elasticsearch-py/" "issues/1698 for more information" ) - - warnings.warn( - "The 'body' parameter is deprecated and will be removed " - f"in a future version. Instead use the '{body_name}' parameter. " - "See https://github.com/elastic/elasticsearch-py/issues/1698 " - "for more information", - category=DeprecationWarning, - stacklevel=warn_stacklevel(), - ) kwargs[body_name] = body elif body_fields: @@ -396,12 +387,6 @@ def wrapped(*args: Any, **kwargs: Any) -> Any: "Couldn't merge 'body' with other parameters as it wasn't a mapping. " "Instead of using 'body' use individual API parameters" ) - warnings.warn( - "The 'body' parameter is deprecated and will be removed " - "in a future version. Instead use individual parameters.", - category=DeprecationWarning, - stacklevel=warn_stacklevel(), - ) _merge_kwargs_no_duplicates(kwargs, body) if parameter_aliases: diff --git a/test_elasticsearch/test_client/test_rewrite_parameters.py b/test_elasticsearch/test_client/test_rewrite_parameters.py index 6074c8cc6..831f5c16f 100644 --- a/test_elasticsearch/test_client/test_rewrite_parameters.py +++ b/test_elasticsearch/test_client/test_rewrite_parameters.py @@ -87,18 +87,12 @@ def test_body_name_using_body(self): api_key=("id", "api_key"), body={"query": {"match_all": {}}} ) - assert len(w) == 2 + assert len(w) == 1 assert w[0].category == DeprecationWarning assert ( str(w[0].message) == "Passing transport options in the API method is deprecated. Use 'Elasticsearch.options()' instead." ) - assert w[1].category == DeprecationWarning - assert str(w[1].message) == ( - "The 'body' parameter is deprecated and will be removed in a " - "future version. Instead use the 'document' parameter. See https://github.com/elastic/elasticsearch-py/issues/1698 " - "for more information" - ) assert self.calls == [ ((), {"api_key": ("id", "api_key")}), @@ -139,16 +133,12 @@ def test_body_fields(self): api_key=("id", "api_key"), body={"query": {"match_all": {}}} ) - assert len(w) == 2 + assert len(w) == 1 assert w[0].category == DeprecationWarning assert ( str(w[0].message) == "Passing transport options in the API method is deprecated. Use 'Elasticsearch.options()' instead." ) - assert w[1].category == DeprecationWarning - assert str(w[1].message) == ( - "The 'body' parameter is deprecated and will be removed in a future version. Instead use individual parameters." - ) assert self.calls == [ ((), {"api_key": ("id", "api_key")}),