Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated bulk action in helpers #239

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Added
- Added Point in time API rest API([#191](https://github.com/opensearch-project/opensearch-py/pull/191))
- Github workflow for changelog verification ([#218](https://github.com/opensearch-project/opensearch-py/pull/218))
- Added overload decorators to helpers-actions.pyi-"bulk" ([#239](https://github.com/opensearch-project/opensearch-py/pull/239))
### Changed
- Updated getting started to user guide ([#233](https://github.com/opensearch-project/opensearch-py/pull/233))
### Deprecated
Expand Down
21 changes: 19 additions & 2 deletions opensearchpy/helpers/actions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# under the License.

import logging
import sys
from typing import (
Any,
AsyncIterable,
Expand All @@ -38,8 +39,14 @@ from typing import (
Optional,
Tuple,
Union,
overload,
)

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

from ..client import OpenSearch
from ..serializer import Serializer

Expand Down Expand Up @@ -74,14 +81,24 @@ def streaming_bulk(
*args: Any,
**kwargs: Any
) -> Generator[Tuple[bool, Any], None, None]: ...
@overload
def bulk(
client: OpenSearch,
actions: Iterable[Any],
stats_only: bool = ...,
stats_only: Literal[True] = ...,
ignore_status: Optional[Union[int, Collection[int]]] = ...,
*args: Any,
**kwargs: Any
) -> Tuple[int, Union[int, List[Any]]]: ...
) -> Tuple[int, int]: ...
@overload
def bulk(
client: OpenSearch,
actions: Iterable[Any],
stats_only: Literal[False],
ignore_status: Optional[Union[int, Collection[int]]] = ...,
*args: Any,
**kwargs: Any
) -> Tuple[int, List[Any]]: ...
def parallel_bulk(
client: OpenSearch,
actions: Iterable[Any],
Expand Down