Flatten namespaces, keep xpack access as failover

This commit is contained in:
Honza Král
2019-12-22 16:32:49 +01:00
committed by Honza Král
parent d2a0cc62eb
commit d8d1b4b0fa
19 changed files with 83 additions and 98 deletions
+43
View File
@@ -0,0 +1,43 @@
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class SqlClient(NamespacedClient):
@query_params()
def clear_cursor(self, body, params=None):
"""
`<Clear SQL cursor>`_
:arg body: Specify the cursor value in the `cursor` element to clean the
cursor.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST", "/_sql/close", params=params, body=body
)
@query_params("format")
def query(self, body, params=None):
"""
`<Execute SQL>`_
:arg body: Use the `query` element to start a query. Use the `cursor`
element to continue a query.
:arg format: a short version of the Accept header, e.g. json, yaml
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request("POST", "/_sql", params=params, body=body)
@query_params()
def translate(self, body, params=None):
"""
`<Translate SQL into Elasticsearch queries>`_
:arg body: Specify the query in the `query` element.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST", "/_sql/translate", params=params, body=body
)