Add typeless API for exists_source

This commit is contained in:
Seth Michael Larson
2020-06-03 10:38:35 -05:00
committed by GitHub
parent 99d026502c
commit 5db3482b5c
9 changed files with 183 additions and 160 deletions
+76 -74
View File
@@ -293,11 +293,11 @@ class AsyncElasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults
@@ -349,17 +349,17 @@ class AsyncElasticsearch(object):
number
:arg op_type: Explicit operation type. Defaults to `index` for
requests with an explicit document ID, and to `create`for requests
without an explicit document ID Valid choices: index, create
without an explicit document ID Valid choices: index, create
:arg pipeline: The pipeline id to preprocess incoming documents
with
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults
@@ -414,7 +414,7 @@ class AsyncElasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Sets the number of shard copies
@@ -492,12 +492,12 @@ class AsyncElasticsearch(object):
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_throttled: Whether specified concrete, expanded or
aliased indices should be ignored when throttled
:arg ignore_unavailable: Whether specified concrete indices
@@ -548,11 +548,11 @@ class AsyncElasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the delete operation.
@@ -631,14 +631,14 @@ class AsyncElasticsearch(object):
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the delete by query hits version
conflicts? Valid choices: abort, proceed Default: abort
conflicts? Valid choices: abort, proceed Default: abort
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
@@ -658,15 +658,15 @@ class AsyncElasticsearch(object):
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the delete
by query Default: 100
by query Default: 100
:arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout.
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided
into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be
set to `auto`. Default: 1
set to `auto`. Default: 1
:arg sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and
statistical purposes
@@ -674,7 +674,7 @@ class AsyncElasticsearch(object):
for each shard, upon reaching which the query execution will terminate
early.
:arg timeout: Time each individual bulk request should wait for
shards that are unavailable. Default: 1m
shards that are unavailable. Default: 1m
:arg version: Specify whether to return document version as part
of a hit
:arg wait_for_active_shards: Sets the number of shard copies
@@ -684,7 +684,7 @@ class AsyncElasticsearch(object):
or equal to the total number of copies for the shard (number of replicas
+ 1)
:arg wait_for_completion: Should the request should block until
the delete by query is complete. Default: True
the delete by query is complete. Default: True
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
@@ -777,7 +777,7 @@ class AsyncElasticsearch(object):
:arg stored_fields: A comma-separated list of stored fields to
return in the response
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
@@ -825,18 +825,20 @@ class AsyncElasticsearch(object):
performing the operation
:arg routing: Specific routing value
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
if param in SKIP_IN_PATH:
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(
"HEAD",
_make_path(index, doc_type, id, "_source"),
params=params,
headers=headers,
"HEAD", path, params=params, headers=headers
)
@query_params(
@@ -874,7 +876,7 @@ class AsyncElasticsearch(object):
queries in the query string query should be analyzed (default: false)
:arg analyzer: The analyzer for the query string query
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The default field for query string query (default:
_all)
:arg lenient: Specify whether format-based query failures (such
@@ -918,8 +920,8 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg fields: A comma-separated list of field names
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
@@ -967,7 +969,7 @@ class AsyncElasticsearch(object):
:arg stored_fields: A comma-separated list of stored fields to
return in the response
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
@@ -1031,7 +1033,7 @@ class AsyncElasticsearch(object):
performing the operation
:arg routing: Specific routing value
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
@@ -1116,13 +1118,13 @@ class AsyncElasticsearch(object):
as default
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute
:arg max_concurrent_shard_requests: The number of concurrent
shard requests each sub search executes concurrently per node. This
value should be used to limit the impact of the search on the cluster in
order to limit the number of concurrent shard requests Default: 5
order to limit the number of concurrent shard requests Default: 5
:arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the
@@ -1132,7 +1134,7 @@ class AsyncElasticsearch(object):
shard bounds and the query are disjoint.
: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 search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names
@@ -1172,12 +1174,12 @@ class AsyncElasticsearch(object):
as default
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute
: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 search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names
@@ -1224,7 +1226,7 @@ class AsyncElasticsearch(object):
:arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be
returned. Applies to all returned documents unless otherwise specified
in body "params" or "docs". Default: True
in body "params" or "docs". Default: True
:arg fields: A comma-separated list of fields to return. Applies
to all returned documents unless otherwise specified in body "params" or
"docs".
@@ -1232,13 +1234,13 @@ class AsyncElasticsearch(object):
define ids as parameter or set "ids" or "docs" in the request body
:arg offsets: Specifies if term offsets should be returned.
Applies to all returned documents unless otherwise specified in body
"params" or "docs". Default: True
"params" or "docs". Default: True
:arg payloads: Specifies if term payloads should be returned.
Applies to all returned documents unless otherwise specified in body
"params" or "docs". Default: True
"params" or "docs". Default: True
:arg positions: Specifies if term positions should be returned.
Applies to all returned documents unless otherwise specified in body
"params" or "docs". Default: True
"params" or "docs". Default: True
:arg preference: Specify the node or shard the operation should
be performed on (default: random) .Applies to all returned documents
unless otherwise specified in body "params" or "docs".
@@ -1250,7 +1252,7 @@ class AsyncElasticsearch(object):
document frequency should be returned. Applies to all returned documents
unless otherwise specified in body "params" or "docs".
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
if doc_type in SKIP_IN_PATH:
@@ -1303,11 +1305,11 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
"""
if body in SKIP_IN_PATH:
@@ -1349,16 +1351,16 @@ class AsyncElasticsearch(object):
Default: 5m
:arg slices: The number of slices this task should be divided
into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be
set to `auto`. Default: 1
set to `auto`. Default: 1
:arg timeout: Time each individual bulk request should wait for
shards that are unavailable. Default: 1m
shards that are unavailable. Default: 1m
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the reindex operation.
Defaults to 1, meaning the primary shard only. Set to `all` for all
shard copies, otherwise set to any non-negative value less than or equal
to the total number of copies for the shard (number of replicas + 1)
:arg wait_for_completion: Should the request should block until
the reindex is complete. Default: True
the reindex is complete. Default: True
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
@@ -1513,7 +1515,7 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg allow_partial_search_results: Indicate if an error should
be returned if there is a partial search failure or timeout Default:
be returned if there is a partial search failure or timeout Default:
True
:arg analyze_wildcard: Specify whether wildcard and prefix
queries should be analyzed (default: false)
@@ -1525,16 +1527,16 @@ class AsyncElasticsearch(object):
Default: 512
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg docvalue_fields: A comma-separated list of fields to return
as the docvalue representation of a field for each hit
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information
about score computation as part of a hit
:arg from_: Starting offset (default: 0)
@@ -1547,7 +1549,7 @@ class AsyncElasticsearch(object):
:arg max_concurrent_shard_requests: The number of concurrent
shard requests per node this search executes concurrently. This value
should be used to limit the impact of the search on the cluster in order
to limit the number of concurrent shard requests Default: 5
to limit the number of concurrent shard requests Default: 5
:arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the
@@ -1565,7 +1567,7 @@ class AsyncElasticsearch(object):
:arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg seq_no_primary_term: Specify whether to return sequence
number and primary term of the last modification of each hit
@@ -1576,8 +1578,8 @@ class AsyncElasticsearch(object):
:arg stored_fields: A comma-separated list of stored fields to
return as part of a hit
:arg suggest_field: Specify which field to use for suggestions
:arg suggest_mode: Specify suggest mode Valid choices:
missing, popular, always Default: missing
:arg suggest_mode: Specify suggest mode Valid choices: missing,
popular, always Default: missing
:arg suggest_size: How many suggestions to return in response
:arg suggest_text: The source text for which the suggestions
should be returned
@@ -1626,8 +1628,8 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg local: Return local information, do not retrieve the state
@@ -1672,10 +1674,10 @@ class AsyncElasticsearch(object):
string or when no indices have been specified)
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information
about score computation as part of a hit
:arg ignore_throttled: Whether specified concrete, expanded or
@@ -1690,7 +1692,7 @@ class AsyncElasticsearch(object):
:arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names
@@ -1736,7 +1738,7 @@ class AsyncElasticsearch(object):
should be supplied.
:arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be
returned. Default: True
returned. Default: True
:arg fields: A comma-separated list of fields to return.
:arg offsets: Specifies if term offsets should be returned.
Default: True
@@ -1752,7 +1754,7 @@ class AsyncElasticsearch(object):
:arg term_statistics: Specifies if total term frequency and
document frequency should be returned.
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
if index in SKIP_IN_PATH:
@@ -1806,7 +1808,7 @@ class AsyncElasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg retry_on_conflict: Specify how many times should the
operation be retried when a conflict occurs (default: 0)
:arg routing: Specific routing value
@@ -1893,14 +1895,14 @@ class AsyncElasticsearch(object):
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the update by query hits version
conflicts? Valid choices: abort, proceed Default: abort
conflicts? Valid choices: abort, proceed Default: abort
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
@@ -1922,15 +1924,15 @@ class AsyncElasticsearch(object):
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the update
by query Default: 100
by query Default: 100
:arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout.
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided
into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be
set to `auto`. Default: 1
set to `auto`. Default: 1
:arg sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and
statistical purposes
@@ -1938,7 +1940,7 @@ class AsyncElasticsearch(object):
for each shard, upon reaching which the query execution will terminate
early.
:arg timeout: Time each individual bulk request should wait for
shards that are unavailable. Default: 1m
shards that are unavailable. Default: 1m
:arg version: Specify whether to return document version as part
of a hit
:arg version_type: Should the document increment the version
@@ -1950,7 +1952,7 @@ class AsyncElasticsearch(object):
or equal to the total number of copies for the shard (number of replicas
+ 1)
:arg wait_for_completion: Should the request should block until
the update by query operation is complete. Default: True
the update by query operation is complete. Default: True
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
+3 -4
View File
@@ -1276,7 +1276,7 @@ class IndicesClient(NamespacedClient):
)
@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
`<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 body: The data stream definition
"""
for param in (name, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return await self.transport.perform_request(
"PUT",
+6 -1
View File
@@ -318,7 +318,7 @@ class MlClient(NamespacedClient):
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):
"""
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 expires_in: The time interval after which the forecast
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:
raise ValueError("Empty value passed for a required argument 'job_id'.")
@@ -1396,6 +1398,7 @@ class MlClient(NamespacedClient):
@query_params(
"allow_no_match",
"decompress_definition",
"for_export",
"from_",
"include_model_definition",
"size",
@@ -1413,6 +1416,8 @@ class MlClient(NamespacedClient):
:arg decompress_definition: Should the model definition be
decompressed into valid JSON or returned in a custom compressed format.
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 include_model_definition: Should the full model definition
be included in the results. These definitions can be large. So be
+2 -1
View File
@@ -87,7 +87,8 @@ class SnapshotClient(NamespacedClient):
Deletes a repository.
`<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
to master node
:arg timeout: Explicit operation timeout
+76 -74
View File
@@ -293,11 +293,11 @@ class Elasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults
@@ -347,17 +347,17 @@ class Elasticsearch(object):
number
:arg op_type: Explicit operation type. Defaults to `index` for
requests with an explicit document ID, and to `create`for requests
without an explicit document ID Valid choices: index, create
without an explicit document ID Valid choices: index, create
:arg pipeline: The pipeline id to preprocess incoming documents
with
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults
@@ -412,7 +412,7 @@ class Elasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Sets the number of shard copies
@@ -488,12 +488,12 @@ class Elasticsearch(object):
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_throttled: Whether specified concrete, expanded or
aliased indices should be ignored when throttled
:arg ignore_unavailable: Whether specified concrete indices
@@ -544,11 +544,11 @@ class Elasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the delete operation.
@@ -625,14 +625,14 @@ class Elasticsearch(object):
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the delete by query hits version
conflicts? Valid choices: abort, proceed Default: abort
conflicts? Valid choices: abort, proceed Default: abort
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
@@ -652,15 +652,15 @@ class Elasticsearch(object):
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the delete
by query Default: 100
by query Default: 100
:arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout.
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided
into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be
set to `auto`. Default: 1
set to `auto`. Default: 1
:arg sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and
statistical purposes
@@ -668,7 +668,7 @@ class Elasticsearch(object):
for each shard, upon reaching which the query execution will terminate
early.
:arg timeout: Time each individual bulk request should wait for
shards that are unavailable. Default: 1m
shards that are unavailable. Default: 1m
:arg version: Specify whether to return document version as part
of a hit
:arg wait_for_active_shards: Sets the number of shard copies
@@ -678,7 +678,7 @@ class Elasticsearch(object):
or equal to the total number of copies for the shard (number of replicas
+ 1)
:arg wait_for_completion: Should the request should block until
the delete by query is complete. Default: True
the delete by query is complete. Default: True
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
@@ -771,7 +771,7 @@ class Elasticsearch(object):
:arg stored_fields: A comma-separated list of stored fields to
return in the response
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
@@ -819,18 +819,20 @@ class Elasticsearch(object):
performing the operation
:arg routing: Specific routing value
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
if param in SKIP_IN_PATH:
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(
"HEAD",
_make_path(index, doc_type, id, "_source"),
params=params,
headers=headers,
"HEAD", path, params=params, headers=headers
)
@query_params(
@@ -866,7 +868,7 @@ class Elasticsearch(object):
queries in the query string query should be analyzed (default: false)
:arg analyzer: The analyzer for the query string query
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The default field for query string query (default:
_all)
:arg lenient: Specify whether format-based query failures (such
@@ -910,8 +912,8 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg fields: A comma-separated list of field names
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
@@ -959,7 +961,7 @@ class Elasticsearch(object):
:arg stored_fields: A comma-separated list of stored fields to
return in the response
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
@@ -1023,7 +1025,7 @@ class Elasticsearch(object):
performing the operation
:arg routing: Specific routing value
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
for param in (index, id):
@@ -1108,13 +1110,13 @@ class Elasticsearch(object):
as default
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute
:arg max_concurrent_shard_requests: The number of concurrent
shard requests each sub search executes concurrently per node. This
value should be used to limit the impact of the search on the cluster in
order to limit the number of concurrent shard requests Default: 5
order to limit the number of concurrent shard requests Default: 5
:arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the
@@ -1124,7 +1126,7 @@ class Elasticsearch(object):
shard bounds and the query are disjoint.
: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 search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names
@@ -1164,12 +1166,12 @@ class Elasticsearch(object):
as default
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute
: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 search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names
@@ -1216,7 +1218,7 @@ class Elasticsearch(object):
:arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be
returned. Applies to all returned documents unless otherwise specified
in body "params" or "docs". Default: True
in body "params" or "docs". Default: True
:arg fields: A comma-separated list of fields to return. Applies
to all returned documents unless otherwise specified in body "params" or
"docs".
@@ -1224,13 +1226,13 @@ class Elasticsearch(object):
define ids as parameter or set "ids" or "docs" in the request body
:arg offsets: Specifies if term offsets should be returned.
Applies to all returned documents unless otherwise specified in body
"params" or "docs". Default: True
"params" or "docs". Default: True
:arg payloads: Specifies if term payloads should be returned.
Applies to all returned documents unless otherwise specified in body
"params" or "docs". Default: True
"params" or "docs". Default: True
:arg positions: Specifies if term positions should be returned.
Applies to all returned documents unless otherwise specified in body
"params" or "docs". Default: True
"params" or "docs". Default: True
:arg preference: Specify the node or shard the operation should
be performed on (default: random) .Applies to all returned documents
unless otherwise specified in body "params" or "docs".
@@ -1242,7 +1244,7 @@ class Elasticsearch(object):
document frequency should be returned. Applies to all returned documents
unless otherwise specified in body "params" or "docs".
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
if doc_type in SKIP_IN_PATH:
@@ -1295,11 +1297,11 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
"""
if body in SKIP_IN_PATH:
@@ -1341,16 +1343,16 @@ class Elasticsearch(object):
Default: 5m
:arg slices: The number of slices this task should be divided
into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be
set to `auto`. Default: 1
set to `auto`. Default: 1
:arg timeout: Time each individual bulk request should wait for
shards that are unavailable. Default: 1m
shards that are unavailable. Default: 1m
:arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the reindex operation.
Defaults to 1, meaning the primary shard only. Set to `all` for all
shard copies, otherwise set to any non-negative value less than or equal
to the total number of copies for the shard (number of replicas + 1)
:arg wait_for_completion: Should the request should block until
the reindex is complete. Default: True
the reindex is complete. Default: True
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
@@ -1501,7 +1503,7 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg allow_partial_search_results: Indicate if an error should
be returned if there is a partial search failure or timeout Default:
be returned if there is a partial search failure or timeout Default:
True
:arg analyze_wildcard: Specify whether wildcard and prefix
queries should be analyzed (default: false)
@@ -1513,16 +1515,16 @@ class Elasticsearch(object):
Default: 512
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg docvalue_fields: A comma-separated list of fields to return
as the docvalue representation of a field for each hit
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information
about score computation as part of a hit
:arg from_: Starting offset (default: 0)
@@ -1535,7 +1537,7 @@ class Elasticsearch(object):
:arg max_concurrent_shard_requests: The number of concurrent
shard requests per node this search executes concurrently. This value
should be used to limit the impact of the search on the cluster in order
to limit the number of concurrent shard requests Default: 5
to limit the number of concurrent shard requests Default: 5
:arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the
@@ -1553,7 +1555,7 @@ class Elasticsearch(object):
:arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg seq_no_primary_term: Specify whether to return sequence
number and primary term of the last modification of each hit
@@ -1564,8 +1566,8 @@ class Elasticsearch(object):
:arg stored_fields: A comma-separated list of stored fields to
return as part of a hit
:arg suggest_field: Specify which field to use for suggestions
:arg suggest_mode: Specify suggest mode Valid choices:
missing, popular, always Default: missing
:arg suggest_mode: Specify suggest mode Valid choices: missing,
popular, always Default: missing
:arg suggest_size: How many suggestions to return in response
:arg suggest_text: The source text for which the suggestions
should be returned
@@ -1614,8 +1616,8 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg local: Return local information, do not retrieve the state
@@ -1660,10 +1662,10 @@ class Elasticsearch(object):
string or when no indices have been specified)
:arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests
execution Default: true
execution Default: true
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information
about score computation as part of a hit
:arg ignore_throttled: Whether specified concrete, expanded or
@@ -1678,7 +1680,7 @@ class Elasticsearch(object):
:arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names
@@ -1724,7 +1726,7 @@ class Elasticsearch(object):
should be supplied.
:arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be
returned. Default: True
returned. Default: True
:arg fields: A comma-separated list of fields to return.
:arg offsets: Specifies if term offsets should be returned.
Default: True
@@ -1740,7 +1742,7 @@ class Elasticsearch(object):
:arg term_statistics: Specifies if total term frequency and
document frequency should be returned.
:arg version: Explicit version number for concurrency control
:arg version_type: Specific version type Valid choices:
:arg version_type: Specific version type Valid choices:
internal, external, external_gte, force
"""
if index in SKIP_IN_PATH:
@@ -1794,7 +1796,7 @@ class Elasticsearch(object):
: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
do nothing with refreshes. Valid choices: true, false, wait_for
do nothing with refreshes. Valid choices: true, false, wait_for
:arg retry_on_conflict: Specify how many times should the
operation be retried when a conflict occurs (default: 0)
:arg routing: Specific routing value
@@ -1881,14 +1883,14 @@ class Elasticsearch(object):
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the update by query hits version
conflicts? Valid choices: abort, proceed Default: abort
conflicts? Valid choices: abort, proceed Default: abort
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
@@ -1910,15 +1912,15 @@ class Elasticsearch(object):
:arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the update
by query Default: 100
by query Default: 100
:arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout.
:arg search_type: Search operation type Valid choices:
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided
into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be
set to `auto`. Default: 1
set to `auto`. Default: 1
:arg sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and
statistical purposes
@@ -1926,7 +1928,7 @@ class Elasticsearch(object):
for each shard, upon reaching which the query execution will terminate
early.
:arg timeout: Time each individual bulk request should wait for
shards that are unavailable. Default: 1m
shards that are unavailable. Default: 1m
:arg version: Specify whether to return document version as part
of a hit
:arg version_type: Should the document increment the version
@@ -1938,7 +1940,7 @@ class Elasticsearch(object):
or equal to the total number of copies for the shard (number of replicas
+ 1)
:arg wait_for_completion: Should the request should block until
the update by query operation is complete. Default: True
the update by query operation is complete. Default: True
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
+3 -4
View File
@@ -1272,7 +1272,7 @@ class IndicesClient(NamespacedClient):
)
@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
`<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 body: The data stream definition
"""
for param in (name, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return self.transport.perform_request(
"PUT",
+6 -1
View File
@@ -312,7 +312,7 @@ class MlClient(NamespacedClient):
body=body,
)
@query_params("duration", "expires_in")
@query_params("duration", "expires_in", "max_model_memory")
def forecast(self, job_id, params=None, headers=None):
"""
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 expires_in: The time interval after which the forecast
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:
raise ValueError("Empty value passed for a required argument 'job_id'.")
@@ -1384,6 +1386,7 @@ class MlClient(NamespacedClient):
@query_params(
"allow_no_match",
"decompress_definition",
"for_export",
"from_",
"include_model_definition",
"size",
@@ -1401,6 +1404,8 @@ class MlClient(NamespacedClient):
:arg decompress_definition: Should the model definition be
decompressed into valid JSON or returned in a custom compressed format.
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 include_model_definition: Should the full model definition
be included in the results. These definitions can be large. So be
+2 -1
View File
@@ -87,7 +87,8 @@ class SnapshotClient(NamespacedClient):
Deletes a repository.
`<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
to master node
: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 %}