Skip to content

Commit

Permalink
Update APIs to 8.0.0-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Feb 9, 2022
1 parent 079c268 commit fd191ba
Show file tree
Hide file tree
Showing 6 changed files with 478 additions and 0 deletions.
98 changes: 98 additions & 0 deletions elasticsearch/_async/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,104 @@ async def exists_template(
"HEAD", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def field_usage_stats(
self,
*,
index: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None,
allow_no_indices: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
expand_wildcards: t.Optional[
t.Union[
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str],
t.Union[
t.List[
t.Union[
"t.Literal['all', 'closed', 'hidden', 'none', 'open']", str
]
],
t.Tuple[
t.Union[
"t.Literal['all', 'closed', 'hidden', 'none', 'open']", str
],
...,
],
],
]
] = None,
fields: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
filter_path: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
human: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[int, str]] = None,
pretty: t.Optional[bool] = None,
timeout: t.Optional[t.Union[int, str]] = None,
wait_for_active_shards: t.Optional[
t.Union[int, t.Union["t.Literal['all']", str]]
] = None,
) -> ObjectApiResponse[t.Any]:
"""
Returns the field usage stats for each field of an index
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html>`_
:param index: Comma-separated list or wildcard expression of index names used
to limit the request.
:param allow_no_indices: If false, the request returns an error if any wildcard
expression, index alias, or _all value targets only missing or closed indices.
This behavior applies even if the request targets other open indices. For
example, a request targeting `foo*,bar*` returns an error if an index starts
with `foo` but no index starts with `bar`.
:param expand_wildcards: Type of index that wildcard patterns can match. If the
request can target data streams, this argument determines whether wildcard
expressions match hidden data streams. Supports comma-separated values, such
as `open,hidden`.
:param fields: Comma-separated list or wildcard expressions of fields to include
in the statistics.
:param ignore_unavailable: If true, missing or closed indices are not included
in the response.
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
:param timeout: Period to wait for a response. If no response is received before
the timeout expires, the request fails and returns an error.
:param wait_for_active_shards: The number of shard copies that must be active
before proceeding with the operation. Set to all or any positive integer
up to the total number of shards in the index (`number_of_replicas+1`).
"""
__path = f"/{_quote(index)}/_field_usage_stats"
__query: t.Dict[str, t.Any] = {}
if allow_no_indices is not None:
__query["allow_no_indices"] = allow_no_indices
if error_trace is not None:
__query["error_trace"] = error_trace
if expand_wildcards is not None:
__query["expand_wildcards"] = expand_wildcards
if fields is not None:
__query["fields"] = fields
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if ignore_unavailable is not None:
__query["ignore_unavailable"] = ignore_unavailable
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
if wait_for_active_shards is not None:
__query["wait_for_active_shards"] = wait_for_active_shards
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def flush(
self,
Expand Down
62 changes: 62 additions & 0 deletions elasticsearch/_async/client/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,65 @@ async def deprecations(
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def get_feature_upgrade_status(
self,
*,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Find out whether system features need to be upgraded or not
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-feature-upgrade.html>`_
"""
__path = "/_migration/system_features"
__query: t.Dict[str, t.Any] = {}
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
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def post_feature_upgrade(
self,
*,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Begin upgrades for system features
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-feature-upgrade.html>`_
"""
__path = "/_migration/system_features"
__query: t.Dict[str, t.Any] = {}
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
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST", __path, params=__query, headers=__headers
)
79 changes: 79 additions & 0 deletions elasticsearch/_async/client/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,85 @@


class NodesClient(NamespacedClient):
@_rewrite_parameters()
async def clear_repositories_metering_archive(
self,
*,
node_id: t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]],
max_archive_version: int,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Removes the archived repositories metering information present in the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-repositories-metering-archive-api.html>`_
:param node_id: Comma-separated list of node IDs or names used to limit returned
information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes).
:param max_archive_version: Specifies the maximum [archive_version](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-repositories-metering-api.html#get-repositories-metering-api-response-body)
to be cleared from the archive.
"""
if node_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'node_id'")
if max_archive_version in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'max_archive_version'")
__path = f"/_nodes/{_quote(node_id)}/_repositories_metering/{_quote(max_archive_version)}"
__query: t.Dict[str, t.Any] = {}
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
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"DELETE", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def get_repositories_metering_info(
self,
*,
node_id: t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]],
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Returns cluster repositories metering information.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/get-repositories-metering-api.html>`_
:param node_id: Comma-separated list of node IDs or names used to limit returned
information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes).
"""
if node_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'node_id'")
__path = f"/_nodes/{_quote(node_id)}/_repositories_metering"
__query: t.Dict[str, t.Any] = {}
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
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def hot_threads(
self,
Expand Down
98 changes: 98 additions & 0 deletions elasticsearch/_sync/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,104 @@ def exists_template(
"HEAD", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
def field_usage_stats(
self,
*,
index: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None,
allow_no_indices: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
expand_wildcards: t.Optional[
t.Union[
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str],
t.Union[
t.List[
t.Union[
"t.Literal['all', 'closed', 'hidden', 'none', 'open']", str
]
],
t.Tuple[
t.Union[
"t.Literal['all', 'closed', 'hidden', 'none', 'open']", str
],
...,
],
],
]
] = None,
fields: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
filter_path: t.Optional[
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
] = None,
human: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[int, str]] = None,
pretty: t.Optional[bool] = None,
timeout: t.Optional[t.Union[int, str]] = None,
wait_for_active_shards: t.Optional[
t.Union[int, t.Union["t.Literal['all']", str]]
] = None,
) -> ObjectApiResponse[t.Any]:
"""
Returns the field usage stats for each field of an index
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html>`_
:param index: Comma-separated list or wildcard expression of index names used
to limit the request.
:param allow_no_indices: If false, the request returns an error if any wildcard
expression, index alias, or _all value targets only missing or closed indices.
This behavior applies even if the request targets other open indices. For
example, a request targeting `foo*,bar*` returns an error if an index starts
with `foo` but no index starts with `bar`.
:param expand_wildcards: Type of index that wildcard patterns can match. If the
request can target data streams, this argument determines whether wildcard
expressions match hidden data streams. Supports comma-separated values, such
as `open,hidden`.
:param fields: Comma-separated list or wildcard expressions of fields to include
in the statistics.
:param ignore_unavailable: If true, missing or closed indices are not included
in the response.
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
:param timeout: Period to wait for a response. If no response is received before
the timeout expires, the request fails and returns an error.
:param wait_for_active_shards: The number of shard copies that must be active
before proceeding with the operation. Set to all or any positive integer
up to the total number of shards in the index (`number_of_replicas+1`).
"""
__path = f"/{_quote(index)}/_field_usage_stats"
__query: t.Dict[str, t.Any] = {}
if allow_no_indices is not None:
__query["allow_no_indices"] = allow_no_indices
if error_trace is not None:
__query["error_trace"] = error_trace
if expand_wildcards is not None:
__query["expand_wildcards"] = expand_wildcards
if fields is not None:
__query["fields"] = fields
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if ignore_unavailable is not None:
__query["ignore_unavailable"] = ignore_unavailable
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
if wait_for_active_shards is not None:
__query["wait_for_active_shards"] = wait_for_active_shards
__headers = {"accept": "application/json"}
return self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
def flush(
self,
Expand Down
Loading

0 comments on commit fd191ba

Please sign in to comment.