elasticsearch9 9.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. elasticsearch9/__init__.py +98 -0
  2. elasticsearch9/_async/__init__.py +16 -0
  3. elasticsearch9/_async/client/__init__.py +6531 -0
  4. elasticsearch9/_async/client/_base.py +430 -0
  5. elasticsearch9/_async/client/async_search.py +637 -0
  6. elasticsearch9/_async/client/autoscaling.py +252 -0
  7. elasticsearch9/_async/client/cat.py +2995 -0
  8. elasticsearch9/_async/client/ccr.py +1043 -0
  9. elasticsearch9/_async/client/cluster.py +1223 -0
  10. elasticsearch9/_async/client/connector.py +1978 -0
  11. elasticsearch9/_async/client/dangling_indices.py +192 -0
  12. elasticsearch9/_async/client/enrich.py +291 -0
  13. elasticsearch9/_async/client/eql.py +359 -0
  14. elasticsearch9/_async/client/esql.py +490 -0
  15. elasticsearch9/_async/client/features.py +130 -0
  16. elasticsearch9/_async/client/fleet.py +658 -0
  17. elasticsearch9/_async/client/graph.py +113 -0
  18. elasticsearch9/_async/client/ilm.py +668 -0
  19. elasticsearch9/_async/client/indices.py +5582 -0
  20. elasticsearch9/_async/client/inference.py +2247 -0
  21. elasticsearch9/_async/client/ingest.py +766 -0
  22. elasticsearch9/_async/client/license.py +400 -0
  23. elasticsearch9/_async/client/logstash.py +176 -0
  24. elasticsearch9/_async/client/migration.py +160 -0
  25. elasticsearch9/_async/client/ml.py +5835 -0
  26. elasticsearch9/_async/client/monitoring.py +100 -0
  27. elasticsearch9/_async/client/nodes.py +543 -0
  28. elasticsearch9/_async/client/query_rules.py +485 -0
  29. elasticsearch9/_async/client/rollup.py +616 -0
  30. elasticsearch9/_async/client/search_application.py +574 -0
  31. elasticsearch9/_async/client/searchable_snapshots.py +313 -0
  32. elasticsearch9/_async/client/security.py +4688 -0
  33. elasticsearch9/_async/client/shutdown.py +268 -0
  34. elasticsearch9/_async/client/simulate.py +145 -0
  35. elasticsearch9/_async/client/slm.py +559 -0
  36. elasticsearch9/_async/client/snapshot.py +1338 -0
  37. elasticsearch9/_async/client/sql.py +469 -0
  38. elasticsearch9/_async/client/ssl.py +76 -0
  39. elasticsearch9/_async/client/synonyms.py +413 -0
  40. elasticsearch9/_async/client/tasks.py +295 -0
  41. elasticsearch9/_async/client/text_structure.py +664 -0
  42. elasticsearch9/_async/client/transform.py +922 -0
  43. elasticsearch9/_async/client/utils.py +48 -0
  44. elasticsearch9/_async/client/watcher.py +894 -0
  45. elasticsearch9/_async/client/xpack.py +134 -0
  46. elasticsearch9/_async/helpers.py +596 -0
  47. elasticsearch9/_otel.py +110 -0
  48. elasticsearch9/_sync/__init__.py +16 -0
  49. elasticsearch9/_sync/client/__init__.py +6529 -0
  50. elasticsearch9/_sync/client/_base.py +430 -0
  51. elasticsearch9/_sync/client/async_search.py +637 -0
  52. elasticsearch9/_sync/client/autoscaling.py +252 -0
  53. elasticsearch9/_sync/client/cat.py +2995 -0
  54. elasticsearch9/_sync/client/ccr.py +1043 -0
  55. elasticsearch9/_sync/client/cluster.py +1223 -0
  56. elasticsearch9/_sync/client/connector.py +1978 -0
  57. elasticsearch9/_sync/client/dangling_indices.py +192 -0
  58. elasticsearch9/_sync/client/enrich.py +291 -0
  59. elasticsearch9/_sync/client/eql.py +359 -0
  60. elasticsearch9/_sync/client/esql.py +490 -0
  61. elasticsearch9/_sync/client/features.py +130 -0
  62. elasticsearch9/_sync/client/fleet.py +658 -0
  63. elasticsearch9/_sync/client/graph.py +113 -0
  64. elasticsearch9/_sync/client/ilm.py +668 -0
  65. elasticsearch9/_sync/client/indices.py +5582 -0
  66. elasticsearch9/_sync/client/inference.py +2247 -0
  67. elasticsearch9/_sync/client/ingest.py +766 -0
  68. elasticsearch9/_sync/client/license.py +400 -0
  69. elasticsearch9/_sync/client/logstash.py +176 -0
  70. elasticsearch9/_sync/client/migration.py +160 -0
  71. elasticsearch9/_sync/client/ml.py +5835 -0
  72. elasticsearch9/_sync/client/monitoring.py +100 -0
  73. elasticsearch9/_sync/client/nodes.py +543 -0
  74. elasticsearch9/_sync/client/query_rules.py +485 -0
  75. elasticsearch9/_sync/client/rollup.py +616 -0
  76. elasticsearch9/_sync/client/search_application.py +574 -0
  77. elasticsearch9/_sync/client/searchable_snapshots.py +313 -0
  78. elasticsearch9/_sync/client/security.py +4688 -0
  79. elasticsearch9/_sync/client/shutdown.py +268 -0
  80. elasticsearch9/_sync/client/simulate.py +145 -0
  81. elasticsearch9/_sync/client/slm.py +559 -0
  82. elasticsearch9/_sync/client/snapshot.py +1338 -0
  83. elasticsearch9/_sync/client/sql.py +469 -0
  84. elasticsearch9/_sync/client/ssl.py +76 -0
  85. elasticsearch9/_sync/client/synonyms.py +413 -0
  86. elasticsearch9/_sync/client/tasks.py +295 -0
  87. elasticsearch9/_sync/client/text_structure.py +664 -0
  88. elasticsearch9/_sync/client/transform.py +922 -0
  89. elasticsearch9/_sync/client/utils.py +475 -0
  90. elasticsearch9/_sync/client/watcher.py +894 -0
  91. elasticsearch9/_sync/client/xpack.py +134 -0
  92. elasticsearch9/_utils.py +34 -0
  93. elasticsearch9/_version.py +18 -0
  94. elasticsearch9/client.py +126 -0
  95. elasticsearch9/compat.py +79 -0
  96. elasticsearch9/dsl/__init__.py +203 -0
  97. elasticsearch9/dsl/_async/__init__.py +16 -0
  98. elasticsearch9/dsl/_async/document.py +522 -0
  99. elasticsearch9/dsl/_async/faceted_search.py +50 -0
  100. elasticsearch9/dsl/_async/index.py +639 -0
  101. elasticsearch9/dsl/_async/mapping.py +49 -0
  102. elasticsearch9/dsl/_async/search.py +237 -0
  103. elasticsearch9/dsl/_async/update_by_query.py +47 -0
  104. elasticsearch9/dsl/_sync/__init__.py +16 -0
  105. elasticsearch9/dsl/_sync/document.py +514 -0
  106. elasticsearch9/dsl/_sync/faceted_search.py +50 -0
  107. elasticsearch9/dsl/_sync/index.py +597 -0
  108. elasticsearch9/dsl/_sync/mapping.py +49 -0
  109. elasticsearch9/dsl/_sync/search.py +230 -0
  110. elasticsearch9/dsl/_sync/update_by_query.py +45 -0
  111. elasticsearch9/dsl/aggs.py +3734 -0
  112. elasticsearch9/dsl/analysis.py +341 -0
  113. elasticsearch9/dsl/async_connections.py +37 -0
  114. elasticsearch9/dsl/connections.py +142 -0
  115. elasticsearch9/dsl/document.py +20 -0
  116. elasticsearch9/dsl/document_base.py +444 -0
  117. elasticsearch9/dsl/exceptions.py +32 -0
  118. elasticsearch9/dsl/faceted_search.py +28 -0
  119. elasticsearch9/dsl/faceted_search_base.py +489 -0
  120. elasticsearch9/dsl/field.py +4392 -0
  121. elasticsearch9/dsl/function.py +180 -0
  122. elasticsearch9/dsl/index.py +23 -0
  123. elasticsearch9/dsl/index_base.py +178 -0
  124. elasticsearch9/dsl/mapping.py +19 -0
  125. elasticsearch9/dsl/mapping_base.py +219 -0
  126. elasticsearch9/dsl/query.py +2822 -0
  127. elasticsearch9/dsl/response/__init__.py +388 -0
  128. elasticsearch9/dsl/response/aggs.py +100 -0
  129. elasticsearch9/dsl/response/hit.py +53 -0
  130. elasticsearch9/dsl/search.py +20 -0
  131. elasticsearch9/dsl/search_base.py +1053 -0
  132. elasticsearch9/dsl/serializer.py +34 -0
  133. elasticsearch9/dsl/types.py +6453 -0
  134. elasticsearch9/dsl/update_by_query.py +19 -0
  135. elasticsearch9/dsl/update_by_query_base.py +149 -0
  136. elasticsearch9/dsl/utils.py +687 -0
  137. elasticsearch9/dsl/wrappers.py +144 -0
  138. elasticsearch9/exceptions.py +133 -0
  139. elasticsearch9/helpers/__init__.py +41 -0
  140. elasticsearch9/helpers/actions.py +875 -0
  141. elasticsearch9/helpers/errors.py +40 -0
  142. elasticsearch9/helpers/vectorstore/__init__.py +62 -0
  143. elasticsearch9/helpers/vectorstore/_async/__init__.py +16 -0
  144. elasticsearch9/helpers/vectorstore/_async/_utils.py +39 -0
  145. elasticsearch9/helpers/vectorstore/_async/embedding_service.py +89 -0
  146. elasticsearch9/helpers/vectorstore/_async/strategies.py +487 -0
  147. elasticsearch9/helpers/vectorstore/_async/vectorstore.py +421 -0
  148. elasticsearch9/helpers/vectorstore/_sync/__init__.py +16 -0
  149. elasticsearch9/helpers/vectorstore/_sync/_utils.py +39 -0
  150. elasticsearch9/helpers/vectorstore/_sync/embedding_service.py +89 -0
  151. elasticsearch9/helpers/vectorstore/_sync/strategies.py +487 -0
  152. elasticsearch9/helpers/vectorstore/_sync/vectorstore.py +421 -0
  153. elasticsearch9/helpers/vectorstore/_utils.py +116 -0
  154. elasticsearch9/py.typed +0 -0
  155. elasticsearch9/serializer.py +250 -0
  156. elasticsearch9-9.0.0.dist-info/METADATA +175 -0
  157. elasticsearch9-9.0.0.dist-info/RECORD +160 -0
  158. elasticsearch9-9.0.0.dist-info/WHEEL +4 -0
  159. elasticsearch9-9.0.0.dist-info/licenses/LICENSE +176 -0
  160. elasticsearch9-9.0.0.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,134 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import typing as t
