Skip to content
Open
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
16 changes: 11 additions & 5 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ async def bulk(
<li>JavaScript: Check out <code>client.helpers.*</code></li>
<li>.NET: Check out <code>BulkAllObservable</code></li>
<li>PHP: Check out bulk indexing.</li>
<li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
</ul>
<p><strong>Submitting bulk requests with cURL</strong></p>
<p>If you're providing text file input to <code>curl</code>, you must use the <code>--data-binary</code> flag instead of plain <code>-d</code>.
Expand Down Expand Up @@ -1416,7 +1417,7 @@ async def delete(
)

@_rewrite_parameters(
body_fields=("max_docs", "query", "slice"),
body_fields=("max_docs", "query", "slice", "sort"),
parameter_aliases={"from": "from_"},
)
async def delete_by_query(
Expand Down Expand Up @@ -1460,7 +1461,12 @@ async def delete_by_query(
] = None,
slice: t.Optional[t.Mapping[str, t.Any]] = None,
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
sort: t.Optional[t.Sequence[str]] = None,
sort: t.Optional[
t.Union[
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
t.Union[str, t.Mapping[str, t.Any]],
]
] = None,
stats: t.Optional[t.Sequence[str]] = None,
terminate_after: t.Optional[int] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
Expand Down Expand Up @@ -1592,7 +1598,7 @@ async def delete_by_query(
:param slice: Slice the request manually using the provided slice ID and total
number of slices.
:param slices: The number of slices this task should be divided into.
:param sort: A comma-separated list of `<field>:<direction>` pairs.
:param sort: A sort object that specifies the order of deleted documents.
:param stats: The specific `tag` of the request for logging and statistical purposes.
:param terminate_after: The maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
Expand Down Expand Up @@ -1682,8 +1688,6 @@ async def delete_by_query(
__query["search_type"] = search_type
if slices is not None:
__query["slices"] = slices
if sort is not None:
__query["sort"] = sort
if stats is not None:
__query["stats"] = stats
if terminate_after is not None:
Expand All @@ -1703,6 +1707,8 @@ async def delete_by_query(
__body["query"] = query
if slice is not None:
__body["slice"] = slice
if sort is not None:
__body["sort"] = sort
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
Expand Down
134 changes: 124 additions & 10 deletions elasticsearch/_async/client/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,34 @@ async def aliases(
] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
h: t.Optional[
t.Union[
t.Sequence[
t.Union[
str,
t.Literal[
"alias",
"filter",
"index",
"is_write_index",
"routing.index",
"routing.search",
],
]
],
t.Union[
str,
t.Literal[
"alias",
"filter",
"index",
"is_write_index",
"routing.index",
"routing.search",
],
],
]
] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
Expand All @@ -74,7 +101,8 @@ async def aliases(
values, such as `open,hidden`.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
:param h: List of columns to appear in the response. Supports simple wildcards.
:param h: A comma-separated list of columns names to display. It supports simple
wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
Expand Down Expand Up @@ -137,7 +165,48 @@ async def allocation(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
h: t.Optional[
t.Union[
t.Sequence[
t.Union[
str,
t.Literal[
"disk.avail",
"disk.indices",
"disk.indices.forecast",
"disk.percent",
"disk.total",
"disk.used",
"host",
"ip",
"node",
"node.role",
"shards",
"shards.undesired",
"write_load.forecast",
],
]
],
t.Union[
str,
t.Literal[
"disk.avail",
"disk.indices",
"disk.indices.forecast",
"disk.percent",
"disk.total",
"disk.used",
"host",
"ip",
"node",
"node.role",
"shards",
"shards.undesired",
"write_load.forecast",
],
],
]
] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
Expand All @@ -161,7 +230,8 @@ async def allocation(
:param bytes: The unit used to display byte values.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
:param h: List of columns to appear in the response. Supports simple wildcards.
:param h: A comma-separated list of columns names to display. It supports simple
wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
Expand Down Expand Up @@ -224,7 +294,36 @@ async def component_templates(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
h: t.Optional[
t.Union[
t.Sequence[
t.Union[
str,
t.Literal[
"alias_count",
"included_in",
"mapping_count",
"metadata_count",
"name",
"settings_count",
"version",
],
]
],
t.Union[
str,
t.Literal[
"alias_count",
"included_in",
"mapping_count",
"metadata_count",
"name",
"settings_count",
"version",
],
],
]
] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
Expand All @@ -249,7 +348,8 @@ async def component_templates(
If it is omitted, all component templates are returned.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
:param h: List of columns to appear in the response. Supports simple wildcards.
:param h: A comma-separated list of columns names to display. It supports simple
wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
Expand Down Expand Up @@ -310,7 +410,12 @@ async def count(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
h: t.Optional[
t.Union[
t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]],
t.Union[str, t.Literal["count", "epoch", "timestamp"]],
]
] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
Expand All @@ -334,7 +439,8 @@ async def count(
and indices, omit this parameter or use `*` or `_all`.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
:param h: List of columns to appear in the response. Supports simple wildcards.
:param h: A comma-separated list of columns names to display. It supports simple
wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param s: List of columns that determine how the table should be sorted. Sorting
Expand Down Expand Up @@ -389,7 +495,14 @@ async def fielddata(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
h: t.Optional[
t.Union[
t.Sequence[
t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]]
],
t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]],
]
] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
Expand All @@ -412,7 +525,8 @@ async def fielddata(
:param bytes: The unit used to display byte values.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
:param h: List of columns to appear in the response. Supports simple wildcards.
:param h: A comma-separated list of columns names to display. It supports simple
wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param s: List of columns that determine how the table should be sorted. Sorting
Expand Down
8 changes: 4 additions & 4 deletions elasticsearch/_async/client/esql.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class EsqlClient(NamespacedClient):
async def async_query(
self,
*,
query: t.Optional[str] = None,
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
drop_null_columns: t.Optional[bool] = None,
Expand Down Expand Up @@ -153,7 +153,7 @@ async def async_query(
__query["pretty"] = pretty
if not __body:
if query is not None:
__body["query"] = query
__body["query"] = str(query)
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
Expand Down Expand Up @@ -391,7 +391,7 @@ async def async_query_stop(
async def query(
self,
*,
query: t.Optional[str] = None,
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
drop_null_columns: t.Optional[bool] = None,
Expand Down Expand Up @@ -480,7 +480,7 @@ async def query(
__query["pretty"] = pretty
if not __body:
if query is not None:
__body["query"] = query
__body["query"] = str(query)
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ async def query(
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
keep_on_completion: t.Optional[bool] = None,
page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
params: t.Optional[t.Mapping[str, t.Any]] = None,
params: t.Optional[t.Sequence[t.Any]] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[str] = None,
request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
Expand Down
60 changes: 60 additions & 0 deletions elasticsearch/_async/client/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,66 @@ async def schedule_now_transform(
path_parts=__path_parts,
)

@_rewrite_parameters()
async def set_upgrade_mode(
self,
*,
enabled: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html

<p>Set upgrade_mode for transform indices.
Sets a cluster wide upgrade_mode setting that prepares transform
indices for an upgrade.
When upgrading your cluster, in some circumstances you must restart your
nodes and reindex your transform indices. In those circumstances,
there must be no transforms running. You can close the transforms,
do the upgrade, then open all the transforms again. Alternatively,
you can use this API to temporarily halt tasks associated with the transforms
and prevent new transforms from opening. You can also use this API
during upgrades that do not require you to reindex your transform
indices, though stopping transforms is not a requirement in that case.
You can see the current value for the upgrade_mode setting by using the get
transform info API.</p>


`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-set-upgrade-mode>`_

:param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
all transform tasks and prohibits new transform tasks from starting.
:param timeout: The time to wait for the request to be completed.
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_transform/set_upgrade_mode"
__query: t.Dict[str, t.Any] = {}
if enabled is not None:
__query["enabled"] = enabled
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
endpoint_id="transform.set_upgrade_mode",
path_parts=__path_parts,
)

@_rewrite_parameters(
parameter_aliases={"from": "from_"},
)
Expand Down
Loading
Loading