[7.x] Sort imports with isort and regenerate APIs

This commit is contained in:
Seth Michael Larson
2021-01-13 14:21:04 -06:00
committed by GitHub
parent e0e54a1128
commit a728aaa491
195 changed files with 1010 additions and 816 deletions
+17 -12
View File
@@ -17,45 +17,45 @@
# under the License.
from __future__ import unicode_literals
import logging
from ..transport import AsyncTransport, TransportError
from .utils import query_params, _make_path, SKIP_IN_PATH, _bulk_body, _normalize_hosts
from .async_search import AsyncSearchClient
from .autoscaling import AutoscalingClient
from .cat import CatClient
from .ccr import CcrClient
from .cluster import ClusterClient
from .dangling_indices import DanglingIndicesClient
from .indices import IndicesClient
from .ingest import IngestClient
from .nodes import NodesClient
from .remote import RemoteClient
from .snapshot import SnapshotClient
from .tasks import TasksClient
# xpack APIs
from .xpack import XPackClient
from .ccr import CcrClient
from .data_frame import Data_FrameClient
from .deprecation import DeprecationClient
from .enrich import EnrichClient
from .eql import EqlClient
from .graph import GraphClient
from .ilm import IlmClient
from .indices import IndicesClient
from .ingest import IngestClient
from .license import LicenseClient
from .migration import MigrationClient
from .ml import MlClient
from .monitoring import MonitoringClient
from .nodes import NodesClient
from .remote import RemoteClient
from .rollup import RollupClient
from .searchable_snapshots import SearchableSnapshotsClient
from .security import SecurityClient
from .slm import SlmClient
from .snapshot import SnapshotClient
from .sql import SqlClient
from .ssl import SslClient
from .tasks import TasksClient
from .text_structure import TextStructureClient
from .transform import TransformClient
from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params
from .watcher import WatcherClient
# xpack APIs
from .xpack import XPackClient
logger = logging.getLogger("elasticsearch")
@@ -233,6 +233,7 @@ class AsyncElasticsearch(object):
self.slm = SlmClient(self)
self.sql = SqlClient(self)
self.ssl = SslClient(self)
self.text_structure = TextStructureClient(self)
self.transform = TransformClient(self)
self.watcher = WatcherClient(self)
@@ -1534,6 +1535,7 @@ class AsyncElasticsearch(object):
"ignore_unavailable",
"lenient",
"max_concurrent_shard_requests",
"min_compatible_shard_node",
"pre_filter_shard_size",
"preference",
"q",
@@ -1616,6 +1618,9 @@ class AsyncElasticsearch(object):
shard requests per node this search executes concurrently. This value
should be used to limit the impact of the search on the cluster in order
to limit the number of concurrent shard requests Default: 5
:arg min_compatible_shard_node: The minimum compatible version
that all shards involved in search should have for this request to be
successful
:arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the
+15 -12
View File
@@ -17,43 +17,44 @@
# under the License.
from __future__ import unicode_literals
import logging
from typing import Any, MutableMapping, Optional, Type, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Type, Union
from ..transport import AsyncTransport
from .async_search import AsyncSearchClient
from .autoscaling import AutoscalingClient
from .cat import CatClient
from .ccr import CcrClient
from .cluster import ClusterClient
from .dangling_indices import DanglingIndicesClient
from .indices import IndicesClient
from .ingest import IngestClient
from .nodes import NodesClient
from .remote import RemoteClient
from .snapshot import SnapshotClient
from .tasks import TasksClient
# xpack APIs
from .xpack import XPackClient
from .ccr import CcrClient
from .enrich import EnrichClient
from .eql import EqlClient
from .graph import GraphClient
from .ilm import IlmClient
from .indices import IndicesClient
from .ingest import IngestClient
from .license import LicenseClient
from .migration import MigrationClient
from .ml import MlClient
from .monitoring import MonitoringClient
from .nodes import NodesClient
from .remote import RemoteClient
from .rollup import RollupClient
from .searchable_snapshots import SearchableSnapshotsClient
from .security import SecurityClient
from .slm import SlmClient
from .snapshot import SnapshotClient
from .sql import SqlClient
from .ssl import SslClient
from .tasks import TasksClient
from .text_structure import TextStructureClient
from .transform import TransformClient
from .watcher import WatcherClient
# xpack APIs
from .xpack import XPackClient
logger: logging.Logger
class AsyncElasticsearch(object):
@@ -88,6 +89,7 @@ class AsyncElasticsearch(object):
sql: SqlClient
ssl: SslClient
transform: TransformClient
text_structure: TextStructureClient
watcher: WatcherClient
def __init__(
self,
@@ -788,6 +790,7 @@ class AsyncElasticsearch(object):
ignore_unavailable: Optional[Any] = ...,
lenient: Optional[Any] = ...,
max_concurrent_shard_requests: Optional[Any] = ...,
min_compatible_shard_node: Optional[Any] = ...,
pre_filter_shard_size: Optional[Any] = ...,
preference: Optional[Any] = ...,
q: Optional[Any] = ...,
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class AsyncSearchClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class AsyncSearchClient(NamespacedClient):
+9 -25
View File
@@ -15,22 +15,18 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, SKIP_IN_PATH, _make_path
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class AutoscalingClient(NamespacedClient):
@query_params()
async def delete_autoscaling_policy(self, name, params=None, headers=None):
"""
Deletes an autoscaling policy.
Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
Direct use is not supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-delete-autoscaling-policy.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg name: the name of the autoscaling policy
"""
if name in SKIP_IN_PATH:
@@ -46,15 +42,11 @@ class AutoscalingClient(NamespacedClient):
@query_params()
async def get_autoscaling_policy(self, name, params=None, headers=None):
"""
Retrieves an autoscaling policy.
Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
Direct use is not supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-get-autoscaling-policy.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg name: the name of the autoscaling policy
"""
if name in SKIP_IN_PATH:
@@ -70,15 +62,11 @@ class AutoscalingClient(NamespacedClient):
@query_params()
async def put_autoscaling_policy(self, name, body, params=None, headers=None):
"""
Creates a new autoscaling policy.
Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
Direct use is not supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-put-autoscaling-policy.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg name: the name of the autoscaling policy
:arg body: the specification of the autoscaling policy
"""
@@ -98,14 +86,10 @@ class AutoscalingClient(NamespacedClient):
async def get_autoscaling_capacity(self, params=None, headers=None):
"""
Gets the current autoscaling capacity based on the configured autoscaling
policy.
policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not
supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-get-autoscaling-capacity.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
"""
return await self.transport.perform_request(
"GET", "/_autoscaling/capacity", params=params, headers=headers
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class AutoscalingClient(NamespacedClient):
+13 -10
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path
from .utils import NamespacedClient, _make_path, query_params
class CatClient(NamespacedClient):
@@ -420,7 +420,9 @@ class CatClient(NamespacedClient):
headers=headers,
)
@query_params("format", "h", "help", "local", "master_timeout", "s", "v")
@query_params(
"format", "h", "help", "include_bootstrap", "local", "master_timeout", "s", "v"
)
async def plugins(self, params=None, headers=None):
"""
Returns information about installed plugins across nodes node.
@@ -431,6 +433,8 @@ class CatClient(NamespacedClient):
yaml
:arg h: Comma-separated list of column names to display
:arg help: Return help information
:arg include_bootstrap: Include bootstrap plugins in the
response
:arg local: Return local information, do not retrieve the state
from master node (default: false)
:arg master_timeout: Explicit operation timeout for connection
@@ -527,8 +531,8 @@ class CatClient(NamespacedClient):
"format",
"h",
"help",
"node_id",
"parent_task",
"nodes",
"parent_task_id",
"s",
"time",
"v",
@@ -547,12 +551,11 @@ class CatClient(NamespacedClient):
yaml
:arg h: Comma-separated list of column names to display
:arg help: Return help information
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg parent_task: Return tasks with specified parent task id.
Set to -1 to return all.
:arg nodes: A comma-separated list of node IDs or names to limit
the returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all nodes
:arg parent_task_id: Return tasks with specified parent task id
(node_id:task_number). Set to -1 to return all.
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
+5 -3
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class CatClient(NamespacedClient):
@@ -322,6 +323,7 @@ class CatClient(NamespacedClient):
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
include_bootstrap: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
@@ -406,8 +408,8 @@ class CatClient(NamespacedClient):
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
node_id: Optional[Any] = ...,
parent_task: Optional[Any] = ...,
nodes: Optional[Any] = ...,
parent_task_id: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class CcrClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class CcrClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class ClusterClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class ClusterClient(NamespacedClient):
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class DanglingIndicesClient(NamespacedClient):
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class DanglingIndicesClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class Data_FrameClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class Data_FrameClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path
from .utils import NamespacedClient, _make_path, query_params
class DeprecationClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class DeprecationClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class EnrichClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class EnrichClient(NamespacedClient):
+1 -16
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class EqlClient(NamespacedClient):
@@ -26,11 +26,6 @@ class EqlClient(NamespacedClient):
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
.. warning::
This API is **beta** so may include breaking changes
or be removed in a future version
:arg index: The name of the index to scope the operation
:arg body: Eql request body. Use the `query` to limit the query
scope.
@@ -62,11 +57,6 @@ class EqlClient(NamespacedClient):
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
.. warning::
This API is **beta** so may include breaking changes
or be removed in a future version
:arg id: The async search ID
"""
if id in SKIP_IN_PATH:
@@ -84,11 +74,6 @@ class EqlClient(NamespacedClient):
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
.. warning::
This API is **beta** so may include breaking changes
or be removed in a future version
:arg id: The async search ID
:arg keep_alive: Update the time interval in which the results
(partial or final) for this search will be available Default: 5d
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class EqlClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class GraphClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class GraphClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IlmClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class IlmClient(NamespacedClient):
+20 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IndicesClient(NamespacedClient):
@@ -1625,3 +1625,22 @@ class IndicesClient(NamespacedClient):
params=params,
headers=headers,
)
@query_params()
async def migrate_to_data_stream(self, name, params=None, headers=None):
"""
Migrates an alias to a data stream
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
:arg name: The name of the alias to migrate
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return await self.transport.perform_request(
"POST",
_make_path("_data_stream", "_migrate", name),
params=params,
headers=headers,
)
+17 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class IndicesClient(NamespacedClient):
@@ -1079,3 +1080,18 @@ class IndicesClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
async def migrate_to_data_stream(
self,
name: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IngestClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class IngestClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class LicenseClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path
from .utils import NamespacedClient, _make_path, query_params
class MigrationClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class MigrationClient(NamespacedClient):
+1 -74
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH, _bulk_body
from .utils import SKIP_IN_PATH, NamespacedClient, _bulk_body, _make_path, query_params
class MlClient(NamespacedClient):
@@ -255,79 +255,6 @@ class MlClient(NamespacedClient):
headers=headers,
)
@query_params(
"charset",
"column_names",
"delimiter",
"explain",
"format",
"grok_pattern",
"has_header_row",
"line_merge_size_limit",
"lines_to_sample",
"quote",
"should_trim_fields",
"timeout",
"timestamp_field",
"timestamp_format",
)
async def find_file_structure(self, body, params=None, headers=None):
"""
Finds the structure of a text file. The text file must contain data that is
suitable to be ingested into Elasticsearch.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-find-file-structure.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of
the file
:arg column_names: Optional parameter containing a comma
separated list of the column names for a delimited file
:arg delimiter: Optional parameter to specify the delimiter
character for a delimited file - must be a single character
:arg explain: Whether to include a commentary on how the
structure was derived
:arg format: Optional parameter to specify the high level file
format Valid choices: ndjson, xml, delimited, semi_structured_text
:arg grok_pattern: Optional parameter to specify the Grok
pattern that should be used to extract fields from messages in a semi-
structured text file
:arg has_header_row: Optional parameter to specify whether a
delimited file includes the column names in its first row
:arg line_merge_size_limit: Maximum number of characters
permitted in a single message when lines are merged to create messages.
Default: 10000
:arg lines_to_sample: How many lines of the file should be
included in the analysis Default: 1000
:arg quote: Optional parameter to specify the quote character
for a delimited file - must be a single character
:arg should_trim_fields: Optional parameter to specify whether
the values between delimiters in a delimited file should have whitespace
trimmed from them
:arg timeout: Timeout after which the analysis will be aborted
Default: 25s
:arg timestamp_field: Optional parameter to specify the
timestamp field in the file
:arg timestamp_format: Optional parameter to specify the
timestamp format in the file - may be either a Joda or Java time format
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request(
"POST",
"/_ml/find_file_structure",
params=params,
headers=headers,
body=body,
)
@query_params("advance_time", "calc_interim", "end", "skip_time", "start")
async def flush_job(self, job_id, body=None, params=None, headers=None):
"""
+2 -29
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class MlClient(NamespacedClient):
@@ -186,34 +187,6 @@ class MlClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
async def find_file_structure(
self,
*,
body: Any,
charset: Optional[Any] = ...,
column_names: Optional[Any] = ...,
delimiter: Optional[Any] = ...,
explain: Optional[Any] = ...,
format: Optional[Any] = ...,
grok_pattern: Optional[Any] = ...,
has_header_row: Optional[Any] = ...,
line_merge_size_limit: Optional[Any] = ...,
lines_to_sample: Optional[Any] = ...,
quote: Optional[Any] = ...,
should_trim_fields: Optional[Any] = ...,
timeout: Optional[Any] = ...,
timestamp_field: Optional[Any] = ...,
timestamp_format: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
async def flush_job(
self,
job_id: Any,
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH, _bulk_body
from .utils import SKIP_IN_PATH, NamespacedClient, _bulk_body, _make_path, query_params
class MonitoringClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class MonitoringClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path
from .utils import NamespacedClient, _make_path, query_params
class NodesClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class NodesClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class RemoteClient(NamespacedClient):
+5 -4
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class RollupClient(NamespacedClient):
@@ -218,22 +218,23 @@ class RollupClient(NamespacedClient):
)
@query_params()
async def rollup(self, index, body, params=None, headers=None):
async def rollup(self, index, rollup_index, body, params=None, headers=None):
"""
Rollup an index
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-api.html>`_
:arg index: The index to roll up
:arg rollup_index: The name of the rollup index to create
:arg body: The rollup configuration
"""
for param in (index, body):
for param in (index, rollup_index, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"POST",
_make_path(index, "_rollup"),
_make_path(index, "_rollup", rollup_index),
params=params,
headers=headers,
body=body,
+3 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class RollupClient(NamespacedClient):
@@ -149,6 +150,7 @@ class RollupClient(NamespacedClient):
async def rollup(
self,
index: Any,
rollup_index: Any,
*,
body: Any,
pretty: Optional[bool] = ...,
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SearchableSnapshotsClient(NamespacedClient):
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class SearchableSnapshotsClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SecurityClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class SecurityClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SlmClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class SlmClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SnapshotClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class SnapshotClient(NamespacedClient):
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, query_params
class SqlClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class SqlClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class SslClient(NamespacedClient):
+2 -1
View File
@@ -16,7 +16,8 @@
# under the License.
import warnings
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class TasksClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class TasksClient(NamespacedClient):
@@ -0,0 +1,93 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from .utils import SKIP_IN_PATH, NamespacedClient, _bulk_body, query_params
class TextStructureClient(NamespacedClient):
@query_params(
"charset",
"column_names",
"delimiter",
"explain",
"format",
"grok_pattern",
"has_header_row",
"line_merge_size_limit",
"lines_to_sample",
"quote",
"should_trim_fields",
"timeout",
"timestamp_field",
"timestamp_format",
)
async def find_structure(self, body, params=None, headers=None):
"""
Finds the structure of a text file. The text file must contain data that is
suitable to be ingested into Elasticsearch.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-find-file-structure.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of
the file
:arg column_names: Optional parameter containing a comma
separated list of the column names for a delimited file
:arg delimiter: Optional parameter to specify the delimiter
character for a delimited file - must be a single character
:arg explain: Whether to include a commentary on how the
structure was derived
:arg format: Optional parameter to specify the high level file
format Valid choices: ndjson, xml, delimited, semi_structured_text
:arg grok_pattern: Optional parameter to specify the Grok
pattern that should be used to extract fields from messages in a semi-
structured text file
:arg has_header_row: Optional parameter to specify whether a
delimited file includes the column names in its first row
:arg line_merge_size_limit: Maximum number of characters
permitted in a single message when lines are merged to create messages.
Default: 10000
:arg lines_to_sample: How many lines of the file should be
included in the analysis Default: 1000
:arg quote: Optional parameter to specify the quote character
for a delimited file - must be a single character
:arg should_trim_fields: Optional parameter to specify whether
the values between delimiters in a delimited file should have whitespace
trimmed from them
:arg timeout: Timeout after which the analysis will be aborted
Default: 25s
:arg timestamp_field: Optional parameter to specify the
timestamp field in the file
:arg timestamp_format: Optional parameter to specify the
timestamp format in the file - may be either a Joda or Java time format
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request(
"POST",
"/_text_structure/find_structure",
params=params,
headers=headers,
body=body,
)
@@ -0,0 +1,50 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class TextStructureClient(NamespacedClient):
async def find_structure(
self,
*,
body: Any,
charset: Optional[Any] = ...,
column_names: Optional[Any] = ...,
delimiter: Optional[Any] = ...,
explain: Optional[Any] = ...,
format: Optional[Any] = ...,
grok_pattern: Optional[Any] = ...,
has_header_row: Optional[Any] = ...,
line_merge_size_limit: Optional[Any] = ...,
lines_to_sample: Optional[Any] = ...,
quote: Optional[Any] = ...,
should_trim_fields: Optional[Any] = ...,
timeout: Optional[Any] = ...,
timestamp_field: Optional[Any] = ...,
timestamp_format: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class TransformClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class TransformClient(NamespacedClient):
+5 -5
View File
@@ -16,11 +16,11 @@
# under the License.
from ...client.utils import ( # noqa
_make_path,
_normalize_hosts,
_escape,
_bulk_body,
query_params,
SKIP_IN_PATH,
NamespacedClient,
_bulk_body,
_escape,
_make_path,
_normalize_hosts,
query_params,
)
+7 -9
View File
@@ -15,16 +15,14 @@
# specific language governing permissions and limitations
# under the License.
from ...client.utils import ( # noqa
_make_path as _make_path,
_normalize_hosts as _normalize_hosts,
_escape as _escape,
_bulk_body as _bulk_body,
query_params as query_params,
SKIP_IN_PATH as SKIP_IN_PATH,
)
from ..transport import AsyncTransport
from ...client.utils import SKIP_IN_PATH as SKIP_IN_PATH
from ...client.utils import _bulk_body as _bulk_body
from ...client.utils import _escape as _escape
from ...client.utils import _make_path as _make_path # noqa
from ...client.utils import _normalize_hosts as _normalize_hosts
from ...client.utils import query_params as query_params
from ..client import AsyncElasticsearch
from ..transport import AsyncTransport
class NamespacedClient:
client: AsyncElasticsearch
+1 -1
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class WatcherClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class WatcherClient(NamespacedClient):
+2 -1
View File
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from typing import Any, MutableMapping, Optional, Union, Collection
from typing import Any, Collection, MutableMapping, Optional, Union
from .utils import NamespacedClient
class XPackClient(NamespacedClient):