diff --git a/CHANGELOG.md b/CHANGELOG.md index bfc76a33..cd03c42c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Fixed Search helper to ensure proper retention of the _collapse attribute in chained operations. ([#771](https://github.com/opensearch-project/opensearch-py/pull/771)) - Fixed the use of `minimum_should_match` with `Bool` to allow the use of string-based value (percent string, combination). ([#780](https://github.com/opensearch-project/opensearch-py/pull/780)) +- Fixed incorrect `retry_on_conflict` type ([#795](https://github.com/opensearch-project/opensearch-py/pull/795)) ### Updated APIs - Updated opensearch-py APIs to reflect [opensearch-api-specification@9d3bc34](https://github.com/opensearch-project/opensearch-api-specification/commit/9d3bc340ccd7d049e7d6e14a4aff2293780cb446) ### Security diff --git a/opensearchpy/_async/helpers/document.py b/opensearchpy/_async/helpers/document.py index 594687b1..01804d41 100644 --- a/opensearchpy/_async/helpers/document.py +++ b/opensearchpy/_async/helpers/document.py @@ -315,7 +315,7 @@ async def update( detect_noop: Optional[bool] = True, doc_as_upsert: Optional[bool] = False, refresh: Optional[bool] = False, - retry_on_conflict: Optional[bool] = None, + retry_on_conflict: Optional[int] = None, script: Any = None, script_id: Optional[str] = None, scripted_upsert: Optional[bool] = False, diff --git a/opensearchpy/helpers/document.py b/opensearchpy/helpers/document.py index 370797a9..7a9e3ed6 100644 --- a/opensearchpy/helpers/document.py +++ b/opensearchpy/helpers/document.py @@ -370,7 +370,7 @@ def update( detect_noop: bool = True, doc_as_upsert: bool = False, refresh: bool = False, - retry_on_conflict: Any = None, + retry_on_conflict: int = 0, script: Any = None, script_id: Any = None, scripted_upsert: bool = False, diff --git a/test_opensearchpy/test_async/test_server/test_helpers/test_document.py b/test_opensearchpy/test_async/test_server/test_helpers/test_document.py index 8dda5c59..b02865ed 100644 --- a/test_opensearchpy/test_async/test_server/test_helpers/test_document.py +++ b/test_opensearchpy/test_async/test_server/test_helpers/test_document.py @@ -251,7 +251,7 @@ async def test_update_retry_on_conflict(write_client: Any) -> None: @pytest.mark.parametrize("retry_on_conflict", [None, 0]) # type: ignore async def test_update_conflicting_version( - write_client: Any, retry_on_conflict: bool + write_client: Any, retry_on_conflict: int ) -> None: await Wiki.init() w = Wiki(owner=User(name="Honza Kral"), _id="opensearch-py", views=42) diff --git a/test_opensearchpy/test_server/test_helpers/test_document.py b/test_opensearchpy/test_server/test_helpers/test_document.py index 3c33a798..8f3bdaad 100644 --- a/test_opensearchpy/test_server/test_helpers/test_document.py +++ b/test_opensearchpy/test_server/test_helpers/test_document.py @@ -261,7 +261,7 @@ def test_update_retry_on_conflict(write_client: Any) -> None: @pytest.mark.parametrize("retry_on_conflict", [None, 0]) # type: ignore -def test_update_conflicting_version(write_client: Any, retry_on_conflict: Any) -> None: +def test_update_conflicting_version(write_client: Any, retry_on_conflict: int) -> None: Wiki.init() w = Wiki(owner=User(name="Honza Kral"), _id="opensearch-py", views=42) w.save()