[7.x] Backport overrides for typeless APIs

This commit is contained in:
Seth Michael Larson
2020-05-26 08:23:21 -05:00
committed by Seth Michael Larson
parent a3e103b00e
commit 1773bd17be
13 changed files with 408 additions and 224 deletions
+96 -104
View File
@@ -292,11 +292,11 @@ class AsyncElasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults that must be active before proceeding with the index operation. Defaults
@@ -309,14 +309,12 @@ class AsyncElasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_create", id)
else:
path = _make_path(index, doc_type, id, "_create")
return await self.transport.perform_request( return await self.transport.perform_request(
"PUT", "PUT", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_create"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -350,17 +348,17 @@ class AsyncElasticsearch(object):
number number
:arg op_type: Explicit operation type. Defaults to `index` for :arg op_type: Explicit operation type. Defaults to `index` for
requests with an explicit document ID, and to `create`for requests 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 :arg pipeline: The pipeline id to preprocess incoming documents
with with
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults that must be active before proceeding with the index operation. Defaults
@@ -415,7 +413,7 @@ class AsyncElasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
@@ -493,12 +491,12 @@ class AsyncElasticsearch(object):
queries should be analyzed (default: false) queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string :arg analyzer: The analyzer to use for the query string
:arg default_operator: The default operator for 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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg ignore_throttled: Whether specified concrete, expanded or :arg ignore_throttled: Whether specified concrete, expanded or
aliased indices should be ignored when throttled aliased indices should be ignored when throttled
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
@@ -549,11 +547,11 @@ class AsyncElasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the delete operation. that must be active before proceeding with the delete operation.
@@ -632,14 +630,14 @@ class AsyncElasticsearch(object):
queries should be analyzed (default: false) queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string :arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the delete by query hits version :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 :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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0) :arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
@@ -659,15 +657,15 @@ class AsyncElasticsearch(object):
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the delete :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. :arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout. 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 query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead :arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided :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 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 sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and :arg stats: Specific 'tag' of the request for logging and
statistical purposes statistical purposes
@@ -675,7 +673,7 @@ class AsyncElasticsearch(object):
for each shard, upon reaching which the query execution will terminate for each shard, upon reaching which the query execution will terminate
early. early.
:arg timeout: Time each individual bulk request should wait for :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 :arg version: Specify whether to return document version as part
of a hit of a hit
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
@@ -685,7 +683,7 @@ class AsyncElasticsearch(object):
or equal to the total number of copies for the shard (number of replicas or equal to the total number of copies for the shard (number of replicas
+ 1) + 1)
:arg wait_for_completion: Should the request should block until :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 # from is a reserved word so it cannot be used, use from_ instead
if "from_" in params: if "from_" in params:
@@ -778,7 +776,7 @@ 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 in the response return in the response
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -826,7 +824,7 @@ class AsyncElasticsearch(object):
performing the operation performing the operation
:arg routing: Specific routing value :arg routing: Specific routing value
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -875,7 +873,7 @@ class AsyncElasticsearch(object):
queries in the query string query should be analyzed (default: false) queries in the query string query should be analyzed (default: false)
:arg analyzer: The analyzer for the query string query :arg analyzer: The analyzer for the query string query
:arg default_operator: The default operator for 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 default field for query string query (default: :arg df: The default field for query string query (default:
_all) _all)
:arg lenient: Specify whether format-based query failures (such :arg lenient: Specify whether format-based query failures (such
@@ -892,14 +890,12 @@ class AsyncElasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_explain", id)
else:
path = _make_path(index, doc_type, id, "_explain")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_explain"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -921,8 +917,8 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg fields: A comma-separated list of field names :arg fields: A comma-separated list of field names
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
@@ -970,7 +966,7 @@ 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 in the response return in the response
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -1034,7 +1030,7 @@ class AsyncElasticsearch(object):
performing the operation performing the operation
:arg routing: Specific routing value :arg routing: Specific routing value
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -1042,13 +1038,12 @@ class AsyncElasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" 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(
"GET", "GET", path, params=params, headers=headers
_make_path(index, doc_type, id, "_source"),
params=params,
headers=headers,
) )
@query_params( @query_params(
@@ -1120,13 +1115,13 @@ class AsyncElasticsearch(object):
as default as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute concurrent searches the multi search api will execute
:arg max_concurrent_shard_requests: The number of concurrent :arg max_concurrent_shard_requests: The number of concurrent
shard requests each sub search executes concurrently per node. This 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 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- :arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the the number of shards the search request expands to exceeds the
@@ -1136,7 +1131,7 @@ class AsyncElasticsearch(object):
shard bounds and the query are disjoint. shard bounds and the query are disjoint.
:arg rest_total_hits_as_int: Indicates whether hits.total should :arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response 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, query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names :arg typed_keys: Specify whether aggregation and suggester names
@@ -1176,12 +1171,12 @@ class AsyncElasticsearch(object):
as default as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute concurrent searches the multi search api will execute
:arg rest_total_hits_as_int: Indicates whether hits.total should :arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response 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, query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names :arg typed_keys: Specify whether aggregation and suggester names
@@ -1228,7 +1223,7 @@ class AsyncElasticsearch(object):
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be document frequencies and sum of total term frequencies should be
returned. Applies to all returned documents unless otherwise specified 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 :arg fields: A comma-separated list of fields to return. Applies
to all returned documents unless otherwise specified in body "params" or to all returned documents unless otherwise specified in body "params" or
"docs". "docs".
@@ -1236,13 +1231,13 @@ class AsyncElasticsearch(object):
define ids as parameter or set "ids" or "docs" in the request body define ids as parameter or set "ids" or "docs" in the request body
:arg offsets: Specifies if term offsets should be returned. :arg offsets: Specifies if term offsets should be returned.
Applies to all returned documents unless otherwise specified in body 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. :arg payloads: Specifies if term payloads should be returned.
Applies to all returned documents unless otherwise specified in body 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. :arg positions: Specifies if term positions should be returned.
Applies to all returned documents unless otherwise specified in body 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 :arg preference: Specify the node or shard the operation should
be performed on (default: random) .Applies to all returned documents be performed on (default: random) .Applies to all returned documents
unless otherwise specified in body "params" or "docs". unless otherwise specified in body "params" or "docs".
@@ -1254,15 +1249,16 @@ class AsyncElasticsearch(object):
document frequency should be returned. Applies to all returned documents document frequency should be returned. Applies to all returned documents
unless otherwise specified in body "params" or "docs". unless otherwise specified in body "params" or "docs".
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_mtermvectors")
else:
path = _make_path(index, doc_type, "_mtermvectors")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, "_mtermvectors"),
params=params,
headers=headers,
body=body,
) )
@query_params("master_timeout", "timeout") @query_params("master_timeout", "timeout")
@@ -1306,11 +1302,11 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) 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 query_then_fetch, dfs_query_then_fetch
""" """
if body in SKIP_IN_PATH: if body in SKIP_IN_PATH:
@@ -1352,16 +1348,16 @@ class AsyncElasticsearch(object):
Default: 5m Default: 5m
:arg slices: The number of slices this task should be divided :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 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 :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 :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the reindex operation. that must be active before proceeding with the reindex operation.
Defaults to 1, meaning the primary shard only. Set to `all` for all 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 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) to the total number of copies for the shard (number of replicas + 1)
:arg wait_for_completion: Should the request should block until :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: if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.") raise ValueError("Empty value passed for a required argument 'body'.")
@@ -1516,7 +1512,7 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg allow_partial_search_results: Indicate if an error should :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 True
:arg analyze_wildcard: Specify whether wildcard and prefix :arg analyze_wildcard: Specify whether wildcard and prefix
queries should be analyzed (default: false) queries should be analyzed (default: false)
@@ -1528,16 +1524,16 @@ class AsyncElasticsearch(object):
Default: 512 Default: 512
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg docvalue_fields: A comma-separated list of fields to return :arg docvalue_fields: A comma-separated list of fields to return
as the docvalue representation of a field for each hit as the docvalue representation of a field for each hit
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information :arg explain: Specify whether to return detailed information
about score computation as part of a hit about score computation as part of a hit
:arg from_: Starting offset (default: 0) :arg from_: Starting offset (default: 0)
@@ -1550,7 +1546,7 @@ class AsyncElasticsearch(object):
:arg max_concurrent_shard_requests: The number of concurrent :arg max_concurrent_shard_requests: The number of concurrent
shard requests per node this search executes concurrently. This value 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 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- :arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the the number of shards the search request expands to exceeds the
@@ -1568,7 +1564,7 @@ class AsyncElasticsearch(object):
:arg routing: A comma-separated list of specific routing values :arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search 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 query_then_fetch, dfs_query_then_fetch
:arg seq_no_primary_term: Specify whether to return sequence :arg seq_no_primary_term: Specify whether to return sequence
number and primary term of the last modification of each hit number and primary term of the last modification of each hit
@@ -1579,8 +1575,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: missing, :arg suggest_mode: Specify suggest mode Valid choices:
popular, always Default: missing 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
@@ -1629,8 +1625,8 @@ class AsyncElasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
@@ -1675,10 +1671,10 @@ class AsyncElasticsearch(object):
string or when no indices have been specified) string or when no indices have been specified)
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information :arg explain: Specify whether to return detailed information
about score computation as part of a hit about score computation as part of a hit
:arg ignore_throttled: Whether specified concrete, expanded or :arg ignore_throttled: Whether specified concrete, expanded or
@@ -1693,7 +1689,7 @@ class AsyncElasticsearch(object):
:arg routing: A comma-separated list of specific routing values :arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search 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, query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names :arg typed_keys: Specify whether aggregation and suggester names
@@ -1739,7 +1735,7 @@ class AsyncElasticsearch(object):
should be supplied. should be supplied.
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be 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 fields: A comma-separated list of fields to return.
:arg offsets: Specifies if term offsets should be returned. :arg offsets: Specifies if term offsets should be returned.
Default: True Default: True
@@ -1755,21 +1751,19 @@ class AsyncElasticsearch(object):
:arg term_statistics: Specifies if total term frequency and :arg term_statistics: Specifies if total term frequency and
document frequency should be returned. document frequency should be returned.
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
if index in SKIP_IN_PATH: if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.") raise ValueError("Empty value passed for a required argument 'index'.")
if doc_type in SKIP_IN_PATH: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_termvectors", id)
else:
path = _make_path(index, doc_type, id, "_termvectors")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_termvectors"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -1811,7 +1805,7 @@ class AsyncElasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 :arg retry_on_conflict: Specify how many times should the
operation be retried when a conflict occurs (default: 0) operation be retried when a conflict occurs (default: 0)
:arg routing: Specific routing value :arg routing: Specific routing value
@@ -1827,14 +1821,12 @@ class AsyncElasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_update", id)
else:
path = _make_path(index, doc_type, id, "_update")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_update"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -1900,14 +1892,14 @@ class AsyncElasticsearch(object):
queries should be analyzed (default: false) queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string :arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the update by query hits version :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 :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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0) :arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
@@ -1929,15 +1921,15 @@ class AsyncElasticsearch(object):
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the update :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. :arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout. 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 query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead :arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided :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 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 sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and :arg stats: Specific 'tag' of the request for logging and
statistical purposes statistical purposes
@@ -1945,7 +1937,7 @@ class AsyncElasticsearch(object):
for each shard, upon reaching which the query execution will terminate for each shard, upon reaching which the query execution will terminate
early. early.
:arg timeout: Time each individual bulk request should wait for :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 :arg version: Specify whether to return document version as part
of a hit of a hit
:arg version_type: Should the document increment the version :arg version_type: Should the document increment the version
@@ -1957,7 +1949,7 @@ class AsyncElasticsearch(object):
or equal to the total number of copies for the shard (number of replicas or equal to the total number of copies for the shard (number of replicas
+ 1) + 1)
:arg wait_for_completion: Should the request should block until :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 # from is a reserved word so it cannot be used, use from_ instead
if "from_" in params: if "from_" in params:
+96 -104
View File
@@ -292,11 +292,11 @@ class Elasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults that must be active before proceeding with the index operation. Defaults
@@ -309,14 +309,12 @@ class Elasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_create", id)
else:
path = _make_path(index, doc_type, id, "_create")
return self.transport.perform_request( return self.transport.perform_request(
"PUT", "PUT", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_create"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -348,17 +346,17 @@ class Elasticsearch(object):
number number
:arg op_type: Explicit operation type. Defaults to `index` for :arg op_type: Explicit operation type. Defaults to `index` for
requests with an explicit document ID, and to `create`for requests 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 :arg pipeline: The pipeline id to preprocess incoming documents
with with
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the index operation. Defaults that must be active before proceeding with the index operation. Defaults
@@ -413,7 +411,7 @@ class Elasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
@@ -489,12 +487,12 @@ class Elasticsearch(object):
queries should be analyzed (default: false) queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string :arg analyzer: The analyzer to use for the query string
:arg default_operator: The default operator for 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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg ignore_throttled: Whether specified concrete, expanded or :arg ignore_throttled: Whether specified concrete, expanded or
aliased indices should be ignored when throttled aliased indices should be ignored when throttled
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
@@ -545,11 +543,11 @@ class Elasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 routing: Specific routing value
:arg timeout: Explicit operation timeout :arg timeout: Explicit operation timeout
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the delete operation. that must be active before proceeding with the delete operation.
@@ -626,14 +624,14 @@ class Elasticsearch(object):
queries should be analyzed (default: false) queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string :arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the delete by query hits version :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 :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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0) :arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
@@ -653,15 +651,15 @@ class Elasticsearch(object):
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the delete :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. :arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout. 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 query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead :arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided :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 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 sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and :arg stats: Specific 'tag' of the request for logging and
statistical purposes statistical purposes
@@ -669,7 +667,7 @@ class Elasticsearch(object):
for each shard, upon reaching which the query execution will terminate for each shard, upon reaching which the query execution will terminate
early. early.
:arg timeout: Time each individual bulk request should wait for :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 :arg version: Specify whether to return document version as part
of a hit of a hit
:arg wait_for_active_shards: Sets the number of shard copies :arg wait_for_active_shards: Sets the number of shard copies
@@ -679,7 +677,7 @@ class Elasticsearch(object):
or equal to the total number of copies for the shard (number of replicas or equal to the total number of copies for the shard (number of replicas
+ 1) + 1)
:arg wait_for_completion: Should the request should block until :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 # from is a reserved word so it cannot be used, use from_ instead
if "from_" in params: if "from_" in params:
@@ -772,7 +770,7 @@ 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 in the response return in the response
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -820,7 +818,7 @@ class Elasticsearch(object):
performing the operation performing the operation
:arg routing: Specific routing value :arg routing: Specific routing value
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -867,7 +865,7 @@ class Elasticsearch(object):
queries in the query string query should be analyzed (default: false) queries in the query string query should be analyzed (default: false)
:arg analyzer: The analyzer for the query string query :arg analyzer: The analyzer for the query string query
:arg default_operator: The default operator for 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 default field for query string query (default: :arg df: The default field for query string query (default:
_all) _all)
:arg lenient: Specify whether format-based query failures (such :arg lenient: Specify whether format-based query failures (such
@@ -884,14 +882,12 @@ class Elasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_explain", id)
else:
path = _make_path(index, doc_type, id, "_explain")
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_explain"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -913,8 +909,8 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg fields: A comma-separated list of field names :arg fields: A comma-separated list of field names
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
@@ -962,7 +958,7 @@ 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 in the response return in the response
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -1026,7 +1022,7 @@ class Elasticsearch(object):
performing the operation performing the operation
:arg routing: Specific routing value :arg routing: Specific routing value
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
for param in (index, id): for param in (index, id):
@@ -1034,13 +1030,12 @@ class Elasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" 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(
"GET", "GET", path, params=params, headers=headers
_make_path(index, doc_type, id, "_source"),
params=params,
headers=headers,
) )
@query_params( @query_params(
@@ -1112,13 +1107,13 @@ class Elasticsearch(object):
as default as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute concurrent searches the multi search api will execute
:arg max_concurrent_shard_requests: The number of concurrent :arg max_concurrent_shard_requests: The number of concurrent
shard requests each sub search executes concurrently per node. This 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 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- :arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the the number of shards the search request expands to exceeds the
@@ -1128,7 +1123,7 @@ class Elasticsearch(object):
shard bounds and the query are disjoint. shard bounds and the query are disjoint.
:arg rest_total_hits_as_int: Indicates whether hits.total should :arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response 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, query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names :arg typed_keys: Specify whether aggregation and suggester names
@@ -1168,12 +1163,12 @@ class Elasticsearch(object):
as default as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :arg max_concurrent_searches: Controls the maximum number of
concurrent searches the multi search api will execute concurrent searches the multi search api will execute
:arg rest_total_hits_as_int: Indicates whether hits.total should :arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response 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, query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names :arg typed_keys: Specify whether aggregation and suggester names
@@ -1220,7 +1215,7 @@ class Elasticsearch(object):
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be document frequencies and sum of total term frequencies should be
returned. Applies to all returned documents unless otherwise specified 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 :arg fields: A comma-separated list of fields to return. Applies
to all returned documents unless otherwise specified in body "params" or to all returned documents unless otherwise specified in body "params" or
"docs". "docs".
@@ -1228,13 +1223,13 @@ class Elasticsearch(object):
define ids as parameter or set "ids" or "docs" in the request body define ids as parameter or set "ids" or "docs" in the request body
:arg offsets: Specifies if term offsets should be returned. :arg offsets: Specifies if term offsets should be returned.
Applies to all returned documents unless otherwise specified in body 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. :arg payloads: Specifies if term payloads should be returned.
Applies to all returned documents unless otherwise specified in body 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. :arg positions: Specifies if term positions should be returned.
Applies to all returned documents unless otherwise specified in body 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 :arg preference: Specify the node or shard the operation should
be performed on (default: random) .Applies to all returned documents be performed on (default: random) .Applies to all returned documents
unless otherwise specified in body "params" or "docs". unless otherwise specified in body "params" or "docs".
@@ -1246,15 +1241,16 @@ class Elasticsearch(object):
document frequency should be returned. Applies to all returned documents document frequency should be returned. Applies to all returned documents
unless otherwise specified in body "params" or "docs". unless otherwise specified in body "params" or "docs".
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_mtermvectors")
else:
path = _make_path(index, doc_type, "_mtermvectors")
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, "_mtermvectors"),
params=params,
headers=headers,
body=body,
) )
@query_params("master_timeout", "timeout") @query_params("master_timeout", "timeout")
@@ -1298,11 +1294,11 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) 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 query_then_fetch, dfs_query_then_fetch
""" """
if body in SKIP_IN_PATH: if body in SKIP_IN_PATH:
@@ -1344,16 +1340,16 @@ class Elasticsearch(object):
Default: 5m Default: 5m
:arg slices: The number of slices this task should be divided :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 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 :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 :arg wait_for_active_shards: Sets the number of shard copies
that must be active before proceeding with the reindex operation. that must be active before proceeding with the reindex operation.
Defaults to 1, meaning the primary shard only. Set to `all` for all 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 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) to the total number of copies for the shard (number of replicas + 1)
:arg wait_for_completion: Should the request should block until :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: if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.") raise ValueError("Empty value passed for a required argument 'body'.")
@@ -1504,7 +1500,7 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg allow_partial_search_results: Indicate if an error should :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 True
:arg analyze_wildcard: Specify whether wildcard and prefix :arg analyze_wildcard: Specify whether wildcard and prefix
queries should be analyzed (default: false) queries should be analyzed (default: false)
@@ -1516,16 +1512,16 @@ class Elasticsearch(object):
Default: 512 Default: 512
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg docvalue_fields: A comma-separated list of fields to return :arg docvalue_fields: A comma-separated list of fields to return
as the docvalue representation of a field for each hit as the docvalue representation of a field for each hit
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information :arg explain: Specify whether to return detailed information
about score computation as part of a hit about score computation as part of a hit
:arg from_: Starting offset (default: 0) :arg from_: Starting offset (default: 0)
@@ -1538,7 +1534,7 @@ class Elasticsearch(object):
:arg max_concurrent_shard_requests: The number of concurrent :arg max_concurrent_shard_requests: The number of concurrent
shard requests per node this search executes concurrently. This value 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 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- :arg pre_filter_shard_size: A threshold that enforces a pre-
filter roundtrip to prefilter search shards based on query rewriting if filter roundtrip to prefilter search shards based on query rewriting if
the number of shards the search request expands to exceeds the the number of shards the search request expands to exceeds the
@@ -1556,7 +1552,7 @@ class Elasticsearch(object):
:arg routing: A comma-separated list of specific routing values :arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search 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 query_then_fetch, dfs_query_then_fetch
:arg seq_no_primary_term: Specify whether to return sequence :arg seq_no_primary_term: Specify whether to return sequence
number and primary term of the last modification of each hit number and primary term of the last modification of each hit
@@ -1567,8 +1563,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: missing, :arg suggest_mode: Specify suggest mode Valid choices:
popular, always Default: missing 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
@@ -1617,8 +1613,8 @@ class Elasticsearch(object):
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
@@ -1663,10 +1659,10 @@ class Elasticsearch(object):
string or when no indices have been specified) string or when no indices have been specified)
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests 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 :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg explain: Specify whether to return detailed information :arg explain: Specify whether to return detailed information
about score computation as part of a hit about score computation as part of a hit
:arg ignore_throttled: Whether specified concrete, expanded or :arg ignore_throttled: Whether specified concrete, expanded or
@@ -1681,7 +1677,7 @@ class Elasticsearch(object):
:arg routing: A comma-separated list of specific routing values :arg routing: A comma-separated list of specific routing values
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search 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, query_then_fetch, query_and_fetch, dfs_query_then_fetch,
dfs_query_and_fetch dfs_query_and_fetch
:arg typed_keys: Specify whether aggregation and suggester names :arg typed_keys: Specify whether aggregation and suggester names
@@ -1727,7 +1723,7 @@ class Elasticsearch(object):
should be supplied. should be supplied.
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be 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 fields: A comma-separated list of fields to return.
:arg offsets: Specifies if term offsets should be returned. :arg offsets: Specifies if term offsets should be returned.
Default: True Default: True
@@ -1743,21 +1739,19 @@ class Elasticsearch(object):
:arg term_statistics: Specifies if total term frequency and :arg term_statistics: Specifies if total term frequency and
document frequency should be returned. document frequency should be returned.
:arg version: Explicit version number for concurrency control :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 internal, external, external_gte, force
""" """
if index in SKIP_IN_PATH: if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.") raise ValueError("Empty value passed for a required argument 'index'.")
if doc_type in SKIP_IN_PATH: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_termvectors", id)
else:
path = _make_path(index, doc_type, id, "_termvectors")
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_termvectors"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -1799,7 +1793,7 @@ class Elasticsearch(object):
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh 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 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 :arg retry_on_conflict: Specify how many times should the
operation be retried when a conflict occurs (default: 0) operation be retried when a conflict occurs (default: 0)
:arg routing: Specific routing value :arg routing: Specific routing value
@@ -1815,14 +1809,12 @@ class Elasticsearch(object):
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: if doc_type in SKIP_IN_PATH:
doc_type = "_doc" path = _make_path(index, "_update", id)
else:
path = _make_path(index, doc_type, id, "_update")
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST", path, params=params, headers=headers, body=body
_make_path(index, doc_type, id, "_update"),
params=params,
headers=headers,
body=body,
) )
@query_params( @query_params(
@@ -1888,14 +1880,14 @@ class Elasticsearch(object):
queries should be analyzed (default: false) queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string :arg analyzer: The analyzer to use for the query string
:arg conflicts: What to do when the update by query hits version :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 :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 :arg df: The field to use as default where no field prefix is
given in the query string given in the query string
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open closed, hidden, none, all Default: open
:arg from_: Starting offset (default: 0) :arg from_: Starting offset (default: 0)
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed)
@@ -1917,15 +1909,15 @@ class Elasticsearch(object):
:arg scroll: Specify how long a consistent view of the index :arg scroll: Specify how long a consistent view of the index
should be maintained for scrolled search should be maintained for scrolled search
:arg scroll_size: Size on the scroll request powering the update :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. :arg search_timeout: Explicit timeout for each search request.
Defaults to no timeout. 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 query_then_fetch, dfs_query_then_fetch
:arg size: Deprecated, please use `max_docs` instead :arg size: Deprecated, please use `max_docs` instead
:arg slices: The number of slices this task should be divided :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 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 sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and :arg stats: Specific 'tag' of the request for logging and
statistical purposes statistical purposes
@@ -1933,7 +1925,7 @@ class Elasticsearch(object):
for each shard, upon reaching which the query execution will terminate for each shard, upon reaching which the query execution will terminate
early. early.
:arg timeout: Time each individual bulk request should wait for :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 :arg version: Specify whether to return document version as part
of a hit of a hit
:arg version_type: Should the document increment the version :arg version_type: Should the document increment the version
@@ -1945,7 +1937,7 @@ class Elasticsearch(object):
or equal to the total number of copies for the shard (number of replicas or equal to the total number of copies for the shard (number of replicas
+ 1) + 1)
:arg wait_for_completion: Should the request should block until :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 # from is a reserved word so it cannot be used, use from_ instead
if "from_" in params: if "from_" in params:
@@ -0,0 +1,141 @@
# -*- coding: utf-8 -*-
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
import pytest
from test_elasticsearch.test_cases import ElasticsearchTestCase
class TestOverriddenUrlTargets(ElasticsearchTestCase):
def test_create(self):
self.client.create(index="test-index", id="test-id", body={})
self.assert_url_called("PUT", "/test-index/_create/test-id")
self.client.create(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("PUT", "/test-index/test-type/test-id/_create")
def test_delete(self):
self.client.delete(index="test-index", id="test-id")
self.assert_url_called("DELETE", "/test-index/_doc/test-id")
self.client.delete(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("DELETE", "/test-index/test-type/test-id")
def test_exists(self):
self.client.exists(index="test-index", id="test-id")
self.assert_url_called("HEAD", "/test-index/_doc/test-id")
self.client.exists(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("HEAD", "/test-index/test-type/test-id")
def test_explain(self):
self.client.explain(index="test-index", id="test-id")
self.assert_url_called("POST", "/test-index/_explain/test-id")
self.client.explain(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("POST", "/test-index/test-type/test-id/_explain")
def test_get(self):
self.client.get(index="test-index", id="test-id")
self.assert_url_called("GET", "/test-index/_doc/test-id")
self.client.get(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("GET", "/test-index/test-type/test-id")
def test_get_source(self):
self.client.get_source(index="test-index", id="test-id")
self.assert_url_called("GET", "/test-index/_source/test-id")
self.client.get_source(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("GET", "/test-index/test-type/test-id/_source")
def test_index(self):
self.client.index(index="test-index", body={})
self.assert_url_called("POST", "/test-index/_doc")
self.client.index(index="test-index", id="test-id", body={})
self.assert_url_called("PUT", "/test-index/_doc/test-id")
self.client.index(index="test-index", doc_type="test-type", body={})
self.assert_url_called("POST", "/test-index/test-type")
self.client.index(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("PUT", "/test-index/test-type/test-id")
self.client.index(index="test-index", doc_type="_doc", body={})
self.assert_url_called("POST", "/test-index/_doc", count=2)
self.client.index(index="test-index", doc_type="_doc", id="test-id", body={})
self.assert_url_called("PUT", "/test-index/_doc/test-id", count=2)
def test_termvectors(self):
self.client.termvectors(index="test-index", body={})
self.assert_url_called("POST", "/test-index/_termvectors")
self.client.termvectors(index="test-index", id="test-id", body={})
self.assert_url_called("POST", "/test-index/_termvectors/test-id")
self.client.termvectors(index="test-index", doc_type="test-type", body={})
self.assert_url_called("POST", "/test-index/test-type/_termvectors")
self.client.termvectors(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("POST", "/test-index/test-type/test-id/_termvectors")
def test_mtermvectors(self):
self.client.mtermvectors(index="test-index", body={})
self.assert_url_called("POST", "/test-index/_mtermvectors")
self.client.mtermvectors(index="test-index", doc_type="test-type", body={})
self.assert_url_called("POST", "/test-index/test-type/_mtermvectors")
def test_update(self):
self.client.update(index="test-index", id="test-id", body={})
self.assert_url_called("POST", "/test-index/_update/test-id")
self.client.update(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("POST", "/test-index/test-type/test-id/_update")
def test_cluster_state(self):
self.client.cluster.state()
self.assert_url_called("GET", "/_cluster/state")
self.client.cluster.state(index="test-index")
self.assert_url_called("GET", "/_cluster/state/_all/test-index")
self.client.cluster.state(index="test-index", metric="test-metric")
self.assert_url_called("GET", "/_cluster/state/test-metric/test-index")
def test_cluster_stats(self):
self.client.cluster.stats()
self.assert_url_called("GET", "/_cluster/stats")
self.client.cluster.stats(node_id="test-node")
self.assert_url_called("GET", "/_cluster/stats/nodes/test-node")
def test_indices_put_mapping(self):
self.client.indices.put_mapping(body={})
self.assert_url_called("PUT", "/_mapping")
self.client.indices.put_mapping(index="test-index", body={})
self.assert_url_called("PUT", "/test-index/_mapping")
self.client.indices.put_mapping(
index="test-index", doc_type="test-type", body={}
)
self.assert_url_called("PUT", "/test-index/test-type/_mapping")
self.client.indices.put_mapping(doc_type="test-type", body={})
self.assert_url_called("PUT", "/_all/test-type/_mapping")
def test_tasks_get(self):
with pytest.warns(DeprecationWarning):
self.client.tasks.get()
@@ -1 +0,0 @@
single_doc_op
@@ -0,0 +1,9 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_create", id)
else:
path = _make_path(index, doc_type, id, "_create")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %}
@@ -1 +0,0 @@
single_doc_op
@@ -0,0 +1,7 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
doc_type = "_doc"
{{ super()|trim }}
{% endblock %}
@@ -1 +0,0 @@
single_doc_op
@@ -0,0 +1,7 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
doc_type = "_doc"
{{ super()|trim }}
{% endblock %}
@@ -1 +0,0 @@
single_doc_op
@@ -0,0 +1,9 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_explain", id)
else:
path = _make_path(index, doc_type, id, "_explain")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %}
-1
View File
@@ -1 +0,0 @@
single_doc_op
+7
View File
@@ -0,0 +1,7 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
doc_type = "_doc"
{{ super()|trim }}
{% endblock %}
@@ -1 +0,0 @@
single_doc_op
@@ -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 %}
@@ -0,0 +1,9 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_mtermvectors")
else:
path = _make_path(index, doc_type, "_mtermvectors")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %}
@@ -1,8 +0,0 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
doc_type = "_doc"
{{ super()|trim }}
{% endblock %}
@@ -1 +0,0 @@
single_doc_op
@@ -0,0 +1,9 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_termvectors", id)
else:
path = _make_path(index, doc_type, id, "_termvectors")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %}
@@ -1 +0,0 @@
single_doc_op
@@ -0,0 +1,9 @@
{% extends "base" %}
{% block request %}
if doc_type in SKIP_IN_PATH:
path = _make_path(index, "_update", id)
else:
path = _make_path(index, doc_type, id, "_update")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %}