Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Changelog
=========

7.5.1 (2020-01-09)
------------------
* Update client to support ES 7.5.1 APIs

7.1.0 (2019-11-14)
------------------
* Fix sniffing with ``http.publish_host``
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# flake8: noqa
from __future__ import absolute_import

VERSION = (7, 1, 0)
VERSION = (7, 5, 1)
__version__ = VERSION
__versionstr__ = ".".join(map(str, VERSION))

Expand Down
174 changes: 174 additions & 0 deletions elasticsearch/client/data_frame_transform_deprecated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
class C:
@query_params("force")
def delete_transform(self, transform_id, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-transform.html>`_

:arg transform_id: The id of the transform to delete
:arg force: When `true`, the transform is deleted regardless of
its current state. The default value is `false`, meaning that the
transform must be `stopped` before it can be deleted.
"""
if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)

return self.transport.perform_request(
"DELETE",
_make_path("_data_frame", "transforms", transform_id),
params=params,
)

@query_params("allow_no_match", "from_", "size")
def get_transform(self, transform_id=None, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html>`_

:arg transform_id: The id or comma delimited list of id
expressions of the transforms to get, '_all' or '*' implies get all
transforms
:arg allow_no_match: Whether to ignore if a wildcard expression
matches no transforms. (This includes `_all` string or when no
transforms have been specified)
:arg from_: skips a number of transform configs, defaults to 0
:arg size: specifies a max number of transforms to get, defaults
to 100
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
params["from"] = params.pop("from_")

return self.transport.perform_request(
"GET", _make_path("_data_frame", "transforms", transform_id), params=params
)

@query_params("allow_no_match", "from_", "size")
def get_transform_stats(self, transform_id, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html>`_

:arg transform_id: The id of the transform for which to get
stats. '_all' or '*' implies all transforms
:arg allow_no_match: Whether to ignore if a wildcard expression
matches no transforms. (This includes `_all` string or when no
transforms have been specified)
:arg from_: skips a number of transform stats, defaults to 0
:arg size: specifies a max number of transform stats to get,
defaults to 100
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
params["from"] = params.pop("from_")

if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)

return self.transport.perform_request(
"GET",
_make_path("_data_frame", "transforms", transform_id, "_stats"),
params=params,
)

@query_params()
def preview_transform(self, body, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html>`_

:arg body: The definition for the transform to preview
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")

return self.transport.perform_request(
"POST", "/_data_frame/transforms/_preview", params=params, body=body
)

@query_params("defer_validation")
def put_transform(self, transform_id, body, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html>`_

:arg transform_id: The id of the new transform.
:arg body: The transform definition
:arg defer_validation: If validations should be deferred until
transform starts, defaults to false.
"""
for param in (transform_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("_data_frame", "transforms", transform_id),
params=params,
body=body,
)

@query_params("timeout")
def start_transform(self, transform_id, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html>`_

:arg transform_id: The id of the transform to start
:arg timeout: Controls the time to wait for the transform to
start
"""
if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)

return self.transport.perform_request(
"POST",
_make_path("_data_frame", "transforms", transform_id, "_start"),
params=params,
)

@query_params("allow_no_match", "timeout", "wait_for_completion")
def stop_transform(self, transform_id, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-transform.html>`_

:arg transform_id: The id of the transform to stop
:arg allow_no_match: Whether to ignore if a wildcard expression
matches no transforms. (This includes `_all` string or when no
transforms have been specified)
:arg timeout: Controls the time to wait until the transform has
stopped. Default to 30 seconds
:arg wait_for_completion: Whether to wait for the transform to
fully stop before returning or not. Default to false
"""
if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)

return self.transport.perform_request(
"POST",
_make_path("_data_frame", "transforms", transform_id, "_stop"),
params=params,
)

@query_params("defer_validation")
def update_transform(self, transform_id, body, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html>`_

:arg transform_id: The id of the transform.
:arg body: The update transform definition
:arg defer_validation: If validations should be deferred until
transform starts, defaults to false.
"""
for param in (transform_id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")

return self.transport.perform_request(
"POST",
_make_path("_data_frame", "transforms", transform_id, "_update"),
params=params,
body=body,
)
24 changes: 24 additions & 0 deletions elasticsearch/client/slm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,27 @@ def put_lifecycle(self, policy_id, body=None, params=None):
return self.transport.perform_request(
"PUT", _make_path("_slm", "policy", policy_id), params=params, body=body
)

@query_params()
def get_status(self, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-get-status.html>`_

"""
return self.transport.perform_request("GET", "/_slm/status", params=params)

@query_params()
def start(self, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-start.html>`_

"""
return self.transport.perform_request("POST", "/_slm/start", params=params)

@query_params()
def stop(self, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-stop.html>`_

"""
return self.transport.perform_request("POST", "/_slm/stop", params=params)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup, find_packages
import sys

VERSION = (7, 1, 0)
VERSION = (7, 5, 1)
__version__ = VERSION
__versionstr__ = ".".join(map(str, VERSION))

Expand Down