[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
+1 -1
View File
@@ -52,7 +52,7 @@ The process for contributing to any of the Elasticsearch repositories is similar
$ python -m pip install nox
# Auto-format and lint your changes
$ nox -s blacken
$ nox -s format
# Run the test suite
$ python setup.py test
+1
View File
@@ -13,6 +13,7 @@ pandas
# not amending that requirement to the package. :(
pyyaml<5.3
isort
black; python_version>="3.6"
twine
+10
View File
@@ -166,6 +166,16 @@ to encrypt communications in your Elasticsearch cluster.
.. autoclass:: SslClient
:members:
Text Structure
--------------
`Text Structure API <https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-find-file-structure.html>`_
finds the structure of a text file. The text file must contain data that is
suitable to be ingested into Elasticsearch.
.. autoclass:: TextStructureClient
:members:
Transform
---------
+16 -16
View File
@@ -18,9 +18,9 @@
# flake8: noqa
from __future__ import absolute_import
import logging
import re
import sys
import logging
import warnings
from ._version import __versionstr__
@@ -34,26 +34,26 @@ logger = logging.getLogger("elasticsearch")
logger.addHandler(logging.NullHandler())
from .client import Elasticsearch
from .transport import Transport
from .connection_pool import ConnectionPool, ConnectionSelector, RoundRobinSelector
from .serializer import JSONSerializer
from .connection import Connection, RequestsHttpConnection, Urllib3HttpConnection
from .connection_pool import ConnectionPool, ConnectionSelector, RoundRobinSelector
from .exceptions import (
ImproperlyConfigured,
ElasticsearchException,
SerializationError,
TransportError,
NotFoundError,
ConflictError,
RequestError,
ConnectionError,
SSLError,
ConnectionTimeout,
AuthenticationException,
AuthorizationException,
ElasticsearchWarning,
ConflictError,
ConnectionError,
ConnectionTimeout,
ElasticsearchDeprecationWarning,
ElasticsearchException,
ElasticsearchWarning,
ImproperlyConfigured,
NotFoundError,
RequestError,
SerializationError,
SSLError,
TransportError,
)
from .serializer import JSONSerializer
from .transport import Transport
# Only raise one warning per deprecation message so as not
# to spam up the user if the same action is done multiple times.
@@ -90,9 +90,9 @@ try:
if sys.version_info < (3, 6):
raise ImportError
from ._async.client import AsyncElasticsearch
from ._async.http_aiohttp import AIOHttpConnection, AsyncConnection
from ._async.transport import AsyncTransport
from ._async.client import AsyncElasticsearch
__all__ += [
"AIOHttpConnection",
+21 -25
View File
@@ -19,41 +19,37 @@ import sys
from typing import Tuple
from .client import Elasticsearch as Elasticsearch
from .transport import Transport as Transport
from .connection_pool import (
ConnectionPool as ConnectionPool,
ConnectionSelector as ConnectionSelector,
RoundRobinSelector as RoundRobinSelector,
)
from .serializer import JSONSerializer as JSONSerializer
from .connection import (
Connection as Connection,
RequestsHttpConnection as RequestsHttpConnection,
Urllib3HttpConnection as Urllib3HttpConnection,
)
from .connection import Connection as Connection
from .connection import RequestsHttpConnection as RequestsHttpConnection
from .connection import Urllib3HttpConnection as Urllib3HttpConnection
from .connection_pool import ConnectionPool as ConnectionPool
from .connection_pool import ConnectionSelector as ConnectionSelector
from .connection_pool import RoundRobinSelector as RoundRobinSelector
from .exceptions import AuthenticationException as AuthenticationException
from .exceptions import AuthorizationException as AuthorizationException
from .exceptions import ConflictError as ConflictError
from .exceptions import ConnectionError as ConnectionError
from .exceptions import ConnectionTimeout as ConnectionTimeout
from .exceptions import (
ImproperlyConfigured as ImproperlyConfigured,
ElasticsearchException as ElasticsearchException,
SerializationError as SerializationError,
TransportError as TransportError,
NotFoundError as NotFoundError,
ConflictError as ConflictError,
RequestError as RequestError,
ConnectionError as ConnectionError,
SSLError as SSLError,
ConnectionTimeout as ConnectionTimeout,
AuthenticationException as AuthenticationException,
AuthorizationException as AuthorizationException,
ElasticsearchDeprecationWarning as ElasticsearchDeprecationWarning,
)
from .exceptions import ElasticsearchException as ElasticsearchException
from .exceptions import ImproperlyConfigured as ImproperlyConfigured
from .exceptions import NotFoundError as NotFoundError
from .exceptions import RequestError as RequestError
from .exceptions import SerializationError as SerializationError
from .exceptions import SSLError as SSLError
from .exceptions import TransportError as TransportError
from .serializer import JSONSerializer as JSONSerializer
from .transport import Transport as Transport
try:
if sys.version_info < (3, 6):
raise ImportError
from ._async.client import AsyncElasticsearch as AsyncElasticsearch
from ._async.http_aiohttp import AIOHttpConnection as AIOHttpConnection
from ._async.transport import AsyncTransport as AsyncTransport
from ._async.client import AsyncElasticsearch as AsyncElasticsearch
except (ImportError, SyntaxError):
pass
-1
View File
@@ -32,7 +32,6 @@
import aiohttp
import aiohttp.client_exceptions as aiohttp_exceptions
# We do this because we don't explicitly require 'yarl'
# within our [async] extra any more.
# See AIOHttpConnection.request() for more information why.
+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):
+1
View File
@@ -16,6 +16,7 @@
# under the License.
import asyncio
from ..compat import * # noqa
# Hack supporting Python 3.6 asyncio which didn't have 'get_running_loop()'.
+3 -6
View File
@@ -20,11 +20,10 @@
# See the LICENSE file in the project root for more information
import asyncio
import logging
from .client import AsyncElasticsearch # noqa
from ..exceptions import TransportError
from ..compat import map
from ..exceptions import TransportError
from ..helpers.actions import (
_ActionChunker,
_process_bulk_chunk_error,
@@ -32,9 +31,7 @@ from ..helpers.actions import (
expand_action,
)
from ..helpers.errors import ScanError
import logging
from .client import AsyncElasticsearch # noqa
logger = logging.getLogger("elasticsearch.helpers")
+12 -11
View File
@@ -15,24 +15,25 @@
# specific language governing permissions and limitations
# under the License.
import logging
from typing import (
AsyncGenerator,
Optional,
Union,
Any,
AsyncGenerator,
AsyncIterable,
Callable,
Collection,
Dict,
Iterable,
List,
Mapping,
Optional,
Tuple,
TypeVar,
Iterable,
AsyncIterable,
List,
Dict,
Collection,
Callable,
Union,
)
import logging
from .client import AsyncElasticsearch
from ..serializer import Serializer
from .client import AsyncElasticsearch
logger: logging.Logger
+7 -8
View File
@@ -16,16 +16,14 @@
# under the License.
import asyncio
import ssl
import os
import urllib3 # type: ignore
import ssl
import warnings
from ._extra_imports import aiohttp_exceptions, aiohttp, yarl
from .compat import get_running_loop
from ..connection.base import (
Connection,
)
import urllib3 # type: ignore
from ..compat import urlencode
from ..connection.base import Connection
from ..exceptions import (
ConnectionError,
ConnectionTimeout,
@@ -33,7 +31,8 @@ from ..exceptions import (
SSLError,
)
from ..utils import _client_meta_version
from ._extra_imports import aiohttp, aiohttp_exceptions, yarl
from .compat import get_running_loop
# sentinel value for `verify_certs`.
# This is used to detect if a user is passing in a value
+3 -2
View File
@@ -15,9 +15,10 @@
# specific language governing permissions and limitations
# under the License.
from ._extra_imports import aiohttp # type: ignore
from typing import Optional, Mapping, MutableMapping, Collection, Union, Any, Tuple
from typing import Any, Collection, Mapping, MutableMapping, Optional, Tuple, Union
from ..connection import Connection
from ._extra_imports import aiohttp # type: ignore
class AsyncConnection(Connection):
async def perform_request( # type: ignore
+8 -9
View File
@@ -17,19 +17,18 @@
import asyncio
import logging
from itertools import chain
import sys
from itertools import chain
from ..exceptions import (
ConnectionError,
ConnectionTimeout,
SerializationError,
TransportError,
)
from ..transport import Transport
from .compat import get_running_loop
from .http_aiohttp import AIOHttpConnection
from ..transport import Transport
from ..exceptions import (
TransportError,
ConnectionTimeout,
ConnectionError,
SerializationError,
)
logger = logging.getLogger("elasticsearch")
+2 -12
View File
@@ -15,21 +15,11 @@
# specific language governing permissions and limitations
# under the License.
from typing import (
Callable,
Optional,
Union,
Collection,
Type,
Mapping,
Any,
Dict,
List,
)
from typing import Any, Callable, Collection, Dict, List, Mapping, Optional, Type, Union
from ..connection import Connection
from ..connection_pool import ConnectionPool
from ..serializer import Serializer, Deserializer
from ..serializer import Deserializer, Serializer
class AsyncTransport(object):
DEFAULT_CONNECTION_CLASS: Type[Connection]
+17 -12
View File
@@ -17,45 +17,45 @@
# under the License.
from __future__ import unicode_literals
import logging
from ..transport import Transport, 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 Elasticsearch(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)
@@ -1524,6 +1525,7 @@ class Elasticsearch(object):
"ignore_unavailable",
"lenient",
"max_concurrent_shard_requests",
"min_compatible_shard_node",
"pre_filter_shard_size",
"preference",
"q",
@@ -1604,6 +1606,9 @@ class Elasticsearch(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 Transport
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 Elasticsearch(object):
@@ -88,6 +89,7 @@ class Elasticsearch(object):
sql: SqlClient
ssl: SslClient
transform: TransformClient
text_structure: TextStructureClient
watcher: WatcherClient
def __init__(
self, hosts: Any = ..., transport_class: Type[Transport] = ..., **kwargs: Any
@@ -785,6 +787,7 @@ class Elasticsearch(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()
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()
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()
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):
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 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"
)
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):
+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 DanglingIndicesClient(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 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):

Some files were not shown because too many files have changed in this diff Show More