19
+
20
+ from elastic_transport import ObjectApiResponse
21
+
22
+ from ._base import NamespacedClient
23
+ from .utils import _rewrite_parameters
24
+
25
+
26
+ class XPackClient(NamespacedClient):
27
+ def __getattr__(self, attr_name: str) -> t.Any:
28
+ return getattr(self.client, attr_name)
29
+
30
+ # AUTO-GENERATED-API-DEFINITIONS #
31
+
32
+ @_rewrite_parameters()
33
+ def info(
34
+ self,
35
+ *,
36
+ accept_enterprise: t.Optional[bool] = None,
37
+ categories: t.Optional[
38
+ t.Sequence[t.Union[str, t.Literal["build", "features", "license"]]]
39
+ ] = None,
40
+ error_trace: t.Optional[bool] = None,
41
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
42
+ human: t.Optional[bool] = None,
43
+ pretty: t.Optional[bool] = None,
44
+ ) -> ObjectApiResponse[t.Any]:
45
+ """
46
+ .. raw:: html
47
+
48
+ <p>Get information.
49
+ The information provided by the API includes:</p>
50
+ <ul>
51
+ <li>Build information including the build number and timestamp.</li>
52
+ <li>License information about the currently installed license.</li>
53
+ <li>Feature information for the features that are currently enabled and available under the current license.</li>
54
+ </ul>
55
+
56
+
57
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-info>`_
58
+
59
+ :param accept_enterprise: If this param is used it must be set to true
60
+ :param categories: A comma-separated list of the information categories to include
61
+ in the response. For example, `build,license,features`.
62
+ """
63
+ __path_parts: t.Dict[str, str] = {}
64
+ __path = "/_xpack"
65
+ __query: t.Dict[str, t.Any] = {}
66
+ if accept_enterprise is not None:
67
+ __query["accept_enterprise"] = accept_enterprise
68
+ if categories is not None:
69
+ __query["categories"] = categories
70
+ if error_trace is not None:
71
+ __query["error_trace"] = error_trace
72
+ if filter_path is not None:
73
+ __query["filter_path"] = filter_path
74
+ if human is not None:
75
+ __query["human"] = human
76
+ if pretty is not None:
77
+ __query["pretty"] = pretty
78
+ __headers = {"accept": "application/json"}
79
+ return self.perform_request( # type: ignore[return-value]
80
+ "GET",
81
+ __path,
82
+ params=__query,
83
+ headers=__headers,
84
+ endpoint_id="xpack.info",
85
+ path_parts=__path_parts,
86
+ )
87
+
88
+ @_rewrite_parameters()
89
+ def usage(
90
+ self,
91
+ *,
92
+ error_trace: t.Optional[bool] = None,
93
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
94
+ human: t.Optional[bool] = None,
95
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
96
+ pretty: t.Optional[bool] = None,
97
+ ) -> ObjectApiResponse[t.Any]:
98
+ """
99
+ .. raw:: html
100
+
101
+ <p>Get usage information.
102
+ Get information about the features that are currently enabled and available under the current license.
103
+ The API also provides some usage statistics.</p>
104
+
105
+
106
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-xpack>`_
107
+
108
+ :param master_timeout: The period to wait for a connection to the master node.
109
+ If no response is received before the timeout expires, the request fails
110
+ and returns an error. To indicate that the request should never timeout,
111
+ set it to `-1`.
112
+ """
113
+ __path_parts: t.Dict[str, str] = {}
114
+ __path = "/_xpack/usage"
115
+ __query: t.Dict[str, t.Any] = {}
116
+ if error_trace is not None:
117
+ __query["error_trace"] = error_trace
118
+ if filter_path is not None:
119
+ __query["filter_path"] = filter_path
120
+ if human is not None:
121
+ __query["human"] = human
122
+ if master_timeout is not None:
123
+ __query["master_timeout"] = master_timeout
124
+ if pretty is not None:
125
+ __query["pretty"] = pretty
126
+ __headers = {"accept": "application/json"}
127
+ return self.perform_request( # type: ignore[return-value]
128
+ "GET",
129
+ __path,
130
+ params=__query,
131
+ headers=__headers,
132
+ endpoint_id="xpack.usage",
133
+ path_parts=__path_parts,
134
+ )
@@ -0,0 +1,34 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import re
19
+ from typing import Any, Dict
20
+
21
+
22
+ def fixup_module_metadata(module_name: str, namespace: Dict[str, Any]) -> None:
23
+ # Yoinked from python-trio/outcome, thanks Nathaniel! License: MIT
24
+ def fix_one(obj: Any) -> None:
25
+ mod = getattr(obj, "__module__", None)
26
+ if mod is not None and re.match(r"^elasticsearch[0-9]*\.", mod) is not None:
27
+ obj.__module__ = module_name
28
+ if isinstance(obj, type):
29
+ for attr_value in obj.__dict__.values():
30
+ fix_one(attr_value)
31
+
32
+ for objname in namespace["__all__"]:
33
+ obj = namespace[objname]
34
+ fix_one(obj)
@@ -0,0 +1,18 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ __versionstr__ = "9.0.0"
@@ -0,0 +1,126 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import warnings
19
+
20
+ from ._sync.client import Elasticsearch as Elasticsearch # noqa: F401
21
+ from ._sync.client.async_search import ( # noqa: F401
22
+ AsyncSearchClient as AsyncSearchClient,
23
+ )
24
+ from ._sync.client.autoscaling import ( # noqa: F401
25
+ AutoscalingClient as AutoscalingClient,
26
+ )
27
+ from ._sync.client.cat import CatClient as CatClient # noqa: F401
28
+ from ._sync.client.ccr import CcrClient as CcrClient # noqa: F401
29
+ from ._sync.client.cluster import ClusterClient as ClusterClient # noqa: F401
30
+ from ._sync.client.connector import ConnectorClient as ConnectorClient # noqa: F401
31
+ from ._sync.client.dangling_indices import ( # noqa: F401
32
+ DanglingIndicesClient as DanglingIndicesClient,
33
+ )
34
+ from ._sync.client.enrich import EnrichClient as EnrichClient # noqa: F401
35
+ from ._sync.client.eql import EqlClient as EqlClient # noqa: F401
36
+ from ._sync.client.esql import EsqlClient as EsqlClient # noqa: F401
37
+ from ._sync.client.features import FeaturesClient as FeaturesClient # noqa: F401
38
+ from ._sync.client.fleet import FleetClient as FleetClient # noqa: F401
39
+ from ._sync.client.graph import GraphClient as GraphClient # noqa: F401
40
+ from ._sync.client.ilm import IlmClient as IlmClient # noqa: F401
41
+ from ._sync.client.indices import IndicesClient as IndicesClient # noqa: F401
42
+ from ._sync.client.inference import InferenceClient as InferenceClient # noqa: F401
43
+ from ._sync.client.ingest import IngestClient as IngestClient # noqa: F401
44
+ from ._sync.client.license import LicenseClient as LicenseClient # noqa: F401
45
+ from ._sync.client.logstash import LogstashClient as LogstashClient # noqa: F401
46
+ from ._sync.client.migration import MigrationClient as MigrationClient # noqa: F401
47
+ from ._sync.client.ml import MlClient as MlClient # noqa: F401
48
+ from ._sync.client.monitoring import MonitoringClient as MonitoringClient # noqa: F401
49
+ from ._sync.client.nodes import NodesClient as NodesClient # noqa: F401
50
+ from ._sync.client.query_rules import QueryRulesClient as QueryRulesClient # noqa: F401
51
+ from ._sync.client.rollup import RollupClient as RollupClient # noqa: F401
52
+ from ._sync.client.search_application import ( # noqa: F401
53
+ SearchApplicationClient as SearchApplicationClient,
54
+ )
55
+ from ._sync.client.searchable_snapshots import ( # noqa: F401
56
+ SearchableSnapshotsClient as SearchableSnapshotsClient,
57
+ )
58
+ from ._sync.client.security import SecurityClient as SecurityClient # noqa: F401
59
+ from ._sync.client.shutdown import ShutdownClient as ShutdownClient # noqa: F401
60
+ from ._sync.client.simulate import SimulateClient as SimulateClient # noqa: F401
61
+ from ._sync.client.slm import SlmClient as SlmClient # noqa: F401
62
+ from ._sync.client.snapshot import SnapshotClient as SnapshotClient # noqa: F401
63
+ from ._sync.client.sql import SqlClient as SqlClient # noqa: F401
64
+ from ._sync.client.ssl import SslClient as SslClient # noqa: F401
65
+ from ._sync.client.synonyms import SynonymsClient as SynonymsClient # noqa: F401
66
+ from ._sync.client.tasks import TasksClient as TasksClient # noqa: F401
67
+ from ._sync.client.text_structure import ( # noqa: F401
68
+ TextStructureClient as TextStructureClient,
69
+ )
70
+ from ._sync.client.transform import TransformClient as TransformClient # noqa: F401
71
+ from ._sync.client.watcher import WatcherClient as WatcherClient # noqa: F401
72
+ from ._sync.client.xpack import XPackClient as XPackClient # noqa: F401
73
+ from ._utils import fixup_module_metadata
74
+
75
+ # This file exists for backwards compatibility.
76
+ # We can't remove it as we use it for the Sphinx docs which show the full page, and we'd
77
+ # rather show `elasticsearch.client.FooClient` than `elasticsearch._sync.client.FooClient`.
78
+ warnings.warn(
79
+ "Importing from the 'elasticsearch.client' module is deprecated. "
80
+ "Instead use 'elasticsearch' module for importing the client.",
81
+ category=DeprecationWarning,
82
+ stacklevel=2,
83
+ )
84
+
85
+ __all__ = [
86
+ "AsyncSearchClient",
87
+ "AutoscalingClient",
88
+ "CatClient",
89
+ "CcrClient",
90
+ "ClusterClient",
91
+ "ConnectorClient",
92
+ "DanglingIndicesClient",
93
+ "Elasticsearch",
94
+ "EnrichClient",
95
+ "EqlClient",
96
+ "FeaturesClient",
97
+ "FleetClient",
98
+ "GraphClient",
99
+ "IlmClient",
100
+ "IndicesClient",
101
+ "IngestClient",
102
+ "LicenseClient",
103
+ "LogstashClient",
104
+ "MigrationClient",
105
+ "MlClient",
106
+ "MonitoringClient",
107
+ "NodesClient",
108
+ "RollupClient",
109
+ "SearchApplicationClient",
110
+ "SearchableSnapshotsClient",
111
+ "SecurityClient",
112
+ "ShutdownClient",
113
+ "SimulateClient",
114
+ "SlmClient",
115
+ "SnapshotClient",
116
+ "SqlClient",
117
+ "SslClient",
118
+ "TasksClient",
119
+ "TextStructureClient",
120
+ "TransformClient",
121
+ "WatcherClient",
122
+ "XPackClient",
123
+ ]
124
+
125
+ fixup_module_metadata(__name__, globals())
126
+ del fixup_module_metadata
@@ -0,0 +1,79 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import inspect
19
+ import sys
20
+ from pathlib import Path
21
+ from typing import Tuple, Type, Union
22
+
23
+ string_types: Tuple[Type[str], Type[bytes]] = (str, bytes)
24
+
25
+
26
+ def to_str(x: Union[str, bytes], encoding: str = "ascii") -> str:
27
+ if not isinstance(x, str):
28
+ return x.decode(encoding)
29
+ return x
30
+
31
+
32
+ def to_bytes(x: Union[str, bytes], encoding: str = "ascii") -> bytes:
33
+ if not isinstance(x, bytes):
34
+ return x.encode(encoding)
35
+ return x
36
+
37
+
38
+ def warn_stacklevel() -> int:
39
+ """Dynamically determine warning stacklevel for warnings based on the call stack"""
40
+ try:
41
+ # Grab the root module from the current module '__name__'
42
+ module_name = __name__.partition(".")[0]
43
+ module_path = Path(sys.modules[module_name].__file__) # type: ignore[arg-type]
44
+
45
+ # If the module is a folder we're looking at
46
+ # subdirectories, otherwise we're looking for
47
+ # an exact match.
48
+ module_is_folder = module_path.name == "__init__.py"
49
+ if module_is_folder:
50
+ module_path = module_path.parent
51
+
52
+ # Look through frames until we find a file that
53
+ # isn't a part of our module, then return that stacklevel.
54
+ for level, frame in enumerate(inspect.stack()):
55
+ # Garbage collecting frames
56
+ frame_filename = Path(frame.filename)
57
+ del frame
58
+
59
+ if (
60
+ # If the module is a folder we look at subdirectory
61
+ module_is_folder
62
+ and module_path not in frame_filename.parents
63
+ ) or (
64
+ # Otherwise we're looking for an exact match.
65
+ not module_is_folder
66
+ and module_path != frame_filename
67
+ ):
68
+ return level
69
+ except KeyError:
70
+ pass
71
+ return 0
72
+
73
+
74
+ __all__ = [
75
+ "string_types",
76
+ "to_str",
77
+ "to_bytes",
78
+ "warn_stacklevel",
79
+ ]
@@ -0,0 +1,203 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from . import async_connections, connections
19
+ from .aggs import A, Agg
20
+ from .analysis import analyzer, char_filter, normalizer, token_filter, tokenizer
21
+ from .document import AsyncDocument, Document
22
+ from .document_base import InnerDoc, M, MetaField, mapped_field
23
+ from .exceptions import (
24
+ ElasticsearchDslException,
25
+ IllegalOperation,
26
+ UnknownDslObject,
27
+ ValidationException,
28
+ )
29
+ from .faceted_search import (
30
+ AsyncFacetedSearch,
31
+ DateHistogramFacet,
32
+ Facet,
33
+ FacetedResponse,
34
+ FacetedSearch,
35
+ HistogramFacet,
36
+ NestedFacet,
37
+ RangeFacet,
38
+ TermsFacet,
39
+ )
40
+ from .field import (
41
+ Binary,
42
+ Boolean,
43
+ Byte,
44
+ Completion,
45
+ ConstantKeyword,
46
+ CustomField,
47
+ Date,
48
+ DateRange,
49
+ DenseVector,
50
+ Double,
51
+ DoubleRange,
52
+ Field,
53
+ Float,
54
+ FloatRange,
55
+ GeoPoint,
56
+ GeoShape,
57
+ HalfFloat,
58
+ Integer,
59
+ IntegerRange,
60
+ Ip,
61
+ IpRange,
62
+ Join,
63
+ Keyword,
64
+ Long,
65
+ LongRange,
66
+ Murmur3,
67
+ Nested,
68
+ Object,
69
+ Percolator,
70
+ Point,
71
+ RangeField,
72
+ RankFeature,
73
+ RankFeatures,
74
+ ScaledFloat,
75
+ SearchAsYouType,
76
+ Shape,
77
+ Short,
78
+ SparseVector,
79
+ Text,
80
+ TokenCount,
81
+ construct_field,
82
+ )
83
+ from .function import SF
84
+ from .index import (
85
+ AsyncComposableIndexTemplate,
86
+ AsyncIndex,
87
+ AsyncIndexTemplate,
88
+ ComposableIndexTemplate,
89
+ Index,
90
+ IndexTemplate,
91
+ )
92
+ from .mapping import AsyncMapping, Mapping
93
+ from .query import Q, Query
94
+ from .response import AggResponse, Response, UpdateByQueryResponse
95
+ from .search import (
96
+ AsyncEmptySearch,
97
+ AsyncMultiSearch,
98
+ AsyncSearch,
99
+ EmptySearch,
100
+ MultiSearch,
101
+ Search,
102
+ )
103
+ from .update_by_query import AsyncUpdateByQuery, UpdateByQuery
104
+ from .utils import AttrDict, AttrList, DslBase
105
+ from .wrappers import Range
106
+
107
+ __all__ = [
108
+ "A",
109
+ "Agg",
110
+ "AggResponse",
111
+ "AsyncComposableIndexTemplate",
112
+ "AsyncDocument",
113
+ "AsyncEmptySearch",
114
+ "AsyncFacetedSearch",
115
+ "AsyncIndex",
116
+ "AsyncIndexTemplate",
117
+ "AsyncMapping",
118
+ "AsyncMultiSearch",
119
+ "AsyncSearch",
120
+ "AsyncUpdateByQuery",
121
+ "AttrDict",
122
+ "AttrList",
123
+ "Binary",
124
+ "Boolean",
125
+ "Byte",
126
+ "Completion",
127
+ "ComposableIndexTemplate",
128
+ "ConstantKeyword",
129
+ "CustomField",
130
+ "Date",
131
+ "DateHistogramFacet",
132
+ "DateRange",
133
+ "DenseVector",
134
+ "Document",
135
+ "Double",
136
+ "DoubleRange",
137
+ "DslBase",
138
+ "ElasticsearchDslException",
139
+ "EmptySearch",
140
+ "Facet",
141
+ "FacetedResponse",
142
+ "FacetedSearch",
143
+ "Field",
144
+ "Float",
145
+ "FloatRange",
146
+ "GeoPoint",
147
+ "GeoShape",
148
+ "HalfFloat",
149
+ "HistogramFacet",
150
+ "IllegalOperation",
151
+ "Index",
152
+ "IndexTemplate",
153
+ "InnerDoc",
154
+ "Integer",
155
+ "IntegerRange",
156
+ "Ip",
157
+ "IpRange",
158
+ "Join",
159
+ "Keyword",
160
+ "Long",
161
+ "LongRange",
162
+ "M",
163
+ "Mapping",
164
+ "MetaField",
165
+ "MultiSearch",
166
+ "Murmur3",
167
+ "Nested",
168
+ "NestedFacet",
169
+ "Object",
170
+ "Percolator",
171
+ "Point",
172
+ "Q",
173
+ "Query",
174
+ "Range",
175
+ "RangeFacet",
176
+ "RangeField",
177
+ "RankFeature",
178
+ "RankFeatures",
179
+ "Response",
180
+ "SF",
181
+ "ScaledFloat",
182
+ "Search",
183
+ "SearchAsYouType",
184
+ "Shape",
185
+ "Short",
186
+ "SparseVector",
187
+ "TermsFacet",
188
+ "Text",
189
+ "TokenCount",
190
+ "UnknownDslObject",
191
+ "UpdateByQuery",
192
+ "UpdateByQueryResponse",
193
+ "ValidationException",
194
+ "analyzer",
195
+ "async_connections",
196
+ "char_filter",
197
+ "connections",
198
+ "construct_field",
199
+ "mapped_field",
200
+ "normalizer",
201
+ "token_filter",
202
+ "tokenizer",
203
+ ]
@@ -0,0 +1,16 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.