Add typeless API for exists_source
This commit is contained in:
@@ -832,11 +832,13 @@ class AsyncElasticsearch(object):
|
|||||||
if param in SKIP_IN_PATH:
|
if param in SKIP_IN_PATH:
|
||||||
raise ValueError("Empty value passed for a required argument.")
|
raise ValueError("Empty value passed for a required argument.")
|
||||||
|
|
||||||
|
if doc_type in SKIP_IN_PATH:
|
||||||
|
path = _make_path(index, "_source", id)
|
||||||
|
else:
|
||||||
|
path = _make_path(index, doc_type, id, "_source")
|
||||||
|
|
||||||
return await self.transport.perform_request(
|
return await self.transport.perform_request(
|
||||||
"HEAD",
|
"HEAD", path, params=params, headers=headers
|
||||||
_make_path(index, doc_type, id, "_source"),
|
|
||||||
params=params,
|
|
||||||
headers=headers,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params(
|
@query_params(
|
||||||
@@ -1576,8 +1578,8 @@ class AsyncElasticsearch(object):
|
|||||||
:arg stored_fields: A comma-separated list of stored fields to
|
:arg stored_fields: A comma-separated list of stored fields to
|
||||||
return as part of a hit
|
return as part of a hit
|
||||||
:arg suggest_field: Specify which field to use for suggestions
|
:arg suggest_field: Specify which field to use for suggestions
|
||||||
:arg suggest_mode: Specify suggest mode Valid choices:
|
:arg suggest_mode: Specify suggest mode Valid choices: missing,
|
||||||
missing, popular, always Default: missing
|
popular, always Default: missing
|
||||||
:arg suggest_size: How many suggestions to return in response
|
:arg suggest_size: How many suggestions to return in response
|
||||||
:arg suggest_text: The source text for which the suggestions
|
:arg suggest_text: The source text for which the suggestions
|
||||||
should be returned
|
should be returned
|
||||||
|
|||||||
@@ -1276,7 +1276,7 @@ class IndicesClient(NamespacedClient):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
async def create_data_stream(self, name, body, params=None, headers=None):
|
async def create_data_stream(self, name, body=None, params=None, headers=None):
|
||||||
"""
|
"""
|
||||||
Creates or updates a data stream
|
Creates or updates a data stream
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
||||||
@@ -1284,9 +1284,8 @@ class IndicesClient(NamespacedClient):
|
|||||||
:arg name: The name of the data stream
|
:arg name: The name of the data stream
|
||||||
:arg body: The data stream definition
|
:arg body: The data stream definition
|
||||||
"""
|
"""
|
||||||
for param in (name, body):
|
if name in SKIP_IN_PATH:
|
||||||
if param in SKIP_IN_PATH:
|
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||||
raise ValueError("Empty value passed for a required argument.")
|
|
||||||
|
|
||||||
return await self.transport.perform_request(
|
return await self.transport.perform_request(
|
||||||
"PUT",
|
"PUT",
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class MlClient(NamespacedClient):
|
|||||||
body=body,
|
body=body,
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params("duration", "expires_in")
|
@query_params("duration", "expires_in", "max_model_memory")
|
||||||
async def forecast(self, job_id, params=None, headers=None):
|
async def forecast(self, job_id, params=None, headers=None):
|
||||||
"""
|
"""
|
||||||
Predicts the future behavior of a time series by using its historical behavior.
|
Predicts the future behavior of a time series by using its historical behavior.
|
||||||
@@ -328,6 +328,8 @@ class MlClient(NamespacedClient):
|
|||||||
:arg duration: The duration of the forecast
|
:arg duration: The duration of the forecast
|
||||||
:arg expires_in: The time interval after which the forecast
|
:arg expires_in: The time interval after which the forecast
|
||||||
expires. Expired forecasts will be deleted at the first opportunity.
|
expires. Expired forecasts will be deleted at the first opportunity.
|
||||||
|
:arg max_model_memory: The max memory able to be used by the
|
||||||
|
forecast. Default is 20mb.
|
||||||
"""
|
"""
|
||||||
if job_id in SKIP_IN_PATH:
|
if job_id in SKIP_IN_PATH:
|
||||||
raise ValueError("Empty value passed for a required argument 'job_id'.")
|
raise ValueError("Empty value passed for a required argument 'job_id'.")
|
||||||
@@ -1396,6 +1398,7 @@ class MlClient(NamespacedClient):
|
|||||||
@query_params(
|
@query_params(
|
||||||
"allow_no_match",
|
"allow_no_match",
|
||||||
"decompress_definition",
|
"decompress_definition",
|
||||||
|
"for_export",
|
||||||
"from_",
|
"from_",
|
||||||
"include_model_definition",
|
"include_model_definition",
|
||||||
"size",
|
"size",
|
||||||
@@ -1413,6 +1416,8 @@ class MlClient(NamespacedClient):
|
|||||||
:arg decompress_definition: Should the model definition be
|
:arg decompress_definition: Should the model definition be
|
||||||
decompressed into valid JSON or returned in a custom compressed format.
|
decompressed into valid JSON or returned in a custom compressed format.
|
||||||
Defaults to true. Default: True
|
Defaults to true. Default: True
|
||||||
|
:arg for_export: Omits fields that are illegal to set on model
|
||||||
|
PUT
|
||||||
:arg from_: skips a number of trained models
|
:arg from_: skips a number of trained models
|
||||||
:arg include_model_definition: Should the full model definition
|
:arg include_model_definition: Should the full model definition
|
||||||
be included in the results. These definitions can be large. So be
|
be included in the results. These definitions can be large. So be
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ class SnapshotClient(NamespacedClient):
|
|||||||
Deletes a repository.
|
Deletes a repository.
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||||
|
|
||||||
:arg repository: A comma-separated list of repository names
|
:arg repository: Name of the snapshot repository to unregister.
|
||||||
|
Wildcard (`*`) patterns are supported.
|
||||||
:arg master_timeout: Explicit operation timeout for connection
|
:arg master_timeout: Explicit operation timeout for connection
|
||||||
to master node
|
to master node
|
||||||
:arg timeout: Explicit operation timeout
|
:arg timeout: Explicit operation timeout
|
||||||
|
|||||||
@@ -826,11 +826,13 @@ class Elasticsearch(object):
|
|||||||
if param in SKIP_IN_PATH:
|
if param in SKIP_IN_PATH:
|
||||||
raise ValueError("Empty value passed for a required argument.")
|
raise ValueError("Empty value passed for a required argument.")
|
||||||
|
|
||||||
|
if doc_type in SKIP_IN_PATH:
|
||||||
|
path = _make_path(index, "_source", id)
|
||||||
|
else:
|
||||||
|
path = _make_path(index, doc_type, id, "_source")
|
||||||
|
|
||||||
return self.transport.perform_request(
|
return self.transport.perform_request(
|
||||||
"HEAD",
|
"HEAD", path, params=params, headers=headers
|
||||||
_make_path(index, doc_type, id, "_source"),
|
|
||||||
params=params,
|
|
||||||
headers=headers,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params(
|
@query_params(
|
||||||
@@ -1564,8 +1566,8 @@ class Elasticsearch(object):
|
|||||||
:arg stored_fields: A comma-separated list of stored fields to
|
:arg stored_fields: A comma-separated list of stored fields to
|
||||||
return as part of a hit
|
return as part of a hit
|
||||||
:arg suggest_field: Specify which field to use for suggestions
|
:arg suggest_field: Specify which field to use for suggestions
|
||||||
:arg suggest_mode: Specify suggest mode Valid choices:
|
:arg suggest_mode: Specify suggest mode Valid choices: missing,
|
||||||
missing, popular, always Default: missing
|
popular, always Default: missing
|
||||||
:arg suggest_size: How many suggestions to return in response
|
:arg suggest_size: How many suggestions to return in response
|
||||||
:arg suggest_text: The source text for which the suggestions
|
:arg suggest_text: The source text for which the suggestions
|
||||||
should be returned
|
should be returned
|
||||||
|
|||||||
@@ -1272,7 +1272,7 @@ class IndicesClient(NamespacedClient):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
def create_data_stream(self, name, body, params=None, headers=None):
|
def create_data_stream(self, name, body=None, params=None, headers=None):
|
||||||
"""
|
"""
|
||||||
Creates or updates a data stream
|
Creates or updates a data stream
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
||||||
@@ -1280,9 +1280,8 @@ class IndicesClient(NamespacedClient):
|
|||||||
:arg name: The name of the data stream
|
:arg name: The name of the data stream
|
||||||
:arg body: The data stream definition
|
:arg body: The data stream definition
|
||||||
"""
|
"""
|
||||||
for param in (name, body):
|
if name in SKIP_IN_PATH:
|
||||||
if param in SKIP_IN_PATH:
|
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||||
raise ValueError("Empty value passed for a required argument.")
|
|
||||||
|
|
||||||
return self.transport.perform_request(
|
return self.transport.perform_request(
|
||||||
"PUT",
|
"PUT",
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ class MlClient(NamespacedClient):
|
|||||||
body=body,
|
body=body,
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params("duration", "expires_in")
|
@query_params("duration", "expires_in", "max_model_memory")
|
||||||
def forecast(self, job_id, params=None, headers=None):
|
def forecast(self, job_id, params=None, headers=None):
|
||||||
"""
|
"""
|
||||||
Predicts the future behavior of a time series by using its historical behavior.
|
Predicts the future behavior of a time series by using its historical behavior.
|
||||||
@@ -322,6 +322,8 @@ class MlClient(NamespacedClient):
|
|||||||
:arg duration: The duration of the forecast
|
:arg duration: The duration of the forecast
|
||||||
:arg expires_in: The time interval after which the forecast
|
:arg expires_in: The time interval after which the forecast
|
||||||
expires. Expired forecasts will be deleted at the first opportunity.
|
expires. Expired forecasts will be deleted at the first opportunity.
|
||||||
|
:arg max_model_memory: The max memory able to be used by the
|
||||||
|
forecast. Default is 20mb.
|
||||||
"""
|
"""
|
||||||
if job_id in SKIP_IN_PATH:
|
if job_id in SKIP_IN_PATH:
|
||||||
raise ValueError("Empty value passed for a required argument 'job_id'.")
|
raise ValueError("Empty value passed for a required argument 'job_id'.")
|
||||||
@@ -1384,6 +1386,7 @@ class MlClient(NamespacedClient):
|
|||||||
@query_params(
|
@query_params(
|
||||||
"allow_no_match",
|
"allow_no_match",
|
||||||
"decompress_definition",
|
"decompress_definition",
|
||||||
|
"for_export",
|
||||||
"from_",
|
"from_",
|
||||||
"include_model_definition",
|
"include_model_definition",
|
||||||
"size",
|
"size",
|
||||||
@@ -1401,6 +1404,8 @@ class MlClient(NamespacedClient):
|
|||||||
:arg decompress_definition: Should the model definition be
|
:arg decompress_definition: Should the model definition be
|
||||||
decompressed into valid JSON or returned in a custom compressed format.
|
decompressed into valid JSON or returned in a custom compressed format.
|
||||||
Defaults to true. Default: True
|
Defaults to true. Default: True
|
||||||
|
:arg for_export: Omits fields that are illegal to set on model
|
||||||
|
PUT
|
||||||
:arg from_: skips a number of trained models
|
:arg from_: skips a number of trained models
|
||||||
:arg include_model_definition: Should the full model definition
|
:arg include_model_definition: Should the full model definition
|
||||||
be included in the results. These definitions can be large. So be
|
be included in the results. These definitions can be large. So be
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ class SnapshotClient(NamespacedClient):
|
|||||||
Deletes a repository.
|
Deletes a repository.
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||||
|
|
||||||
:arg repository: A comma-separated list of repository names
|
:arg repository: Name of the snapshot repository to unregister.
|
||||||
|
Wildcard (`*`) patterns are supported.
|
||||||
:arg master_timeout: Explicit operation timeout for connection
|
:arg master_timeout: Explicit operation timeout for connection
|
||||||
to master node
|
to master node
|
||||||
:arg timeout: Explicit operation timeout
|
:arg timeout: Explicit operation timeout
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends "base" %}
|
||||||
|
{% block request %}
|
||||||
|
if doc_type in SKIP_IN_PATH:
|
||||||
|
path = _make_path(index, "_source", id)
|
||||||
|
else:
|
||||||
|
path = _make_path(index, doc_type, id, "_source")
|
||||||
|
|
||||||
|
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers)
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user