Skip to content

Commit

Permalink
Updated opensearch-py to reflect the latest OpenSearch API spec (2024…
Browse files Browse the repository at this point in the history
…-06-17) (#763)

Signed-off-by: GitHub <[email protected]>
Co-authored-by: saimedhi <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and saimedhi authored Jun 17, 2024
1 parent 1739a98 commit f7cac30
Show file tree
Hide file tree
Showing 15 changed files with 567 additions and 72 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Removed
### Fixed
### Updated APIs
- Updated opensearch-py APIs to reflect [opensearch-api-specification@49cd814](https://github.com/opensearch-project/opensearch-api-specification/commit/49cd8140663f32f7c8b638ddc295683344edba61)
### Security
### Dependencies

Expand Down
56 changes: 28 additions & 28 deletions opensearchpy/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ async def create(
regardless of the value of this parameter.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg refresh: If `true`, Opensearch refreshes the affected
:arg refresh: If `true`, OpenSearch refreshes the affected
shards to make this operation visible to search, if `wait_for` then wait
for a refresh to make this operation visible to search, if `false` do
nothing with refreshes.Valid values: `true`, `false`, `wait_for`.
Expand Down Expand Up @@ -446,7 +446,7 @@ async def index(
regardless of the value of this parameter.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg refresh: If `true`, Opensearch refreshes the affected
:arg refresh: If `true`, OpenSearch refreshes the affected
shards to make this operation visible to search, if `wait_for` then wait
for a refresh to make this operation visible to search, if `false` do
nothing with refreshes.Valid values: `true`, `false`, `wait_for`.
Expand Down Expand Up @@ -532,7 +532,7 @@ async def bulk(
regardless of the value of this parameter.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg refresh: If `true`, Opensearch refreshes the affected
:arg refresh: If `true`, OpenSearch refreshes the affected
shards to make this operation visible to search, if `wait_for` then wait
for a refresh to make this operation visible to search, if `false` do
nothing with refreshes.Valid values: `true`, `false`, `wait_for`.
Expand Down Expand Up @@ -682,8 +682,8 @@ async def count(
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
:arg terminate_after: Maximum number of documents to collect for
each shard.If a query reaches this limit, Opensearch terminates the
query early.Opensearch collects documents before sorting.
each shard.If a query reaches this limit, OpenSearch terminates the
query early.OpenSearch collects documents before sorting.
"""
return await self.transport.perform_request(
"POST",
Expand Down Expand Up @@ -733,7 +733,7 @@ async def delete(
this sequence number.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg refresh: If `true`, Opensearch refreshes the affected
:arg refresh: If `true`, OpenSearch refreshes the affected
shards to make this operation visible to search, if `wait_for` then wait
for a refresh to make this operation visible to search, if `false` do
nothing with refreshes.Valid values: `true`, `false`, `wait_for`.
Expand Down Expand Up @@ -860,7 +860,7 @@ async def delete_by_query(
:arg pretty: Whether to pretty format the returned JSON
response.
:arg q: Query in the Lucene query string syntax.
:arg refresh: If `true`, Opensearch refreshes all shards
:arg refresh: If `true`, OpenSearch refreshes all shards
involved in the delete by query after the request completes.
:arg request_cache: If `true`, the request cache is used for
this request.Defaults to the index-level setting.
Expand All @@ -885,10 +885,10 @@ async def delete_by_query(
:arg stats: Specific `tag` of the request for logging and
statistical purposes.
:arg terminate_after: Maximum number of documents to collect for
each shard.If a query reaches this limit, Opensearch terminates the
query early.Opensearch collects documents before sorting.Use with
caution.Opensearch applies this parameter to each shard handling the
request.When possible, let Opensearch perform early termination
each shard.If a query reaches this limit, OpenSearch terminates the
query early.OpenSearch collects documents before sorting.Use with
caution.OpenSearch applies this parameter to each shard handling the
request.When possible, let OpenSearch perform early termination
automatically.Avoid specifying this parameter for requests that target
data streams with backing indices across multiple data tiers.
:arg timeout: Period each deletion request waits for active
Expand Down Expand Up @@ -1053,7 +1053,7 @@ async def exists(
response.
:arg realtime: If `true`, the request is real-time as opposed to
near-real-time.
:arg refresh: If `true`, Opensearch refreshes all shards
:arg refresh: If `true`, OpenSearch refreshes all shards
involved in the delete by query after the request completes.
:arg routing: Target the specified primary shard.
:arg source: The URL-encoded request definition. Useful for
Expand Down Expand Up @@ -1125,7 +1125,7 @@ async def exists_source(
response.
:arg realtime: If true, the request is real-time as opposed to
near-real-time.
:arg refresh: If `true`, Opensearch refreshes all shards
:arg refresh: If `true`, OpenSearch refreshes all shards
involved in the delete by query after the request completes.
:arg routing: Target the specified primary shard.
:arg source: The URL-encoded request definition. Useful for
Expand Down Expand Up @@ -1339,7 +1339,7 @@ async def get(
response.
:arg realtime: If `true`, the request is real-time as opposed to
near-real-time.
:arg refresh: If true, Opensearch refreshes the affected shards
:arg refresh: If true, OpenSearch refreshes the affected shards
to make this operation visible to search. If false, do nothing with
refreshes.
:arg routing: Target the specified primary shard.
Expand Down Expand Up @@ -1453,7 +1453,7 @@ async def get_source(
response.
:arg realtime: Boolean) If true, the request is real-time as
opposed to near-real-time.
:arg refresh: If true, Opensearch refreshes the affected shards
:arg refresh: If true, OpenSearch refreshes the affected shards
to make this operation visible to search. If false, do nothing with
refreshes.
:arg routing: Target the specified primary shard.
Expand Down Expand Up @@ -2264,7 +2264,7 @@ async def search(
targets more than 128 shards;the request targets one or more read-only
index;the primary sort of the query targets an indexed field.
:arg preference: Nodes and shards used for the search.By
default, Opensearch selects from eligible nodes and shards using
default, OpenSearch selects from eligible nodes and shards using
adaptive replica selection, accounting for allocation awareness. Valid
values are:`_only_local` to run the search only on shards on the local
node;`_local` to, if possible, run the search on shards on the local
Expand All @@ -2284,7 +2284,7 @@ async def search(
response.
:arg q: Query in the Lucene query string syntax using query
parameter search.Query parameter searches do not support the full
Opensearch Query DSL but are handy for testing.
OpenSearch Query DSL but are handy for testing.
:arg request_cache: If `true`, the caching of search results is
enabled for requests where `size` is `0`.Defaults to index level
settings.
Expand Down Expand Up @@ -2331,10 +2331,10 @@ async def search(
`suggest_field` and `suggest_text` query string parameters are
specified.
:arg terminate_after: Maximum number of documents to collect for
each shard.If a query reaches this limit, Opensearch terminates the
query early.Opensearch collects documents before sorting.Use with
caution.Opensearch applies this parameter to each shard handling the
request.When possible, let Opensearch perform early termination
each shard.If a query reaches this limit, OpenSearch terminates the
query early.OpenSearch collects documents before sorting.Use with
caution.OpenSearch applies this parameter to each shard handling the
request.When possible, let OpenSearch perform early termination
automatically.Avoid specifying this parameter for requests that target
data streams with backing indices across multiple data tiers.If set to
`0` (default), the query does not terminate early.
Expand Down Expand Up @@ -2646,7 +2646,7 @@ async def update(
:arg lang: The script language. Default is painless.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg refresh: If 'true', Opensearch refreshes the affected
:arg refresh: If 'true', OpenSearch refreshes the affected
shards to make this operationvisible to search, if 'wait_for' then wait
for a refresh to make this operationvisible to search, if 'false' do
nothing with refreshes. Valid choices are true, false, wait_for.
Expand All @@ -2659,7 +2659,7 @@ async def update(
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
:arg timeout: Period to wait for dynamic mapping updates and
active shards.This guarantees Opensearch waits for at least the timeout
active shards.This guarantees OpenSearch waits for at least the timeout
before failing.The actual wait time could be longer, particularly when
multiple waits occur.
:arg wait_for_active_shards: The number of shard copies that
Expand Down Expand Up @@ -2784,7 +2784,7 @@ async def update_by_query(
:arg pretty: Whether to pretty format the returned JSON
response.
:arg q: Query in the Lucene query string syntax.
:arg refresh: If `true`, Opensearch refreshes affected shards to
:arg refresh: If `true`, OpenSearch refreshes affected shards to
make the operation visible to search.
:arg request_cache: If `true`, the request cache is used for
this request.
Expand All @@ -2808,10 +2808,10 @@ async def update_by_query(
:arg stats: Specific `tag` of the request for logging and
statistical purposes.
:arg terminate_after: Maximum number of documents to collect for
each shard.If a query reaches this limit, Opensearch terminates the
query early.Opensearch collects documents before sorting.Use with
caution.Opensearch applies this parameter to each shard handling the
request.When possible, let Opensearch perform early termination
each shard.If a query reaches this limit, OpenSearch terminates the
query early.OpenSearch collects documents before sorting.Use with
caution.OpenSearch applies this parameter to each shard handling the
request.When possible, let OpenSearch perform early termination
automatically.Avoid specifying this parameter for requests that target
data streams with backing indices across multiple data tiers.
:arg timeout: Period each update request waits for the following
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/_async/client/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ async def snapshots(
:arg repository: A comma-separated list of snapshot repositories
used to limit the request. Accepts wildcard expressions. `_all` returns
all repositories. If any repository fails during the request, Opensearch
all repositories. If any repository fails during the request, OpenSearch
returns an error.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
Expand Down
8 changes: 4 additions & 4 deletions opensearchpy/_async/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,14 +649,14 @@ async def put_component_template(
Creates or updates a component template.
:arg name: Name of the component template to create. Opensearch
:arg name: Name of the component template to create. OpenSearch
includes the following built-in component templates: `logs-mappings`;
'logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-
mapping`; `synthetics-settings`. Opensearch Agent uses these templates
to configure backing indices for its data streams. If you use Opensearch
mapping`; `synthetics-settings`. OpenSearch Agent uses these templates
to configure backing indices for its data streams. If you use OpenSearch
Agent and want to overwrite one of these templates, set the `version`
for your replacement template higher than the current version. If you
don’t use Opensearch Agent and want to disable all built-in component
don’t use OpenSearch Agent and want to disable all built-in component
and index templates, set `stack.templates.enabled` to `false` using the
cluster update settings API.
:arg body: The template definition
Expand Down
4 changes: 2 additions & 2 deletions opensearchpy/_async/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async def flush(
libraries that do not accept a request body for non-POST requests.
:arg wait_if_ongoing: If `true`, the flush operation blocks
until execution when another flush operation is running.If `false`,
Opensearch returns an error if you request a flush when another flush
OpenSearch returns an error if you request a flush when another flush
operation is running. Default is True.
"""
return await self.transport.perform_request(
Expand Down Expand Up @@ -1164,7 +1164,7 @@ async def put_template(
use 'cluster_manager_timeout' instead.): Period to wait for a connection
to the master node. If no response isreceived before the timeout
expires, the request fails and returns an error.
:arg order: Order in which Opensearch applies this template if
:arg order: Order in which OpenSearch applies this template if
indexmatches multiple templates.Templates with lower 'order' values are
merged first. Templates with higher'order' values are merged later,
overriding templates with lower values.
Expand Down
2 changes: 2 additions & 0 deletions opensearchpy/_async/client/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient
from ..plugins.knn import KnnClient
from ..plugins.ml import MlClient
from ..plugins.notifications import NotificationsClient
from ..plugins.rollups import RollupsClient
from ..plugins.transforms import TransformsClient
Expand All @@ -26,6 +27,7 @@ class PluginsClient(NamespacedClient):

def __init__(self, client: Client) -> None:
super(PluginsClient, self).__init__(client)
self.ml = MlClient(client)
self.transforms = TransformsClient(client)
self.rollups = RollupsClient(client)
self.notifications = NotificationsClient(client)
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/_async/client/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def get(
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
:arg verbose: If true, returns additional information about each
snapshot such as the version of Opensearch which took the snapshot, the
snapshot such as the version of OpenSearch which took the snapshot, the
start and end times of the snapshot, and the number of shards
snapshotted.
"""
Expand Down
Loading

0 comments on commit f7cac30

Please sign in to comment.