Remove xpack api code

Signed-off-by: Rushi Agrawal <[email protected]>
This commit is contained in:
Rushi Agrawal
2021-08-06 12:25:34 +05:30
parent 200d3c584f
commit 5104ad9aee
17 changed files with 8 additions and 1665 deletions
-405
View File
@@ -1,405 +0,0 @@
[[release-notes]]
== Release notes
* <<rn-7-13-4>>
* <<rn-7-13-3>>
* <<rn-7-13-2>>
* <<rn-7-13-1>>
* <<rn-7-13-0>>
* <<rn-7-12-1>>
* <<rn-7-12-0>>
* <<rn-7-11-0>>
* <<rn-7-10-1>>
* <<rn-7-10-0>>
* <<rn-7-9-1>>
* <<rn-7-9-0>>
* <<rn-7-8-1>>
* <<rn-7-8-0>>
* <<rn-7-7-1>>
* <<rn-7-7-0>>
* <<rn-7-6-0>>
* <<rn-7-5-1>>
* <<rn-7-1-0>>
* <<rn-7-0-5>>
* <<rn-7-0-4>>
* <<rn-7-0-3>>
* <<rn-7-0-2>>
* <<rn-7-0-1>>
* <<rn-7-0-0>>
[discrete]
[[rn-7-13-4]]
=== 7.13.4 (2021-07-20)
* Client is compatible with Elasticsearch 7.13.4
[discrete]
[[rn-7-13-3]]
=== 7.13.3 (2021-07-07)
* `NameError` would be raised on Python 2.7 and 3.4 when a connection error would have otherwise been raised.
[discrete]
[[rn-7-13-2]]
=== 7.13.2 (2021-06-21)
* Fixed `Transport.perform_request()` to properly reraise `RecursionError`
* Fixed `AIOHttpConnection` to no longer send `Accept-Encoding: gzip, deflate` when `http_compress=None`.
Instead now sends no `Accept-Encoding` header in the default case
[discrete]
==== Snapshot
* Added the `snapshot.repository_analyze` API
[discrete]
[[rn-7-13-1]]
=== 7.13.1 (2021-06-02)
* Client is compatible with Elasticsearch 7.13.1
[discrete]
[[rn-7-13-0]]
=== 7.13.0 (2021-05-25)
* Added support for compatibility header for Elasticsearch. If the environment variable
`ELASTIC_CLIENT_APIVERSIONING=1` is set the client will send the headers Accept and
Content-Type with the following value: `application/vnd.elasticsearch+json;compatible-with=7`.
[discrete]
==== Cat
* Added the `include_unloaded_segments` parameter to the `cat.nodes` API
* Added the `features.reset_features` **experimental** API
* Added the `fleet.global_checkpoints` **expiremental** API
* Added the `ingest.geo_ip_stats` API
[discrete]
==== Machine Learning
* Added the `ml.delete_trained_model_alias` API
* Added the `ml.preview_data_frame_analytics` API
* Added the `ml.put_trained_model_alias` API
* Changed the `ml.delete_data_frame_analytics`, `ml.delete_trained_model`, `ml.explain_data_frame_analytics`,
`ml.get_data_fram_analytics`, `ml.get_data_frame_analytics_stats`, `ml.get_trained_models`,
`ml.get_trained_models_stats`, `ml.put_trained_model`, `ml.start_data_frame_analytics`,
`ml.stop_data_frame_analytics`, `ml.update_data_frame_analytics` APIs from **beta** to **stable**.
[discrete]
==== Nodes
* Added `include_unloaded_segments` parameter to `node.stats` API
[discrete]
==== Searchable Snapshots
* Added the `searchable_snapshots.cache_stats` **experimental** API
[discrete]
==== Security
* Added the `security.clear_cached_service_tokens` **beta** API
* Added the `security.create_service_token` **beta** API
* Added the `security.delete_service_token` **beta** API
* Added the `security.get_service_accounts` **beta** API
* Added the `security.get_service_credentials` **beta** API
[discrete]
==== Shutdown
* Added the `shutdown.delete_node` **experiemental** API
* Added the `shutdown.get_node` **experimental** API
* Added the `shutdown.put_node` **experimental** API
[discrete]
==== Snapshots
* Added the `index_details` parameter to `snapshot.get` API
[discrete]
==== Text Structure
* Changed the `text_structure.find_structure` API from **experimental** to **stable**
[discrete]
[[rn-7-12-1]]
=== 7.12.1 (2021-04-27)
[discrete]
==== Text Structure
* Changed the `text_structure.find_text_structure` API from **experimental** to **stable**
[discrete]
[[rn-7-12-0]]
=== 7.12.0 (2021-03-23)
[discrete]
==== Autoscaling
* Changed `autoscaling.delete_autoscaling_policy`, `autoscaling.get_autoscaling_policy`,
and `autoscaling.put_autoscaling_policy` APIs from **experimental** to **stable**
[discrete]
==== EQL
* Added `eql.get_status` API
[discrete]
==== Logash
* Added `logstash.delete_pipeline`, `logstash.get_pipeline`, and `logstash.put_pipeline` APIs
[discrete]
==== Machine Learning
* Removed the **experimental** `ml.find_text_structure` API
[discrete]
==== Searchable Snapshots
* Added `storage` parameter to the `searchable_snapshots.mount` API
* Added `level` parameter to the `searchable_snapshots.stats` API
[discrete]
==== Search
* Added the `min_compatible_shard_node` parameter to `search()`
[discrete]
==== Text Structure
* Added **experimental** `text_structure.find_text_structure` API
[discrete]
[[rn-7-11-0]]
=== 7.11.0 (2021-02-10)
* Added support for 7.11 APIs.
* Added the `X-Elastic-Client-Meta` HTTP header and the `meta_header` parameter
for controlling the header
(https://github.com/elastic/elasticsearch-py/pull/1473[#1473]).
* Added `ElasticsearchWarning` which is raised when the `Warning` HTTP header
is returned from {es}. `ElasticsearchDeprecationWarning` is now an alias for
this warning type
(https://github.com/elastic/elasticsearch-py/pull/1495[#1495]).
[discrete]
[[rn-7-10-1]]
=== 7.10.1 (2020-12-09)
* Fixed issue where the Scan helper would fail if a `scroll` response returned
without a value for `_shards.skipped`
(https://github.com/elastic/elasticsearch-py/pull/1451[#1451]).
* Fixed handling of IPv6 hosts with a port in the computed `Connection.host`
property (https://github.com/elastic/elasticsearch-py/pull/1460[#1460]).
* Fixed documented task management API stability, should have been as
"experimental" (https://github.com/elastic/elasticsearch-py/pull/1471[#1471]).
* Changed deprecated `collections.Mapping` in favor of
`collections.abc.Mapping` for Python 3.9
(https://github.com/elastic/elasticsearch-py/pull/1443[#1443]).
[discrete]
[[rn-7-10-0]]
=== 7.10.0 (2020-11-11)
* Added support for {es} 7.10 APIs.
* Added basic type stubs for static type checking and IDE auto-complete of API
parameters (https://github.com/elastic/elasticsearch-py/pull/1297[#1297],
https://github.com/elastic/elasticsearch-py/pull/1406[#1406]).
* Added support for
https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html[`Optimistic Concurrency Control options`]
(`_if_seq_no`/`_if_primary_term`) to bulk helpers
(https://github.com/elastic/elasticsearch-py/pull/1387[#1387]).
* Added support for passing `_source` with `"_op_type": "update"`
bulk helpers (https://github.com/elastic/elasticsearch-py/pull/1387[#1387]).
* Fixed bug where `Connection.log_request_failure()` call would receive the
compressed HTTP body rather than uncompressed when an error is raised for
`RequestsHttpConnection`
(https://github.com/elastic/elasticsearch-py/pull/1394[#1394]).
* Fix a typo in AsyncTransport where `sniff_timeout` was used instead of
`sniffer_timeout`
(https://github.com/elastic/elasticsearch-py/pull/1431[#1431]).
* Removed explicit `yarl` dependency from `[async]` extra to avoid issue where
pip would override `aiohttp`'s pin of `yarl`. This is not a problem if you
install with `--use-feature=2020-resolver`. Users should see no changes
(https://github.com/elastic/elasticsearch-py/pull/1401[#1401]).
[discrete]
[[rn-7-9-1]]
=== 7.9.1 (2020-08-19)
* Fixed the import of async helpers which were not available in 7.9.0
(https://github.com/elastic/elasticsearch-py/pull/1353[#1353]).
* Added support for `url_prefix` when using `AIOHttpConnection`
(https://github.com/elastic/elasticsearch-py/pull/1357[#1357]).
[discrete]
[[rn-7-9-0]]
=== 7.9.0 (2020-08-18)
* Added support for ES 7.9 APIs.
* Fixed retries to not raise an error when `sniff_on_connection_error=True`
and a `TransportError` is raised during the sniff step. Instead the
retry will continue or the error that triggered the retry will be raised
(https://github.com/elastic/elasticsearch-py/pull/1279[#1279],
https://github.com/elastic/elasticsearch-py/pull/1326[#1326]).
[discrete]
[[rn-7-8-1]]
=== 7.8.1 (2020-07-30)
* Added the `accept_enterprise` parameter to `xpack.info` API
(https://github.com/elastic/elasticsearch-py/pull/1337[#1337]).
[discrete]
[[rn-7-8-0]]
=== 7.8.0 (2020-06-18)
* Added support for ES 7.8 APIs.
* Added support for async/await with asyncio via `AsyncElasticsearch`. See
https://elasticsearch-py.readthedocs.io/en/master/async.html[documentation] on
`using Asyncio with {es}
(https://github.com/elastic/elasticsearch-py/pull/1232[#1232],
https://github.com/elastic/elasticsearch-py/pull/1235[#1235],
https://github.com/elastic/elasticsearch-py/pull/1236[#1236]).
* Added async helpers `async_bulk`, `async_streaming_bulk`, `async_scan`, and
`async_reindex`
(https://github.com/elastic/elasticsearch-py/pull/1260[#1260]).
* Updated `exists_source` API to use non-deprecated {es} API routes when
`doc_type` is not specified to suppress deprecation warnings
(https://github.com/elastic/elasticsearch-py/pull/1272[#1272]).
[discrete]
[[rn-7-7-1]]
=== 7.7.1 (2020-05-26)
* Updated `create`, `update`, `explain`, `get_source`, and `termvectors` APIs to
use non-deprecated {es} API routes when `doc_type` is not specified to
suppress deprecation warnings
(https://github.com/elastic/elasticsearch-py/pull/1253[#1253]).
[discrete]
[[rn-7-7-0]]
=== 7.7.0 (2020-05-13)
* Added support for ES 7.7 APIs
(https://github.com/elastic/elasticsearch-py/pull/1182[#1182]).
* Added `ElasticsearchDeprecationWarning` which is raised when a `Warning` HTTP
header is sent by {es}
(https://github.com/elastic/elasticsearch-py/pull/1179[#1179]).
* Added support for serializing `numpy` and `pandas` data types to
`JSONSerializer`
(https://github.com/elastic/elasticsearch-py/pull/1180[#1180]).
* Added `certifi` as a dependency so HTTPS connections work automatically.
* Fixed duplicated parameters in some API docstrings
(https://github.com/elastic/elasticsearch-py/pull/1169[#1169], thanks to
https://github.com/mortenhauberg[Morten Hauberg]).
[discrete]
[[rn-7-6-0]]
=== 7.6.0 (2020-03-19)
* Added support for ES 7.6 APIs.
* Added support for
https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#_identifying_running_tasks[`X-Opaque-Id`]
to identify long-running tasks.
* Added support for HTTP compression to `RequestsHttpConnection`.
* Updated default setting of `http_compress` when using `cloud_id` to `True`.
* Updated default setting of `sniffing` when using `cloud_id` to `False`.
* Updated default port to `443` if `cloud_id` and no other port is defined on
the client or within `cloud_id`.
* Updated `GET` HTTP requests that contain a body to `POST` where the API allows
this to fix proxies rejecting these requests.
* Fix regression of `client.cluster.state()` where the default `metric` should
be set to `"_all"` if an index is given
(https://github.com/elastic/elasticsearch-py/pull/1143[#1143]).
* Fix regression of `client.tasks.get()` without a `task_id` having similar
functionality to `client.tasks.list()` This will be removed in `v8.0` of
`elasticsearch-py`
(https://github.com/elastic/elasticsearch-py/pull/1157[#1157]).
[discrete]
[[rn-7-5-1]]
=== 7.5.1 (2020-01-19)
* All API is now auto generated.
* Deprecated the `.xpack` namespace.
* Update client to support ES 7.5 APIs.
[discrete]
[[rn-7-1-0]]
=== 7.1.0 (2019-11-14)
* Fix sniffing with `http.publish_host`.
* Fix `request_timeout` for `indices` APIs.
* Allow access to `x-pack` features without `xpack` namespace.
* Fix mark dead.
[discrete]
[[rn-7-0-5]]
=== 7.0.5 (2019-10-01)
* Fix `verify_certs=False`.
[discrete]
[[rn-7-0-4]]
=== 7.0.4 (2019-08-22)
* Fix wheel distribution.
[discrete]
[[rn-7-0-3]]
=== 7.0.3 (2019-08-21)
* Remove sleep in retries.
* Pass `scroll_id` through body in `scroll`.
* Add `user-agent`.
[discrete]
[[rn-7-0-2]]
=== 7.0.2 (2019-05-29)
* Add connection parameter for Elastic Cloud cloud_id.
* ML client uses client object for _bulk_body requests.
[discrete]
[[rn-7-0-1]]
=== 7.0.1 (2019-05-19)
* Use black to format the code.
* Update the test matrix to only use current pythons and 7.x ES.
* Blocking pool must fit thread_count.
* Update client to support missing ES 7 API's and query params.
[discrete]
[[rn-7-0-0]]
=== 7.0.0 (2019-04-11)
* Removed deprecated option `update_all_types`.
* Using insecure SSL configuration (`verify_cert=False`) raises a warning,
this can be not showed with `ssl_show_warn=False`.
* Add support for 7.x APIs in {es} both xpack and oss flavors.
-6
View File
@@ -300,9 +300,3 @@ Watcher
.. autoclass:: WatcherClient .. autoclass:: WatcherClient
:members: :members:
X-Pack
------
.. autoclass:: XPackClient
:members:
-6
View File
@@ -44,7 +44,6 @@ from .ml import MlClient
from .monitoring import MonitoringClient from .monitoring import MonitoringClient
from .nodes import NodesClient from .nodes import NodesClient
from .remote import RemoteClient from .remote import RemoteClient
from .rollup import RollupClient
from .searchable_snapshots import SearchableSnapshotsClient from .searchable_snapshots import SearchableSnapshotsClient
from .security import SecurityClient from .security import SecurityClient
from .shutdown import ShutdownClient from .shutdown import ShutdownClient
@@ -58,9 +57,6 @@ from .transform import TransformClient
from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params
from .watcher import WatcherClient from .watcher import WatcherClient
# xpack APIs
from .xpack import XPackClient
logger = logging.getLogger("elasticsearch") logger = logging.getLogger("elasticsearch")
@@ -219,7 +215,6 @@ class AsyncElasticsearch(object):
self.snapshot = SnapshotClient(self) self.snapshot = SnapshotClient(self)
self.tasks = TasksClient(self) self.tasks = TasksClient(self)
self.xpack = XPackClient(self)
self.ccr = CcrClient(self) self.ccr = CcrClient(self)
self.data_frame = Data_FrameClient(self) self.data_frame = Data_FrameClient(self)
self.deprecation = DeprecationClient(self) self.deprecation = DeprecationClient(self)
@@ -234,7 +229,6 @@ class AsyncElasticsearch(object):
self.migration = MigrationClient(self) self.migration = MigrationClient(self)
self.ml = MlClient(self) self.ml = MlClient(self)
self.monitoring = MonitoringClient(self) self.monitoring = MonitoringClient(self)
self.rollup = RollupClient(self)
self.searchable_snapshots = SearchableSnapshotsClient(self) self.searchable_snapshots = SearchableSnapshotsClient(self)
self.security = SecurityClient(self) self.security = SecurityClient(self)
self.slm = SlmClient(self) self.slm = SlmClient(self)
-6
View File
@@ -42,7 +42,6 @@ from .ml import MlClient
from .monitoring import MonitoringClient from .monitoring import MonitoringClient
from .nodes import NodesClient from .nodes import NodesClient
from .remote import RemoteClient from .remote import RemoteClient
from .rollup import RollupClient
from .searchable_snapshots import SearchableSnapshotsClient from .searchable_snapshots import SearchableSnapshotsClient
from .security import SecurityClient from .security import SecurityClient
from .shutdown import ShutdownClient from .shutdown import ShutdownClient
@@ -55,9 +54,6 @@ from .text_structure import TextStructureClient
from .transform import TransformClient from .transform import TransformClient
from .watcher import WatcherClient from .watcher import WatcherClient
# xpack APIs
from .xpack import XPackClient
logger: logging.Logger logger: logging.Logger
class AsyncElasticsearch(object): class AsyncElasticsearch(object):
@@ -75,7 +71,6 @@ class AsyncElasticsearch(object):
snapshot: SnapshotClient snapshot: SnapshotClient
tasks: TasksClient tasks: TasksClient
xpack: XPackClient
ccr: CcrClient ccr: CcrClient
dangling_indices: DanglingIndicesClient dangling_indices: DanglingIndicesClient
enrich: EnrichClient enrich: EnrichClient
@@ -87,7 +82,6 @@ class AsyncElasticsearch(object):
migration: MigrationClient migration: MigrationClient
ml: MlClient ml: MlClient
monitoring: MonitoringClient monitoring: MonitoringClient
rollup: RollupClient
searchable_snapshots: SearchableSnapshotsClient searchable_snapshots: SearchableSnapshotsClient
security: SecurityClient security: SecurityClient
shutdown: ShutdownClient shutdown: ShutdownClient
-246
View File
@@ -1,246 +0,0 @@
# 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, _make_path, query_params
class RollupClient(NamespacedClient):
@query_params()
async def delete_job(self, id, params=None, headers=None):
"""
Deletes an existing rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-delete-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to delete
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"DELETE", _make_path("_rollup", "job", id), params=params, headers=headers
)
@query_params()
async def get_jobs(self, id=None, params=None, headers=None):
"""
Retrieves the configuration, stats, and status of rollup jobs.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job(s) to fetch. Accepts glob patterns,
or left blank for all jobs
"""
return await self.transport.perform_request(
"GET", _make_path("_rollup", "job", id), params=params, headers=headers
)
@query_params()
async def get_rollup_caps(self, id=None, params=None, headers=None):
"""
Returns the capabilities of any rollup jobs that have been configured for a
specific index or index pattern.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-rollup-caps.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the index to check rollup capabilities on, or
left blank for all jobs
"""
return await self.transport.perform_request(
"GET", _make_path("_rollup", "data", id), params=params, headers=headers
)
@query_params()
async def get_rollup_index_caps(self, index, params=None, headers=None):
"""
Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the
index where rollup data is stored).
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-rollup-index-caps.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg index: The rollup index or index pattern to obtain rollup
capabilities from.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"GET", _make_path(index, "_rollup", "data"), params=params, headers=headers
)
@query_params()
async def put_job(self, id, body, params=None, headers=None):
"""
Creates a rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-put-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to create
:arg body: The job configuration
"""
for param in (id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path("_rollup", "job", id),
params=params,
headers=headers,
body=body,
)
@query_params("rest_total_hits_as_int", "typed_keys")
async def rollup_search(
self, index, body, doc_type=None, params=None, headers=None
):
"""
Enables searching rolled-up data using the standard query DSL.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-search.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg index: The indices or index-pattern(s) (containing rollup
or regular data) that should be searched
:arg body: The search request body
:arg doc_type: The doc type inside the index
:arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response
:arg typed_keys: Specify whether aggregation and suggester names
should be prefixed by their respective types in the response
"""
for param in (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, doc_type, "_rollup_search"),
params=params,
headers=headers,
body=body,
)
@query_params()
async def start_job(self, id, params=None, headers=None):
"""
Starts an existing, stopped rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-start-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to start
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"POST",
_make_path("_rollup", "job", id, "_start"),
params=params,
headers=headers,
)
@query_params("timeout", "wait_for_completion")
async def stop_job(self, id, params=None, headers=None):
"""
Stops an existing, started rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-stop-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to stop
:arg timeout: Block for (at maximum) the specified duration
while waiting for the job to stop. Defaults to 30s.
:arg wait_for_completion: True if the API should block until the
job has fully stopped, false if should be executed async. Defaults to
false.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"POST",
_make_path("_rollup", "job", id, "_stop"),
params=params,
headers=headers,
)
@query_params()
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/xpack-rollup.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
: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, 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", rollup_index),
params=params,
headers=headers,
body=body,
)
-184
View File
@@ -1,184 +0,0 @@
# 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, Tuple, Union
from .utils import NamespacedClient
class RollupClient(NamespacedClient):
async def delete_job(
self,
id: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def get_jobs(
self,
*,
id: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def get_rollup_caps(
self,
*,
id: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def get_rollup_index_caps(
self,
index: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def put_job(
self,
id: Any,
*,
body: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def rollup_search(
self,
index: Any,
*,
body: Any,
doc_type: Optional[Any] = ...,
rest_total_hits_as_int: Optional[Any] = ...,
typed_keys: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def start_job(
self,
id: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def stop_job(
self,
id: Any,
*,
timeout: Optional[Any] = ...,
wait_for_completion: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def rollup(
self,
index: Any,
rollup_index: Any,
*,
body: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
-53
View File
@@ -1,53 +0,0 @@
# 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 NamespacedClient, query_params
class XPackClient(NamespacedClient):
def __getattr__(self, attr_name):
return getattr(self.client, attr_name)
# AUTO-GENERATED-API-DEFINITIONS #
@query_params("accept_enterprise", "categories")
async def info(self, params=None, headers=None):
"""
Retrieves information about the installed X-Pack features.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/info-api.html>`_
:arg accept_enterprise: If an enterprise license is installed,
return the type and mode as 'enterprise' (default: false)
:arg categories: Comma-separated list of info categories. Can be
any of: build, license, features
"""
return await self.transport.perform_request(
"GET", "/_xpack", params=params, headers=headers
)
@query_params("master_timeout")
async def usage(self, params=None, headers=None):
"""
Retrieves usage information about the installed X-Pack features.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/usage-api.html>`_
:arg master_timeout: Specify timeout for watch write operation
"""
return await self.transport.perform_request(
"GET", "/_xpack/usage", params=params, headers=headers
)
-60
View File
@@ -1,60 +0,0 @@
# 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, Tuple, Union
from .utils import NamespacedClient
class XPackClient(NamespacedClient):
def __getattr__(self, attr_name: str) -> Any:
return getattr(self.client, attr_name)
# AUTO-GENERATED-API-DEFINITIONS #
async def info(
self,
*,
accept_enterprise: Optional[Any] = ...,
categories: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def usage(
self,
*,
master_timeout: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
-6
View File
@@ -44,7 +44,6 @@ from .ml import MlClient
from .monitoring import MonitoringClient from .monitoring import MonitoringClient
from .nodes import NodesClient from .nodes import NodesClient
from .remote import RemoteClient from .remote import RemoteClient
from .rollup import RollupClient
from .searchable_snapshots import SearchableSnapshotsClient from .searchable_snapshots import SearchableSnapshotsClient
from .security import SecurityClient from .security import SecurityClient
from .shutdown import ShutdownClient from .shutdown import ShutdownClient
@@ -58,9 +57,6 @@ from .transform import TransformClient
from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params
from .watcher import WatcherClient from .watcher import WatcherClient
# xpack APIs
from .xpack import XPackClient
logger = logging.getLogger("elasticsearch") logger = logging.getLogger("elasticsearch")
@@ -219,7 +215,6 @@ class Elasticsearch(object):
self.snapshot = SnapshotClient(self) self.snapshot = SnapshotClient(self)
self.tasks = TasksClient(self) self.tasks = TasksClient(self)
self.xpack = XPackClient(self)
self.ccr = CcrClient(self) self.ccr = CcrClient(self)
self.data_frame = Data_FrameClient(self) self.data_frame = Data_FrameClient(self)
self.deprecation = DeprecationClient(self) self.deprecation = DeprecationClient(self)
@@ -234,7 +229,6 @@ class Elasticsearch(object):
self.migration = MigrationClient(self) self.migration = MigrationClient(self)
self.ml = MlClient(self) self.ml = MlClient(self)
self.monitoring = MonitoringClient(self) self.monitoring = MonitoringClient(self)
self.rollup = RollupClient(self)
self.searchable_snapshots = SearchableSnapshotsClient(self) self.searchable_snapshots = SearchableSnapshotsClient(self)
self.security = SecurityClient(self) self.security = SecurityClient(self)
self.slm = SlmClient(self) self.slm = SlmClient(self)
-6
View File
@@ -42,7 +42,6 @@ from .ml import MlClient
from .monitoring import MonitoringClient from .monitoring import MonitoringClient
from .nodes import NodesClient from .nodes import NodesClient
from .remote import RemoteClient from .remote import RemoteClient
from .rollup import RollupClient
from .searchable_snapshots import SearchableSnapshotsClient from .searchable_snapshots import SearchableSnapshotsClient
from .security import SecurityClient from .security import SecurityClient
from .shutdown import ShutdownClient from .shutdown import ShutdownClient
@@ -55,9 +54,6 @@ from .text_structure import TextStructureClient
from .transform import TransformClient from .transform import TransformClient
from .watcher import WatcherClient from .watcher import WatcherClient
# xpack APIs
from .xpack import XPackClient
logger: logging.Logger logger: logging.Logger
class Elasticsearch(object): class Elasticsearch(object):
@@ -75,7 +71,6 @@ class Elasticsearch(object):
snapshot: SnapshotClient snapshot: SnapshotClient
tasks: TasksClient tasks: TasksClient
xpack: XPackClient
ccr: CcrClient ccr: CcrClient
dangling_indices: DanglingIndicesClient dangling_indices: DanglingIndicesClient
enrich: EnrichClient enrich: EnrichClient
@@ -87,7 +82,6 @@ class Elasticsearch(object):
migration: MigrationClient migration: MigrationClient
ml: MlClient ml: MlClient
monitoring: MonitoringClient monitoring: MonitoringClient
rollup: RollupClient
searchable_snapshots: SearchableSnapshotsClient searchable_snapshots: SearchableSnapshotsClient
security: SecurityClient security: SecurityClient
shutdown: ShutdownClient shutdown: ShutdownClient
-244
View File
@@ -1,244 +0,0 @@
# 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, _make_path, query_params
class RollupClient(NamespacedClient):
@query_params()
def delete_job(self, id, params=None, headers=None):
"""
Deletes an existing rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-delete-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to delete
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"DELETE", _make_path("_rollup", "job", id), params=params, headers=headers
)
@query_params()
def get_jobs(self, id=None, params=None, headers=None):
"""
Retrieves the configuration, stats, and status of rollup jobs.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job(s) to fetch. Accepts glob patterns,
or left blank for all jobs
"""
return self.transport.perform_request(
"GET", _make_path("_rollup", "job", id), params=params, headers=headers
)
@query_params()
def get_rollup_caps(self, id=None, params=None, headers=None):
"""
Returns the capabilities of any rollup jobs that have been configured for a
specific index or index pattern.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-rollup-caps.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the index to check rollup capabilities on, or
left blank for all jobs
"""
return self.transport.perform_request(
"GET", _make_path("_rollup", "data", id), params=params, headers=headers
)
@query_params()
def get_rollup_index_caps(self, index, params=None, headers=None):
"""
Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the
index where rollup data is stored).
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-rollup-index-caps.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg index: The rollup index or index pattern to obtain rollup
capabilities from.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return self.transport.perform_request(
"GET", _make_path(index, "_rollup", "data"), params=params, headers=headers
)
@query_params()
def put_job(self, id, body, params=None, headers=None):
"""
Creates a rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-put-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to create
:arg body: The job configuration
"""
for param in (id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"PUT",
_make_path("_rollup", "job", id),
params=params,
headers=headers,
body=body,
)
@query_params("rest_total_hits_as_int", "typed_keys")
def rollup_search(self, index, body, doc_type=None, params=None, headers=None):
"""
Enables searching rolled-up data using the standard query DSL.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-search.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg index: The indices or index-pattern(s) (containing rollup
or regular data) that should be searched
:arg body: The search request body
:arg doc_type: The doc type inside the index
:arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response
:arg typed_keys: Specify whether aggregation and suggester names
should be prefixed by their respective types in the response
"""
for param in (index, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"POST",
_make_path(index, doc_type, "_rollup_search"),
params=params,
headers=headers,
body=body,
)
@query_params()
def start_job(self, id, params=None, headers=None):
"""
Starts an existing, stopped rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-start-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to start
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"POST",
_make_path("_rollup", "job", id, "_start"),
params=params,
headers=headers,
)
@query_params("timeout", "wait_for_completion")
def stop_job(self, id, params=None, headers=None):
"""
Stops an existing, started rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-stop-job.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg id: The ID of the job to stop
:arg timeout: Block for (at maximum) the specified duration
while waiting for the job to stop. Defaults to 30s.
:arg wait_for_completion: True if the API should block until the
job has fully stopped, false if should be executed async. Defaults to
false.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"POST",
_make_path("_rollup", "job", id, "_stop"),
params=params,
headers=headers,
)
@query_params()
def rollup(self, index, rollup_index, body, params=None, headers=None):
"""
Rollup an index
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/xpack-rollup.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
: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, rollup_index, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"POST",
_make_path(index, "_rollup", rollup_index),
params=params,
headers=headers,
body=body,
)
-184
View File
@@ -1,184 +0,0 @@
# 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, Tuple, Union
from .utils import NamespacedClient
class RollupClient(NamespacedClient):
def delete_job(
self,
id: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def get_jobs(
self,
*,
id: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def get_rollup_caps(
self,
*,
id: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def get_rollup_index_caps(
self,
index: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def put_job(
self,
id: Any,
*,
body: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def rollup_search(
self,
index: Any,
*,
body: Any,
doc_type: Optional[Any] = ...,
rest_total_hits_as_int: Optional[Any] = ...,
typed_keys: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def start_job(
self,
id: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def stop_job(
self,
id: Any,
*,
timeout: Optional[Any] = ...,
wait_for_completion: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def rollup(
self,
index: Any,
rollup_index: Any,
*,
body: 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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
-53
View File
@@ -1,53 +0,0 @@
# 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 NamespacedClient, query_params
class XPackClient(NamespacedClient):
def __getattr__(self, attr_name):
return getattr(self.client, attr_name)
# AUTO-GENERATED-API-DEFINITIONS #
@query_params("accept_enterprise", "categories")
def info(self, params=None, headers=None):
"""
Retrieves information about the installed X-Pack features.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/info-api.html>`_
:arg accept_enterprise: If an enterprise license is installed,
return the type and mode as 'enterprise' (default: false)
:arg categories: Comma-separated list of info categories. Can be
any of: build, license, features
"""
return self.transport.perform_request(
"GET", "/_xpack", params=params, headers=headers
)
@query_params("master_timeout")
def usage(self, params=None, headers=None):
"""
Retrieves usage information about the installed X-Pack features.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/usage-api.html>`_
:arg master_timeout: Specify timeout for watch write operation
"""
return self.transport.perform_request(
"GET", "/_xpack/usage", params=params, headers=headers
)
-60
View File
@@ -1,60 +0,0 @@
# 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, Tuple, Union
from .utils import NamespacedClient
class XPackClient(NamespacedClient):
def __getattr__(self, attr_name: str) -> Any:
return getattr(self.client, attr_name)
# AUTO-GENERATED-API-DEFINITIONS #
def info(
self,
*,
accept_enterprise: Optional[Any] = ...,
categories: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def usage(
self,
*,
master_timeout: Optional[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] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
@@ -25,7 +25,7 @@ import warnings
import pytest import pytest
from elasticsearch import ElasticsearchWarning, RequestError from elasticsearch import ElasticsearchWarning
from elasticsearch.helpers.test import _get_version from elasticsearch.helpers.test import _get_version
from ...test_server.test_rest_api_spec import ( from ...test_server.test_rest_api_spec import (
@@ -38,7 +38,7 @@ from ...test_server.test_rest_api_spec import (
pytestmark = pytest.mark.asyncio pytestmark = pytest.mark.asyncio
XPACK_FEATURES = None XPACK_FEATURES = set()
ES_VERSION = None ES_VERSION = None
@@ -208,16 +208,6 @@ class AsyncYamlRunner(YamlRunner):
async def _feature_enabled(self, name): async def _feature_enabled(self, name):
global XPACK_FEATURES global XPACK_FEATURES
if XPACK_FEATURES is None:
try:
xinfo = await self.client.xpack.info()
XPACK_FEATURES = set(
f for f in xinfo["features"] if xinfo["features"][f]["enabled"]
)
IMPLEMENTED_FEATURES.add("xpack")
except RequestError:
XPACK_FEATURES = set()
IMPLEMENTED_FEATURES.add("no_xpack")
return name in XPACK_FEATURES return name in XPACK_FEATURES
@@ -32,7 +32,7 @@ import pytest
import urllib3 import urllib3
import yaml import yaml
from elasticsearch import ElasticsearchWarning, RequestError, TransportError from elasticsearch import ElasticsearchWarning, TransportError
from elasticsearch.client.utils import _base64_auth_header from elasticsearch.client.utils import _base64_auth_header
from elasticsearch.compat import string_types from elasticsearch.compat import string_types
from elasticsearch.helpers.test import _get_version from elasticsearch.helpers.test import _get_version
@@ -83,8 +83,6 @@ SKIP_TESTS = {
"transform/transforms_stats_continuous[0]", "transform/transforms_stats_continuous[0]",
# Fails bad request instead of 404? # Fails bad request instead of 404?
"ml/inference_crud", "ml/inference_crud",
# rollup/security_tests time out?
"rollup/security_tests",
# Our TLS certs are custom # Our TLS certs are custom
"ssl/10_basic[0]", "ssl/10_basic[0]",
# Our user is custom # Our user is custom
@@ -110,7 +108,7 @@ SKIP_TESTS = {
} }
XPACK_FEATURES = None XPACK_FEATURES = set()
ES_VERSION = None ES_VERSION = None
RUN_ASYNC_REST_API_TESTS = ( RUN_ASYNC_REST_API_TESTS = (
sys.version_info >= (3, 6) sys.version_info >= (3, 6)
@@ -442,16 +440,6 @@ class YamlRunner:
def _feature_enabled(self, name): def _feature_enabled(self, name):
global XPACK_FEATURES, IMPLEMENTED_FEATURES global XPACK_FEATURES, IMPLEMENTED_FEATURES
if XPACK_FEATURES is None:
try:
xinfo = self.client.xpack.info()
XPACK_FEATURES = set(
f for f in xinfo["features"] if xinfo["features"][f]["enabled"]
)
IMPLEMENTED_FEATURES.add("xpack")
except RequestError:
XPACK_FEATURES = set()
IMPLEMENTED_FEATURES.add("no_xpack")
return name in XPACK_FEATURES return name in XPACK_FEATURES
def _assert_match_equals(self, a, b): def _assert_match_equals(self, a, b):
+4 -120
View File
@@ -17,8 +17,7 @@
import time import time
from elasticsearch import Elasticsearch, NotFoundError, RequestError from elasticsearch import Elasticsearch
from elasticsearch.helpers.test import es_version
def wipe_cluster(client): def wipe_cluster(client):
@@ -35,37 +34,15 @@ def wipe_cluster(client):
except ImportError: except ImportError:
pass pass
is_xpack = True
if is_xpack:
wipe_rollup_jobs(client)
wait_for_pending_tasks(client, filter="xpack/rollup/job")
wipe_slm_policies(client)
# Searchable snapshot indices start in 7.8+
if es_version(client) >= (7, 8):
wipe_searchable_snapshot_indices(client)
wipe_snapshots(client) wipe_snapshots(client)
if is_xpack:
wipe_data_streams(client)
wipe_indices(client) wipe_indices(client)
if is_xpack: client.indices.delete_template(name="*")
wipe_xpack_templates(client) client.indices.delete_index_template(name="*")
else: client.cluster.delete_component_template(name="*")
client.indices.delete_template(name="*")
client.indices.delete_index_template(name="*")
client.cluster.delete_component_template(name="*")
wipe_cluster_settings(client) wipe_cluster_settings(client)
if is_xpack:
wipe_ilm_policies(client)
wipe_auto_follow_patterns(client)
wipe_tasks(client)
wipe_node_shutdown_metadata(client)
wait_for_pending_datafeeds_and_jobs(client)
wait_for_cluster_state_updates_to_finish(client) wait_for_cluster_state_updates_to_finish(client)
if close_after_wipe: if close_after_wipe:
client.close() client.close()
@@ -83,14 +60,6 @@ def wipe_cluster_settings(client):
client.cluster.put_settings(body=new_settings) client.cluster.put_settings(body=new_settings)
def wipe_rollup_jobs(client):
rollup_jobs = client.rollup.get_jobs(id="_all").get("jobs", ())
for job in rollup_jobs:
job_id = job["config"]["id"]
client.rollup.stop_job(id=job_id, wait_for_completion=True, ignore=404)
client.rollup.delete_job(id=job_id, ignore=404)
def wipe_snapshots(client): def wipe_snapshots(client):
"""Deletes all the snapshots and repositories from the cluster""" """Deletes all the snapshots and repositories from the cluster"""
in_progress_snapshots = [] in_progress_snapshots = []
@@ -141,54 +110,6 @@ def wipe_searchable_snapshot_indices(client):
client.indices.delete(index=index) client.indices.delete(index=index)
def wipe_xpack_templates(client):
templates = [
x.strip() for x in client.cat.templates(h="name").split("\n") if x.strip()
]
for template in templates:
if is_xpack_template(template):
continue
try:
client.indices.delete_template(name=template)
except NotFoundError as e:
if "index_template [%s] missing" % template in str(e.info):
client.indices.delete_index_template(name=template)
# Delete component templates, need to retry because sometimes
# indices aren't cleaned up in time before we issue the delete.
templates = client.cluster.get_component_template()["component_templates"]
templates_to_delete = [
template for template in templates if not is_xpack_template(template["name"])
]
for _ in range(3):
for template in list(templates_to_delete):
try:
client.cluster.delete_component_template(
name=template["name"],
)
except RequestError:
pass
else:
templates_to_delete.remove(template)
if not templates_to_delete:
break
time.sleep(0.01)
def wipe_ilm_policies(client):
for policy in client.ilm.get_lifecycle():
if policy not in {
"ilm-history-ilm-policy",
"slm-history-ilm-policy",
"watch-history-ilm-policy",
"ml-size-based-ilm-policy",
"logs",
"metrics",
}:
client.ilm.delete_lifecycle(policy=policy)
def wipe_slm_policies(client): def wipe_slm_policies(client):
for policy in client.slm.get_lifecycle(): for policy in client.slm.get_lifecycle():
client.slm.delete_lifecycle(policy_id=policy["name"]) client.slm.delete_lifecycle(policy_id=policy["name"])
@@ -244,40 +165,3 @@ def wait_for_cluster_state_updates_to_finish(client, timeout=30):
while time.time() < end_time: while time.time() < end_time:
if not client.cluster.pending_tasks().get("tasks", ()): if not client.cluster.pending_tasks().get("tasks", ()):
break break
def is_xpack_template(name):
if ".monitoring-" in name:
return True
if ".watch" in name or ".triggered_watches" in name:
return True
if ".data-frame-" in name:
return True
if ".ml-" in name:
return True
if ".transform-" in name:
return True
if name in {
".watches",
"logstash-index-template",
".logstash-management",
"security_audit_log",
".slm-history",
".async-search",
".geoip_databases",
"saml-service-provider",
"ilm-history",
"logs",
"logs-settings",
"logs-mappings",
"metrics",
"metrics-settings",
"metrics-mappings",
"synthetics",
"synthetics-settings",
"synthetics-mappings",
".snapshot-blob-cache",
"data-streams-mappings",
}:
return True
return False