Update 7.x REST APIs

This commit is contained in:
Seth Michael Larson
2020-05-19 12:59:40 -05:00
committed by Seth Michael Larson
parent 2f8c0843a6
commit f8b005f62e
7 changed files with 57 additions and 46 deletions
+2 -2
View File
@@ -5,9 +5,9 @@
# flake8: noqa
from __future__ import absolute_import
VERSION = (7, 8, 0)
VERSION = (7, 9, 0)
__version__ = VERSION
__versionstr__ = "7.8.0"
__versionstr__ = "7.9.0a1"
import logging
import warnings
-12
View File
@@ -306,7 +306,6 @@ class Elasticsearch(object):
@query_params(
"pipeline",
"prefer_v2_templates",
"refresh",
"routing",
"timeout",
@@ -326,8 +325,6 @@ class Elasticsearch(object):
:arg doc_type: The type of the document
:arg pipeline: The pipeline id to preprocess incoming documents
with
:arg prefer_v2_templates: favor V2 templates instead of V1
templates during automatic index creation
:arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh
to make this operation visible to search, if `false` (the default) then
@@ -363,7 +360,6 @@ class Elasticsearch(object):
"if_seq_no",
"op_type",
"pipeline",
"prefer_v2_templates",
"refresh",
"routing",
"timeout",
@@ -391,8 +387,6 @@ class Elasticsearch(object):
without an explicit document ID Valid choices: index, create
:arg pipeline: The pipeline id to preprocess incoming documents
with
:arg prefer_v2_templates: favor V2 templates instead of V1
templates during automatic index creation
:arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh
to make this operation visible to search, if `false` (the default) then
@@ -428,7 +422,6 @@ class Elasticsearch(object):
"_source_excludes",
"_source_includes",
"pipeline",
"prefer_v2_templates",
"refresh",
"routing",
"timeout",
@@ -453,8 +446,6 @@ class Elasticsearch(object):
return from the _source field, can be overridden on each sub-request
:arg pipeline: The pipeline id to preprocess incoming documents
with
:arg prefer_v2_templates: favor V2 templates instead of V1
templates during automatic index creation
:arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh
to make this operation visible to search, if `false` (the default) then
@@ -1812,7 +1803,6 @@ class Elasticsearch(object):
"if_primary_term",
"if_seq_no",
"lang",
"prefer_v2_templates",
"refresh",
"retry_on_conflict",
"routing",
@@ -1842,8 +1832,6 @@ class Elasticsearch(object):
operation that has changed the document has the specified sequence
number
:arg lang: The script language (default: painless)
:arg prefer_v2_templates: favor V2 templates instead of V1
templates during automatic index creation
:arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh
to make this operation visible to search, if `false` (the default) then
+4 -4
View File
@@ -243,7 +243,7 @@ class ClusterClient(NamespacedClient):
def delete_component_template(self, name, params=None, headers=None):
"""
Deletes a component template
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
:arg name: The name of the template
:arg master_timeout: Specify timeout for connection to master
@@ -263,7 +263,7 @@ class ClusterClient(NamespacedClient):
def get_component_template(self, name=None, params=None, headers=None):
"""
Returns one or more component templates
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
:arg name: The comma separated names of the component templates
:arg local: Return local information, do not retrieve the state
@@ -282,7 +282,7 @@ class ClusterClient(NamespacedClient):
def put_component_template(self, name, body, params=None, headers=None):
"""
Creates or updates a component template
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
:arg name: The name of the template
:arg body: The template definition
@@ -307,7 +307,7 @@ class ClusterClient(NamespacedClient):
def exists_component_template(self, name, params=None, headers=None):
"""
Returns information about whether a particular component template exist
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
:arg name: The name of the template
:arg local: Return local information, do not retrieve the state
+38 -23
View File
@@ -83,11 +83,7 @@ class IndicesClient(NamespacedClient):
)
@query_params(
"include_type_name",
"master_timeout",
"prefer_v2_templates",
"timeout",
"wait_for_active_shards",
"include_type_name", "master_timeout", "timeout", "wait_for_active_shards"
)
def create(self, index, body=None, params=None, headers=None):
"""
@@ -100,8 +96,6 @@ class IndicesClient(NamespacedClient):
:arg include_type_name: Whether a type should be expected in the
body of the mappings.
:arg master_timeout: Specify timeout for connection to master
:arg prefer_v2_templates: favor V2 templates instead of V1
templates during index creation
:arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Set the number of active shards to
wait for before the operation returns.
@@ -1145,7 +1139,6 @@ class IndicesClient(NamespacedClient):
"dry_run",
"include_type_name",
"master_timeout",
"prefer_v2_templates",
"timeout",
"wait_for_active_shards",
)
@@ -1165,8 +1158,6 @@ class IndicesClient(NamespacedClient):
:arg include_type_name: Whether a type should be included in the
body of the mappings.
:arg master_timeout: Specify timeout for connection to master
:arg prefer_v2_templates: favor V2 templates instead of V1
templates during automatic index creation
:arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Set the number of active shards to
wait for on the newly created rollover index before the operation
@@ -1316,19 +1307,6 @@ class IndicesClient(NamespacedClient):
"DELETE", _make_path("_data_stream", name), params=params, headers=headers
)
@query_params()
def get_data_streams(self, name=None, params=None, headers=None):
"""
Returns data streams.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
:arg name: The name or wildcard expression of the requested data
streams
"""
return self.transport.perform_request(
"GET", _make_path("_data_streams", name), params=params, headers=headers
)
@query_params("master_timeout", "timeout")
def delete_index_template(self, name, params=None, headers=None):
"""
@@ -1442,3 +1420,40 @@ class IndicesClient(NamespacedClient):
headers=headers,
body=body,
)
@query_params()
def get_data_stream(self, name=None, params=None, headers=None):
"""
Returns data streams.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
:arg name: The name or wildcard expression of the requested data
streams
"""
return self.transport.perform_request(
"GET", _make_path("_data_stream", name), params=params, headers=headers
)
@query_params("cause", "create", "master_timeout")
def simulate_template(self, body=None, name=None, params=None, headers=None):
"""
Simulate resolving the given template name or body
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-templates.html>`_
:arg body: New index template definition to be simulated, if no
index template name is specified
:arg name: The name of the index template
:arg cause: User defined reason for dry-run creating the new
template for simulation purposes
:arg create: Whether the index template we optionally defined in
the body should only be dry-run added if new or can also replace an
existing one
:arg master_timeout: Specify timeout for connection to master
"""
return self.transport.perform_request(
"POST",
_make_path("_index_template", "_simulate", name),
params=params,
headers=headers,
body=body,
)
+10 -2
View File
@@ -115,13 +115,19 @@ class MlClient(NamespacedClient):
)
@query_params()
def delete_expired_data(self, params=None, headers=None):
def delete_expired_data(self, body=None, params=None, headers=None):
"""
Deletes expired and unused machine learning data.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-delete-expired-data.html>`_
:arg body: deleting expired data parameters
"""
return self.transport.perform_request(
"DELETE", "/_ml/_delete_expired_data", params=params, headers=headers
"DELETE",
"/_ml/_delete_expired_data",
params=params,
headers=headers,
body=body,
)
@query_params()
@@ -1145,6 +1151,7 @@ class MlClient(NamespacedClient):
def validate(self, body, params=None, headers=None):
"""
Validates an anomaly detection job.
`<https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html>`_
:arg body: The job config
"""
@@ -1163,6 +1170,7 @@ class MlClient(NamespacedClient):
def validate_detector(self, body, params=None, headers=None):
"""
Validates an anomaly detection detector.
`<https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html>`_
:arg body: The detector
"""
+1 -1
View File
@@ -215,7 +215,7 @@ class SnapshotClient(NamespacedClient):
def cleanup_repository(self, repository, params=None, headers=None):
"""
Removes stale data from repository.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/clean-up-snapshot-repo-api.html>`_
:arg repository: A repository name
:arg master_timeout: Explicit operation timeout for connection
+2 -2
View File
@@ -6,9 +6,9 @@
from os.path import join, dirname
from setuptools import setup, find_packages
VERSION = (7, 7, 0)
VERSION = (7, 9, 0)
__version__ = VERSION
__versionstr__ = "7.7.0a2"
__versionstr__ = "7.9.0a1"
with open(join(dirname(__file__), "README")) as f:
long_description = f.read().strip()