diff --git a/opensearchpy/_async/client/__init__.py b/opensearchpy/_async/client/__init__.py index 2440b291..f9ae9ff5 100644 --- a/opensearchpy/_async/client/__init__.py +++ b/opensearchpy/_async/client/__init__.py @@ -25,6 +25,17 @@ # specific language governing permissions and limitations # under the License. + +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + + from __future__ import unicode_literals import logging @@ -274,25 +285,25 @@ async def create(self, index, id, body, params=None, headers=None): with a same ID already exists in the index. - :arg index: The name of the index - :arg id: Document ID + :arg index: Index name. + :arg id: Document ID. :arg body: The document :arg pipeline: The pipeline id to preprocess incoming documents - with + with. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: - internal, external, external_gte + :arg routing: Routing value. + :arg timeout: Operation timeout. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: + internal, external, external_gte, force :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the index operation. Defaults - to 1, meaning the primary shard only. Set to `all` for all shard copies, + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total - number of copies for the shard (number of replicas + 1) + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, id, body): if param in SKIP_IN_PATH: @@ -322,46 +333,42 @@ async def index(self, index, body, id=None, params=None, headers=None): Creates or updates a document in an index. - :arg index: The name of the index + :arg index: Index name. :arg body: The document - :arg id: Document ID - :arg if_primary_term: only perform the index operation if the - last operation that has changed the document has the specified primary - term - :arg if_seq_no: only perform the index operation if the last - operation that has changed the document has the specified sequence - number + :arg id: Document ID. + :arg if_primary_term: only perform the operation if the last + operation that has changed the document has the specified primary term. + :arg if_seq_no: only perform the operation if the last operation + that has changed the document has the specified sequence number. :arg op_type: Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests - without an explicit document ID Valid choices: index, create + without an explicit document ID. Valid choices: index, create :arg pipeline: The pipeline id to preprocess incoming documents - with + with. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for :arg require_alias: When true, requires destination to be an - alias. Default is false - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: - internal, external, external_gte + alias. (default: false) + :arg routing: Routing value. + :arg timeout: Operation timeout. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: + internal, external, external_gte, force :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the index operation. Defaults - to 1, meaning the primary shard only. Set to `all` for all shard copies, + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total - number of copies for the shard (number of replicas + 1) + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return await self.transport.perform_request( "POST" if id in SKIP_IN_PATH else "PUT", - _make_path(index, doc_type, id), + _make_path(index, "_doc", id), params=params, headers=headers, body=body, @@ -385,29 +392,29 @@ async def bulk(self, body, index=None, params=None, headers=None): :arg body: The operation definition and data (action-data pairs), separated by newlines - :arg index: Default index for items which don't provide one + :arg index: Default index for items which don't provide one. :arg _source: True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub- - request + request. :arg _source_excludes: Default list of fields to exclude from - the returned _source field, can be overridden on each sub-request + the returned _source field, can be overridden on each sub-request. :arg _source_includes: Default list of fields to extract and - return from the _source field, can be overridden on each sub-request + return from the _source field, can be overridden on each sub-request. :arg pipeline: The pipeline id to preprocess incoming documents - with + with. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for :arg require_alias: Sets require_alias for all incoming - documents. Defaults to unset (false) - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout + documents. (default: false) + :arg routing: Routing value. + :arg timeout: Operation timeout. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the bulk operation. Defaults - to 1, meaning the primary shard only. Set to `all` for all shard copies, + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total - number of copies for the shard (number of replicas + 1) + number of copies for the shard (number of replicas + 1). (default: 1) """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -427,9 +434,9 @@ async def clear_scroll(self, body=None, scroll_id=None, params=None, headers=Non Explicitly clears the search context for a scroll. - :arg body: A comma-separated list of scroll IDs to clear if none + :arg body: Comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter - :arg scroll_id: A comma-separated list of scroll IDs to clear + :arg scroll_id: Comma-separated list of scroll IDs to clear. """ if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH: raise ValueError("You need to supply scroll_id or body.") @@ -463,37 +470,38 @@ async def count(self, body=None, index=None, params=None, headers=None): Returns number of documents matching a query. - :arg body: A query to restrict the results specified with the + :arg body: Query to restrict the results specified with the Query DSL (optional) - :arg index: A comma-separated list of indices to restrict the - results + :arg index: Comma-separated list of indices to restrict the + results. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. :arg default_operator: The default operator for query string - query (AND or OR) Valid choices: AND, OR Default: OR + query (AND or OR). Valid choices: AND, OR :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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :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 - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg min_score: Include only documents with a specific `_score` - value in the result + value in the result. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg routing: A comma-separated list of specific routing values - :arg terminate_after: The maximum count for each shard, upon - reaching which the query execution will terminate early + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg routing: Comma-separated list of specific routing values. + :arg terminate_after: The maximum number of documents to collect + for each shard, upon reaching which the query execution will terminate + early. """ return await self.transport.perform_request( "POST", @@ -518,37 +526,33 @@ async def delete(self, index, id, params=None, headers=None): Removes a document from the index. - :arg index: The name of the index - :arg id: The document ID - :arg if_primary_term: only perform the delete operation if the - last operation that has changed the document has the specified primary - term - :arg if_seq_no: only perform the delete operation if the last - operation that has changed the document has the specified sequence - number + :arg index: Index name. + :arg id: Document ID. + :arg if_primary_term: only perform the operation if the last + operation that has changed the document has the specified primary term. + :arg if_seq_no: only perform the operation if the last operation + that has changed the document has the specified sequence number. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + :arg routing: Routing value. + :arg timeout: Operation timeout. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the delete operation. - Defaults to 1, meaning the primary shard only. Set to `all` for all - shard copies, otherwise set to any non-negative value less than or equal - to the total number of copies for the shard (number of replicas + 1) + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return await self.transport.perform_request( - "DELETE", _make_path(index, doc_type, id), params=params, headers=headers + "DELETE", _make_path(index, "_doc", id), params=params, headers=headers ) @query_params( @@ -591,76 +595,76 @@ async def delete_by_query(self, index, body, params=None, headers=None): Deletes documents matching the provided query. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg body: The search definition using the Query DSL :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string - :arg conflicts: What to do when the delete by query hits version - conflicts? Valid choices: abort, proceed Default: abort + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. + :arg conflicts: What to do when the operation encounters version + conflicts?. Valid choices: abort, proceed :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 :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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg from_: Starting offset (default: 0) + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg from_: Starting offset. (default: 0) :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg max_docs: Maximum number of documents to process (default: - all documents) + all documents). :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg refresh: Should the effected indexes be refreshed? + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg refresh: Refresh the shard containing the document before + performing the operation. :arg request_cache: Specify if request cache should be used for - this request or not, defaults to index level setting + this request or not, defaults to index level setting. :arg requests_per_second: The throttle for this request in sub- - requests per second. -1 means no throttle. - :arg routing: A comma-separated list of specific routing values + requests per second. -1 means no throttle. (default: 0) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg scroll_size: Size on the scroll request powering the delete - by query Default: 100 + should be maintained for scrolled search. + :arg scroll_size: Size on the scroll request powering the + operation. (default: 100) :arg search_timeout: Explicit timeout for each search request. Defaults to no timeout. - :arg search_type: Search operation type Valid choices: + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch - :arg size: Deprecated, please use `max_docs` instead + :arg size: Deprecated, please use `max_docs` instead. :arg slices: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be - set to `auto`. Default: 1 - :arg sort: A comma-separated list of : pairs + set to `auto`. (default: 1) + :arg sort: Comma-separated list of : pairs. :arg stats: Specific 'tag' of the request for logging and - statistical purposes + statistical purposes. :arg terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. :arg timeout: Time each individual bulk request should wait for - shards that are unavailable. Default: 1m - :arg version: Specify whether to return document version as part - of a hit + shards that are unavailable. (default: 1m) + :arg version: Whether to return document version as part of a + hit. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the delete by query - operation. Defaults to 1, meaning the primary shard only. Set to `all` - for all shard copies, otherwise set to any non-negative value less than - or equal to the total number of copies for the shard (number of replicas - + 1) - :arg wait_for_completion: Should the request should block until - the delete by query is complete. Default: True + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. (default: True) """ # from is a reserved word so it cannot be used, use from_ instead if "from_" in params: @@ -685,9 +689,9 @@ async def delete_by_query_rethrottle(self, task_id, params=None, headers=None): operation. - :arg task_id: The task id to rethrottle - :arg requests_per_second: The throttle to set on this request in - floating sub-requests per second. -1 means set no throttle. + :arg task_id: The task id to rethrottle. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") @@ -699,16 +703,19 @@ async def delete_by_query_rethrottle(self, task_id, params=None, headers=None): headers=headers, ) - @query_params("master_timeout", "cluster_manager_timeout", "timeout") + @query_params("cluster_manager_timeout", "master_timeout", "timeout") async def delete_script(self, id, params=None, headers=None): """ Deletes a script. - :arg id: Script ID - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + :arg id: Script ID. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'id'.") @@ -734,35 +741,33 @@ async def exists(self, index, id, params=None, headers=None): Returns information about whether a document exists in an index. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return await self.transport.perform_request( - "HEAD", _make_path(index, doc_type, id), params=params, headers=headers + "HEAD", _make_path(index, "_doc", id), params=params, headers=headers ) @query_params( @@ -781,23 +786,23 @@ async def exists_source(self, index, id, params=None, headers=None): Returns information about whether a document source exists in an index. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): @@ -829,30 +834,30 @@ async def explain(self, index, id, body=None, params=None, headers=None): Returns information about why a specific matches (or doesn't match) a query. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg body: The query definition using the Query DSL :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg analyze_wildcard: Specify whether wildcards and prefix - queries in the query string query should be analyzed (default: false) - :arg analyzer: The analyzer for the query string query + queries in the query string query should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. :arg default_operator: The default operator for query string - query (AND or OR) Valid choices: AND, OR Default: OR - :arg df: The default field for query string query (default: + query (AND or OR). Valid choices: AND, OR + :arg df: The default field for query string query. (default: _all) :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. """ for param in (index, id): if param in SKIP_IN_PATH: @@ -878,19 +883,19 @@ async def field_caps(self, body=None, index=None, params=None, headers=None): :arg body: An index filter specified with the Query DSL - :arg index: A comma-separated list of index names; use `_all` or - empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg fields: A comma-separated list of field names + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg fields: Comma-separated list of field names. :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg include_unmapped: Indicates whether unmapped fields should - be included in the response. + be included in the response. (default: false) """ return await self.transport.perform_request( "POST", @@ -917,46 +922,47 @@ async def get(self, index, id, params=None, headers=None): Returns a document. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return await self.transport.perform_request( - "GET", _make_path(index, doc_type, id), params=params, headers=headers + "GET", _make_path(index, "_doc", id), params=params, headers=headers ) - @query_params("master_timeout", "cluster_manager_timeout") + @query_params("cluster_manager_timeout", "master_timeout") async def get_script(self, id, params=None, headers=None): """ Returns a script. - :arg id: Script ID - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + :arg id: Script ID. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'id'.") @@ -981,23 +987,23 @@ async def get_source(self, index, id, params=None, headers=None): Returns the source of a document. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): @@ -1026,24 +1032,24 @@ async def mget(self, body, index=None, params=None, headers=None): :arg body: Document identifiers; can be either `docs` - (containing full document information) or `ids` (when index and type is - provided in the URL. - :arg index: The name of the index + (containing full document information) or `ids` (when index is provided + in the URL. + :arg index: Index name. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response + performing the operation. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1072,30 +1078,31 @@ async def msearch(self, body, index=None, params=None, headers=None): :arg body: The request definitions (metadata-search request definition pairs), separated by newlines - :arg index: A comma-separated list of index names to use as - default + :arg index: Comma-separated list of indices to use as default. :arg ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg max_concurrent_searches: Controls the maximum number of - concurrent searches the multi search api will execute + concurrent searches the multi search api will execute. :arg max_concurrent_shard_requests: The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in - order to limit the number of concurrent shard requests Default: 5 - :arg pre_filter_shard_size: A threshold that enforces a pre- - filter roundtrip to prefilter search shards based on query rewriting if - the number of shards the search request expands to exceeds the - threshold. This filter roundtrip can limit the number of shards - significantly if for instance a shard can not match any documents based - on its rewrite method ie. if date filters are mandatory to match but the - shard bounds and the query are disjoint. + order to limit the number of concurrent shard requests. (default: 5) + :arg pre_filter_shard_size: Threshold that enforces a pre-filter + round-trip to prefilter search shards based on query rewriting if the + number of shards the search request expands to exceeds the threshold. + This filter round-trip can limit the number of shards significantly if + for instance a shard can not match any documents based on its rewrite + method ie. if date filters are mandatory to match but the shard bounds + and the query are disjoint. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg search_type: Search operation type Valid choices: - query_then_fetch, dfs_query_then_fetch + be rendered as an integer or an object in the rest search response. + (default: false) + :arg search_type: Search operation type. Valid choices: + query_then_fetch, query_and_fetch, dfs_query_then_fetch, + dfs_query_and_fetch :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response + should be prefixed by their respective types in the response. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1123,19 +1130,20 @@ async def msearch_template(self, body, index=None, params=None, headers=None): :arg body: The request definitions (metadata-search request definition pairs), separated by newlines - :arg index: A comma-separated list of index names to use as - default + :arg index: Comma-separated list of indices to use as default. :arg ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg max_concurrent_searches: Controls the maximum number of - concurrent searches the multi search api will execute + concurrent searches the multi search api will execute. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg search_type: Search operation type Valid choices: - query_then_fetch, dfs_query_then_fetch + be rendered as an integer or an object in the rest search response. + (default: false) + :arg search_type: Search operation type. Valid choices: + query_then_fetch, query_and_fetch, dfs_query_then_fetch, + dfs_query_and_fetch :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response + should be prefixed by their respective types in the response. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1175,33 +1183,33 @@ async def mtermvectors(self, body=None, index=None, params=None, headers=None): :arg field_statistics: Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified - in body "params" or "docs". Default: True - :arg fields: A comma-separated list of fields to return. Applies - to all returned documents unless otherwise specified in body "params" or - "docs". - :arg ids: A comma-separated list of documents ids. You must - define ids as parameter or set "ids" or "docs" in the request body + in body 'params' or 'docs'. (default: True) + :arg fields: Comma-separated list of fields to return. Applies + to all returned documents unless otherwise specified in body 'params' or + 'docs'. + :arg ids: Comma-separated list of documents ids. You must define + ids as parameter or set 'ids' or 'docs' in the request body. :arg offsets: Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body - "params" or "docs". Default: True + 'params' or 'docs'. (default: True) :arg payloads: Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body - "params" or "docs". Default: True + 'params' or 'docs'. (default: True) :arg positions: Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body - "params" or "docs". Default: True + 'params' or 'docs'. (default: True) :arg preference: Specify the node or shard the operation should - be performed on (default: random) .Applies to all returned documents - unless otherwise specified in body "params" or "docs". + be performed on. Applies to all returned documents unless otherwise + specified in body 'params' or 'docs'. (default: random) :arg realtime: Specifies if requests are real-time as opposed to - near-real-time (default: true). - :arg routing: Specific routing value. Applies to all returned - documents unless otherwise specified in body "params" or "docs". + near-real-time. (default: True) + :arg routing: Routing value. Applies to all returned documents + unless otherwise specified in body 'params' or 'docs'. :arg term_statistics: Specifies if total term frequency and document frequency should be returned. Applies to all returned documents - unless otherwise specified in body "params" or "docs". - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + unless otherwise specified in body 'params' or 'docs'. (default: false) + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ path = _make_path(index, "_mtermvectors") @@ -1210,18 +1218,21 @@ async def mtermvectors(self, body=None, index=None, params=None, headers=None): "POST", path, params=params, headers=headers, body=body ) - @query_params("master_timeout", "cluster_manager_timeout", "timeout") + @query_params("cluster_manager_timeout", "master_timeout", "timeout") async def put_script(self, id, body, context=None, params=None, headers=None): """ Creates or updates a script. - :arg id: Script ID + :arg id: Script ID. :arg body: The document - :arg context: Context name to compile script against - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + :arg context: Script context. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ for param in (id, body): if param in SKIP_IN_PATH: @@ -1241,27 +1252,22 @@ async def put_script(self, id, body, context=None, params=None, headers=None): async def rank_eval(self, body, index=None, params=None, headers=None): """ Allows to evaluate the quality of ranked search results over a set of typical - search queries + search queries. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - :arg body: The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) - :arg search_type: Search operation type Valid choices: + should be ignored when unavailable (missing or closed). + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch """ if body in SKIP_IN_PATH: @@ -1295,24 +1301,24 @@ async def reindex(self, body, params=None, headers=None): :arg body: The search definition using the Query DSL and the prototype for the index request. :arg max_docs: Maximum number of documents to process (default: - all documents) - :arg refresh: Should the affected indexes be refreshed? - :arg requests_per_second: The throttle to set on this request in - sub-requests per second. -1 means no throttle. - :arg scroll: Control how long to keep the search context alive - Default: 5m + all documents). + :arg refresh: Should the affected indexes be refreshed?. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. (default: 0) + :arg scroll: Specify how long a consistent view of the index + should be maintained for scrolled search. :arg slices: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be - set to `auto`. Default: 1 + set to `auto`. (default: 1) :arg timeout: Time each individual bulk request should wait for - shards that are unavailable. Default: 1m + shards that are unavailable. (default: 1m) :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the reindex operation. - Defaults to 1, meaning the primary shard only. Set to `all` for all - shard copies, otherwise set to any non-negative value less than or equal - to the total number of copies for the shard (number of replicas + 1) - :arg wait_for_completion: Should the request should block until - the reindex is complete. Default: True + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. (default: True) """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1327,9 +1333,9 @@ async def reindex_rethrottle(self, task_id, params=None, headers=None): Changes the number of requests per second for a particular Reindex operation. - :arg task_id: The task id to rethrottle - :arg requests_per_second: The throttle to set on this request in - floating sub-requests per second. -1 means set no throttle. + :arg task_id: The task id to rethrottle. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") @@ -1350,7 +1356,7 @@ async def render_search_template( :arg body: The search definition template and its params - :arg id: The id of the stored search template + :arg id: The id of the stored search template. """ return await self.transport.perform_request( "POST", @@ -1363,13 +1369,8 @@ async def render_search_template( @query_params() async def scripts_painless_execute(self, body=None, params=None, headers=None): """ - Allows an arbitrary script to be executed and a result to be returned - + Allows an arbitrary script to be executed and a result to be returned. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version :arg body: The script to execute """ @@ -1389,11 +1390,12 @@ async def scroll(self, body=None, scroll_id=None, params=None, headers=None): :arg body: The scroll ID if not passed by URL or query parameter. - :arg scroll_id: The scroll ID for scrolled search + :arg scroll_id: Scroll ID. :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. + (default: false) :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search + should be maintained for scrolled search. """ if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH: raise ValueError("You need to supply scroll_id or body.") @@ -1426,7 +1428,6 @@ async def scroll(self, body=None, scroll_id=None, params=None, headers=None): "ignore_unavailable", "lenient", "max_concurrent_shard_requests", - "min_compatible_shard_node", "pre_filter_shard_size", "preference", "q", @@ -1457,101 +1458,99 @@ async def search(self, body=None, index=None, params=None, headers=None): :arg body: The search definition using the Query DSL - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - be returned if there is a partial search failure or timeout Default: - True + be returned if there is a partial search failure or timeout. (default: + True) :arg analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. :arg batched_reduce_size: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. - Default: 512 + (default: 512) :arg ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg default_operator: The default operator for query string - query (AND or OR) Valid choices: AND, OR Default: OR + query (AND or OR). Valid choices: AND, OR :arg df: The field to use as default where no field prefix is - given in the query string - :arg docvalue_fields: A comma-separated list of fields to return - as the docvalue representation of a field for each hit + given in the query string. + :arg docvalue_fields: Comma-separated list of fields to return + as the docvalue representation of a field for each hit. :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :arg explain: Specify whether to return detailed information - about score computation as part of a hit - :arg from_: Starting offset (default: 0) + about score computation as part of a hit. + :arg from_: Starting offset. (default: 0) :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 - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg max_concurrent_shard_requests: The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order - to limit the number of concurrent shard requests Default: 5 - :arg min_compatible_shard_node: The minimum compatible version - that all shards involved in search should have for this request to be - successful - :arg pre_filter_shard_size: A threshold that enforces a pre- - filter roundtrip to prefilter search shards based on query rewriting if - the number of shards the search request expands to exceeds the - threshold. This filter roundtrip can limit the number of shards - significantly if for instance a shard can not match any documents based - on its rewrite method ie. if date filters are mandatory to match but the - shard bounds and the query are disjoint. + to limit the number of concurrent shard requests. (default: 5) + :arg pre_filter_shard_size: Threshold that enforces a pre-filter + round-trip to prefilter search shards based on query rewriting if the + number of shards the search request expands to exceeds the threshold. + This filter round-trip can limit the number of shards significantly if + for instance a shard can not match any documents based on its rewrite + method ie. if date filters are mandatory to match but the shard bounds + and the query are disjoint. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. :arg request_cache: Specify if request cache should be used for - this request or not, defaults to index level setting + this request or not, defaults to index level setting. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg routing: A comma-separated list of specific routing values + be rendered as an integer or an object in the rest search response. + (default: false) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg search_type: Search operation type Valid choices: + should be maintained for scrolled search. + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch :arg seq_no_primary_term: Specify whether to return sequence - number and primary term of the last modification of each hit - :arg size: Number of hits to return (default: 10) - :arg sort: A comma-separated list of : pairs + number and primary term of the last modification of each hit. + :arg size: Number of hits to return. (default: 10) + :arg sort: Comma-separated list of : pairs. :arg stats: Specific 'tag' of the request for logging and - statistical purposes - :arg stored_fields: A comma-separated list of stored fields to - return as part of a hit - :arg suggest_field: Specify which field to use for suggestions - :arg suggest_mode: Specify suggest mode Valid choices: missing, - popular, always Default: missing - :arg suggest_size: How many suggestions to return in response + statistical purposes. + :arg stored_fields: Comma-separated list of stored fields to + return. + :arg suggest_field: Specify which field to use for suggestions. + :arg suggest_mode: Specify suggest mode. Valid choices: + missing, popular, always + :arg suggest_size: How many suggestions to return in response. :arg suggest_text: The source text for which the suggestions - should be returned + should be returned. :arg terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - :arg timeout: Explicit operation timeout + :arg timeout: Operation timeout. :arg track_scores: Whether to calculate and return scores even - if they are not used for sorting + if they are not used for sorting. :arg track_total_hits: Indicate if the number of documents that - match the query should be tracked + match the query should be tracked. :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response - :arg version: Specify whether to return document version as part - of a hit + should be prefixed by their respective types in the response. + :arg version: Whether to return document version as part of a + hit. """ # from is a reserved word so it cannot be used, use from_ instead if "from_" in params: @@ -1579,21 +1578,21 @@ async def search_shards(self, index=None, params=None, headers=None): executed against. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :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 - from cluster_manager node (default: false) + from cluster-manager node. (default: false) :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg routing: Specific routing value + be performed on. (default: random) + :arg routing: Routing value. """ return await self.transport.perform_request( "GET", _make_path(index, "_search_shards"), params=params, headers=headers @@ -1620,35 +1619,37 @@ async def search_template(self, body, index=None, params=None, headers=None): :arg body: The search definition template and its params - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :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 - aliased indices should be ignored when throttled + aliased indices should be ignored when throttled. :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg profile: Specify whether to profile the query execution + be performed on. (default: random) + :arg profile: Specify whether to profile the query execution. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg routing: A comma-separated list of specific routing values + be rendered as an integer or an object in the rest search response. + (default: false) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg search_type: Search operation type Valid choices: - query_then_fetch, dfs_query_then_fetch + should be maintained for scrolled search. + :arg search_type: Search operation type. Valid choices: + query_then_fetch, query_and_fetch, dfs_query_then_fetch, + dfs_query_and_fetch :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response + should be prefixed by their respective types in the response. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1683,27 +1684,27 @@ async def termvectors(self, index, body=None, id=None, params=None, headers=None :arg index: The index in which the document resides. :arg body: Define parameters and or supply a document to get termvectors for. See documentation. - :arg id: The id of the document, when not specified a doc param - should be supplied. + :arg id: Document ID. When not specified a doc param should be + supplied. :arg field_statistics: Specifies if document count, sum of document frequencies and sum of total term frequencies should be - returned. Default: True - :arg fields: A comma-separated list of fields to return. + returned. (default: True) + :arg fields: Comma-separated list of fields to return. :arg offsets: Specifies if term offsets should be returned. - Default: True + (default: True) :arg payloads: Specifies if term payloads should be returned. - Default: True + (default: True) :arg positions: Specifies if term positions should be returned. - Default: True + (default: True) :arg preference: Specify the node or shard the operation should - be performed on (default: random). + be performed on. (default: random) :arg realtime: Specifies if request is real-time as opposed to - near-real-time (default: true). - :arg routing: Specific routing value. + near-real-time. (default: True) + :arg routing: Routing value. :arg term_statistics: Specifies if total term frequency and - document frequency should be returned. - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + document frequency should be returned. (default: false) + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ if index in SKIP_IN_PATH: @@ -1734,38 +1735,36 @@ async def update(self, index, id, body, params=None, headers=None): Updates a document with a script or partial document. - :arg index: The name of the index - :arg id: Document ID + :arg index: Index name. + :arg id: Document ID. :arg body: The request definition requires either `script` or partial `doc` :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field - :arg if_primary_term: only perform the update operation if the - last operation that has changed the document has the specified primary - term - :arg if_seq_no: only perform the update operation if the last - operation that has changed the document has the specified sequence - number - :arg lang: The script language (default: painless) + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. + :arg if_primary_term: only perform the operation if the last + operation that has changed the document has the specified primary term. + :arg if_seq_no: only perform the operation if the last operation + that has changed the document has the specified sequence number. + :arg lang: The script language. (default: painless) :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for - :arg require_alias: When true, requires destination is an alias. - Default is false + :arg require_alias: When true, requires destination to be an + alias. (default: false) :arg retry_on_conflict: Specify how many times should the - operation be retried when a conflict occurs (default: 0) - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout + operation be retried when a conflict occurs. (default: 0) + :arg routing: Routing value. + :arg timeout: Operation timeout. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the update operation. - Defaults to 1, meaning the primary shard only. Set to `all` for all - shard copies, otherwise set to any non-negative value less than or equal - to the total number of copies for the shard (number of replicas + 1) + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, id, body): if param in SKIP_IN_PATH: @@ -1810,7 +1809,6 @@ async def update(self, index, id, body, params=None, headers=None): "terminate_after", "timeout", "version", - "version_type", "wait_for_active_shards", "wait_for_completion", ) @@ -1820,80 +1818,77 @@ async def update_by_query(self, index, body=None, params=None, headers=None): for example to pick up a mapping change. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg body: The search definition using the Query DSL :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string - :arg conflicts: What to do when the update by query hits version - conflicts? Valid choices: abort, proceed Default: abort + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. + :arg conflicts: What to do when the operation encounters version + conflicts?. Valid choices: abort, proceed :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 :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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg from_: Starting offset (default: 0) + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg from_: Starting offset. (default: 0) :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg max_docs: Maximum number of documents to process (default: - all documents) - :arg pipeline: Ingest pipeline to set on index requests made by - this action. (default: none) + all documents). + :arg pipeline: The pipeline id to preprocess incoming documents + with. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg refresh: Should the affected indexes be refreshed? + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg refresh: Should the affected indexes be refreshed?. :arg request_cache: Specify if request cache should be used for - this request or not, defaults to index level setting - :arg requests_per_second: The throttle to set on this request in - sub-requests per second. -1 means no throttle. - :arg routing: A comma-separated list of specific routing values + this request or not, defaults to index level setting. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. (default: 0) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg scroll_size: Size on the scroll request powering the update - by query Default: 100 + should be maintained for scrolled search. + :arg scroll_size: Size on the scroll request powering the + operation. (default: 100) :arg search_timeout: Explicit timeout for each search request. Defaults to no timeout. - :arg search_type: Search operation type Valid choices: + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch - :arg size: Deprecated, please use `max_docs` instead + :arg size: Deprecated, please use `max_docs` instead. :arg slices: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be - set to `auto`. Default: 1 - :arg sort: A comma-separated list of : pairs + set to `auto`. (default: 1) + :arg sort: Comma-separated list of : pairs. :arg stats: Specific 'tag' of the request for logging and - statistical purposes + statistical purposes. :arg terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. :arg timeout: Time each individual bulk request should wait for - shards that are unavailable. Default: 1m - :arg version: Specify whether to return document version as part - of a hit - :arg version_type: Should the document increment the version - number (internal) on hit or not (reindex) + shards that are unavailable. (default: 1m) + :arg version: Whether to return document version as part of a + hit. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the update by query - operation. Defaults to 1, meaning the primary shard only. Set to `all` - for all shard copies, otherwise set to any non-negative value less than - or equal to the total number of copies for the shard (number of replicas - + 1) - :arg wait_for_completion: Should the request should block until - the update by query operation is complete. Default: True + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. (default: True) """ # from is a reserved word so it cannot be used, use from_ instead if "from_" in params: @@ -1917,9 +1912,9 @@ async def update_by_query_rethrottle(self, task_id, params=None, headers=None): operation. - :arg task_id: The task id to rethrottle - :arg requests_per_second: The throttle to set on this request in - floating sub-requests per second. -1 means set no throttle. + :arg task_id: The task id to rethrottle. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") @@ -1936,11 +1931,6 @@ async def get_script_context(self, params=None, headers=None): """ Returns all script contexts. - - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version """ return await self.transport.perform_request( "GET", "/_script_context", params=params, headers=headers @@ -1949,13 +1939,8 @@ async def get_script_context(self, params=None, headers=None): @query_params() async def get_script_languages(self, params=None, headers=None): """ - Returns available script types, languages and contexts - - - .. warning:: + Returns available script types, languages and contexts. - This API is **experimental** so may include breaking changes - or be removed in a future version """ return await self.transport.perform_request( "GET", "/_script_language", params=params, headers=headers @@ -1982,7 +1967,7 @@ async def create_pit(self, index, params=None, headers=None): open, closed, hidden, none :arg keep_alive: Specify the keep alive for point in time. :arg preference: Specify the node or shard the operation should - be performed on. + be performed on. (default: random) :arg routing: Comma-separated list of specific routing values. """ if index in SKIP_IN_PATH: @@ -2025,36 +2010,8 @@ async def delete_pit(self, body=None, params=None, headers=None): async def get_all_pits(self, params=None, headers=None): """ Lists all active point in time searches. - """ - return await self.transport.perform_request( - "GET", "/_search/point_in_time/_all", params=params, headers=headers - ) - - @query_params() - async def terms_enum(self, index, body=None, params=None, headers=None): - """ - The terms enum API can be used to discover terms in the index that begin with - the provided string. It is designed for low-latency look-ups used in auto- - complete scenarios. - - - .. warning:: - This API is **beta** so may include breaking changes - or be removed in a future version - - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices - :arg body: field name, string which is the prefix expected in - matching terms, timeout and size for max number of results """ - if index in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'index'.") - return await self.transport.perform_request( - "POST", - _make_path(index, "_terms_enum"), - params=params, - headers=headers, - body=body, + "GET", "/_search/point_in_time/_all", params=params, headers=headers ) diff --git a/opensearchpy/_async/client/__init__.pyi b/opensearchpy/_async/client/__init__.pyi index a016d791..70a93d19 100644 --- a/opensearchpy/_async/client/__init__.pyi +++ b/opensearchpy/_async/client/__init__.pyi @@ -25,6 +25,15 @@ # specific language governing permissions and limitations # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + from __future__ import unicode_literals import logging @@ -333,8 +342,8 @@ class AsyncOpenSearch(object): self, id: Any, *, - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -490,8 +499,8 @@ class AsyncOpenSearch(object): self, id: Any, *, - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -642,8 +651,8 @@ class AsyncOpenSearch(object): *, body: Any, context: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -802,7 +811,6 @@ class AsyncOpenSearch(object): ignore_unavailable: Optional[Any] = ..., lenient: Optional[Any] = ..., max_concurrent_shard_requests: Optional[Any] = ..., - min_compatible_shard_node: Optional[Any] = ..., pre_filter_shard_size: Optional[Any] = ..., preference: Optional[Any] = ..., q: Optional[Any] = ..., @@ -991,7 +999,6 @@ class AsyncOpenSearch(object): terminate_after: Optional[Any] = ..., timeout: Optional[Any] = ..., version: Optional[Any] = ..., - version_type: Optional[Any] = ..., wait_for_active_shards: Optional[Any] = ..., wait_for_completion: Optional[Any] = ..., pretty: Optional[bool] = ..., @@ -1128,21 +1135,3 @@ class AsyncOpenSearch(object): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def terms_enum( - self, - index: Any, - *, - body: Optional[Any] = ..., - pretty: Optional[bool] = ..., - human: Optional[bool] = ..., - error_trace: Optional[bool] = ..., - format: Optional[str] = ..., - filter_path: Optional[Union[str, Collection[str]]] = ..., - request_timeout: Optional[Union[int, float]] = ..., - ignore: Optional[Union[int, Collection[int]]] = ..., - opaque_id: Optional[str] = ..., - http_auth: Optional[Union[str, Tuple[str, str]]] = ..., - api_key: Optional[Union[str, Tuple[str, str]]] = ..., - params: Optional[MutableMapping[str, Any]] = ..., - headers: Optional[MutableMapping[str, str]] = ..., - ) -> Any: ... diff --git a/opensearchpy/_async/client/ingest.py b/opensearchpy/_async/client/ingest.py index cb5253eb..68f0e628 100644 --- a/opensearchpy/_async/client/ingest.py +++ b/opensearchpy/_async/client/ingest.py @@ -117,7 +117,7 @@ async def simulate(self, body, id=None, params=None, headers=None): :arg body: The simulate definition :arg id: Pipeline ID. :arg verbose: Verbose mode. Display data output for each - processor in executed pipeline. + processor in executed pipeline. (default: false) """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") diff --git a/opensearchpy/_async/client/tasks.py b/opensearchpy/_async/client/tasks.py index 212b9e56..0a06a567 100644 --- a/opensearchpy/_async/client/tasks.py +++ b/opensearchpy/_async/client/tasks.py @@ -57,7 +57,8 @@ async def list(self, params=None, headers=None): :arg actions: Comma-separated list of actions that should be returned. Leave empty to return all. - :arg detailed: Return detailed task information. + :arg detailed: Return detailed task information. (default: + false) :arg group_by: Group tasks by nodes or parent/child relationships. Valid choices: nodes, parents, none :arg nodes: Comma-separated list of node IDs or names to limit @@ -68,7 +69,7 @@ async def list(self, params=None, headers=None): (node_id:task_number). Set to -1 to return all. :arg timeout: Operation timeout. :arg wait_for_completion: Should this request wait until the - operation has completed before returning. + operation has completed before returning. (default: false) """ return await self.transport.perform_request( "GET", "/_tasks", params=params, headers=headers @@ -91,7 +92,7 @@ async def cancel(self, task_id=None, params=None, headers=None): :arg parent_task_id: Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. :arg wait_for_completion: Should this request wait until the - operation has completed before returning. + operation has completed before returning. (default: false) """ return await self.transport.perform_request( "POST", @@ -110,7 +111,7 @@ async def get(self, task_id=None, params=None, headers=None): (node_id:task_number). :arg timeout: Operation timeout. :arg wait_for_completion: Should this request wait until the - operation has completed before returning. + operation has completed before returning. (default: false) """ if task_id in SKIP_IN_PATH: warnings.warn( diff --git a/opensearchpy/client/__init__.py b/opensearchpy/client/__init__.py index 8f976879..f1e2ba6b 100644 --- a/opensearchpy/client/__init__.py +++ b/opensearchpy/client/__init__.py @@ -26,6 +26,16 @@ # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + + from __future__ import unicode_literals import logging @@ -275,25 +285,25 @@ def create(self, index, id, body, params=None, headers=None): with a same ID already exists in the index. - :arg index: The name of the index - :arg id: Document ID + :arg index: Index name. + :arg id: Document ID. :arg body: The document :arg pipeline: The pipeline id to preprocess incoming documents - with + with. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: - internal, external, external_gte + :arg routing: Routing value. + :arg timeout: Operation timeout. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: + internal, external, external_gte, force :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the index operation. Defaults - to 1, meaning the primary shard only. Set to `all` for all shard copies, + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total - number of copies for the shard (number of replicas + 1) + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, id, body): if param in SKIP_IN_PATH: @@ -320,49 +330,45 @@ def create(self, index, id, body, params=None, headers=None): ) def index(self, index, body, id=None, params=None, headers=None): """ - Creates or overwrites a document in an index. + Creates or updates a document in an index. - :arg index: The name of the index + :arg index: Index name. :arg body: The document - :arg id: Document ID - :arg if_primary_term: only perform the index operation if the - last operation that has changed the document has the specified primary - term - :arg if_seq_no: only perform the index operation if the last - operation that has changed the document has the specified sequence - number + :arg id: Document ID. + :arg if_primary_term: only perform the operation if the last + operation that has changed the document has the specified primary term. + :arg if_seq_no: only perform the operation if the last operation + that has changed the document has the specified sequence number. :arg op_type: Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests - without an explicit document ID Valid choices: index, create + without an explicit document ID. Valid choices: index, create :arg pipeline: The pipeline id to preprocess incoming documents - with + with. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for :arg require_alias: When true, requires destination to be an - alias. Default is false - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: - internal, external, external_gte + alias. (default: false) + :arg routing: Routing value. + :arg timeout: Operation timeout. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: + internal, external, external_gte, force :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the index operation. Defaults - to 1, meaning the primary shard only. Set to `all` for all shard copies, + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total - number of copies for the shard (number of replicas + 1) + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return self.transport.perform_request( "POST" if id in SKIP_IN_PATH else "PUT", - _make_path(index, doc_type, id), + _make_path(index, "_doc", id), params=params, headers=headers, body=body, @@ -386,29 +392,29 @@ def bulk(self, body, index=None, params=None, headers=None): :arg body: The operation definition and data (action-data pairs), separated by newlines - :arg index: Default index for items which don't provide one + :arg index: Default index for items which don't provide one. :arg _source: True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub- - request + request. :arg _source_excludes: Default list of fields to exclude from - the returned _source field, can be overridden on each sub-request + the returned _source field, can be overridden on each sub-request. :arg _source_includes: Default list of fields to extract and - return from the _source field, can be overridden on each sub-request + return from the _source field, can be overridden on each sub-request. :arg pipeline: The pipeline id to preprocess incoming documents - with + with. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for :arg require_alias: Sets require_alias for all incoming - documents. Defaults to unset (false) - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout + documents. (default: false) + :arg routing: Routing value. + :arg timeout: Operation timeout. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the bulk operation. Defaults - to 1, meaning the primary shard only. Set to `all` for all shard copies, + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total - number of copies for the shard (number of replicas + 1) + number of copies for the shard (number of replicas + 1). (default: 1) """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -428,9 +434,9 @@ def clear_scroll(self, body=None, scroll_id=None, params=None, headers=None): Explicitly clears the search context for a scroll. - :arg body: A comma-separated list of scroll IDs to clear if none + :arg body: Comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter - :arg scroll_id: A comma-separated list of scroll IDs to clear + :arg scroll_id: Comma-separated list of scroll IDs to clear. """ if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH: raise ValueError("You need to supply scroll_id or body.") @@ -464,37 +470,38 @@ def count(self, body=None, index=None, params=None, headers=None): Returns number of documents matching a query. - :arg body: A query to restrict the results specified with the + :arg body: Query to restrict the results specified with the Query DSL (optional) - :arg index: A comma-separated list of indices to restrict the - results + :arg index: Comma-separated list of indices to restrict the + results. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. :arg default_operator: The default operator for query string - query (AND or OR) Valid choices: AND, OR Default: OR + query (AND or OR). Valid choices: AND, OR :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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :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 - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg min_score: Include only documents with a specific `_score` - value in the result + value in the result. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg routing: A comma-separated list of specific routing values - :arg terminate_after: The maximum count for each shard, upon - reaching which the query execution will terminate early + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg routing: Comma-separated list of specific routing values. + :arg terminate_after: The maximum number of documents to collect + for each shard, upon reaching which the query execution will terminate + early. """ return self.transport.perform_request( "POST", @@ -519,37 +526,33 @@ def delete(self, index, id, params=None, headers=None): Removes a document from the index. - :arg index: The name of the index - :arg id: The document ID - :arg if_primary_term: only perform the delete operation if the - last operation that has changed the document has the specified primary - term - :arg if_seq_no: only perform the delete operation if the last - operation that has changed the document has the specified sequence - number + :arg index: Index name. + :arg id: Document ID. + :arg if_primary_term: only perform the operation if the last + operation that has changed the document has the specified primary term. + :arg if_seq_no: only perform the operation if the last operation + that has changed the document has the specified sequence number. :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + :arg routing: Routing value. + :arg timeout: Operation timeout. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the delete operation. - Defaults to 1, meaning the primary shard only. Set to `all` for all - shard copies, otherwise set to any non-negative value less than or equal - to the total number of copies for the shard (number of replicas + 1) + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return self.transport.perform_request( - "DELETE", _make_path(index, doc_type, id), params=params, headers=headers + "DELETE", _make_path(index, "_doc", id), params=params, headers=headers ) @query_params( @@ -592,76 +595,76 @@ def delete_by_query(self, index, body, params=None, headers=None): Deletes documents matching the provided query. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg body: The search definition using the Query DSL :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string - :arg conflicts: What to do when the delete by query hits version - conflicts? Valid choices: abort, proceed Default: abort + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. + :arg conflicts: What to do when the operation encounters version + conflicts?. Valid choices: abort, proceed :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 :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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg from_: Starting offset (default: 0) + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg from_: Starting offset. (default: 0) :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg max_docs: Maximum number of documents to process (default: - all documents) + all documents). :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg refresh: Should the effected indexes be refreshed? + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg refresh: Refresh the shard containing the document before + performing the operation. :arg request_cache: Specify if request cache should be used for - this request or not, defaults to index level setting + this request or not, defaults to index level setting. :arg requests_per_second: The throttle for this request in sub- - requests per second. -1 means no throttle. - :arg routing: A comma-separated list of specific routing values + requests per second. -1 means no throttle. (default: 0) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg scroll_size: Size on the scroll request powering the delete - by query Default: 100 + should be maintained for scrolled search. + :arg scroll_size: Size on the scroll request powering the + operation. (default: 100) :arg search_timeout: Explicit timeout for each search request. Defaults to no timeout. - :arg search_type: Search operation type Valid choices: + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch - :arg size: Deprecated, please use `max_docs` instead + :arg size: Deprecated, please use `max_docs` instead. :arg slices: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be - set to `auto`. Default: 1 - :arg sort: A comma-separated list of : pairs + set to `auto`. (default: 1) + :arg sort: Comma-separated list of : pairs. :arg stats: Specific 'tag' of the request for logging and - statistical purposes + statistical purposes. :arg terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. :arg timeout: Time each individual bulk request should wait for - shards that are unavailable. Default: 1m - :arg version: Specify whether to return document version as part - of a hit + shards that are unavailable. (default: 1m) + :arg version: Whether to return document version as part of a + hit. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the delete by query - operation. Defaults to 1, meaning the primary shard only. Set to `all` - for all shard copies, otherwise set to any non-negative value less than - or equal to the total number of copies for the shard (number of replicas - + 1) - :arg wait_for_completion: Should the request should block until - the delete by query is complete. Default: True + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. (default: True) """ # from is a reserved word so it cannot be used, use from_ instead if "from_" in params: @@ -686,9 +689,9 @@ def delete_by_query_rethrottle(self, task_id, params=None, headers=None): operation. - :arg task_id: The task id to rethrottle - :arg requests_per_second: The throttle to set on this request in - floating sub-requests per second. -1 means set no throttle. + :arg task_id: The task id to rethrottle. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") @@ -700,16 +703,19 @@ def delete_by_query_rethrottle(self, task_id, params=None, headers=None): headers=headers, ) - @query_params("master_timeout", "cluster_manager_timeout", "timeout") + @query_params("cluster_manager_timeout", "master_timeout", "timeout") def delete_script(self, id, params=None, headers=None): """ Deletes a script. - :arg id: Script ID - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + :arg id: Script ID. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'id'.") @@ -735,35 +741,33 @@ def exists(self, index, id, params=None, headers=None): Returns information about whether a document exists in an index. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return self.transport.perform_request( - "HEAD", _make_path(index, doc_type, id), params=params, headers=headers + "HEAD", _make_path(index, "_doc", id), params=params, headers=headers ) @query_params( @@ -782,23 +786,23 @@ def exists_source(self, index, id, params=None, headers=None): Returns information about whether a document source exists in an index. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): @@ -830,30 +834,30 @@ def explain(self, index, id, body=None, params=None, headers=None): Returns information about why a specific matches (or doesn't match) a query. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg body: The query definition using the Query DSL :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg analyze_wildcard: Specify whether wildcards and prefix - queries in the query string query should be analyzed (default: false) - :arg analyzer: The analyzer for the query string query + queries in the query string query should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. :arg default_operator: The default operator for query string - query (AND or OR) Valid choices: AND, OR Default: OR - :arg df: The default field for query string query (default: + query (AND or OR). Valid choices: AND, OR + :arg df: The default field for query string query. (default: _all) :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. """ for param in (index, id): if param in SKIP_IN_PATH: @@ -879,19 +883,19 @@ def field_caps(self, body=None, index=None, params=None, headers=None): :arg body: An index filter specified with the Query DSL - :arg index: A comma-separated list of index names; use `_all` or - empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg fields: A comma-separated list of field names + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg fields: Comma-separated list of field names. :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg include_unmapped: Indicates whether unmapped fields should - be included in the response. + be included in the response. (default: false) """ return self.transport.perform_request( "POST", @@ -918,46 +922,47 @@ def get(self, index, id, params=None, headers=None): Returns a document. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") - doc_type = "_doc" - return self.transport.perform_request( - "GET", _make_path(index, doc_type, id), params=params, headers=headers + "GET", _make_path(index, "_doc", id), params=params, headers=headers ) - @query_params("master_timeout", "cluster_manager_timeout") + @query_params("cluster_manager_timeout", "master_timeout") def get_script(self, id, params=None, headers=None): """ Returns a script. - :arg id: Script ID - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + :arg id: Script ID. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'id'.") @@ -982,23 +987,23 @@ def get_source(self, index, id, params=None, headers=None): Returns the source of a document. - :arg index: The name of the index - :arg id: The document ID + :arg index: Index name. + :arg id: Document ID. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + performing the operation. + :arg routing: Routing value. + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ for param in (index, id): @@ -1027,24 +1032,24 @@ def mget(self, body, index=None, params=None, headers=None): :arg body: Document identifiers; can be either `docs` - (containing full document information) or `ids` (when index and type is - provided in the URL. - :arg index: The name of the index + (containing full document information) or `ids` (when index is provided + in the URL. + :arg index: Index name. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg preference: Specify the node or shard the operation should - be performed on (default: random) + be performed on. (default: random) :arg realtime: Specify whether to perform the operation in - realtime or search mode + realtime or search mode. :arg refresh: Refresh the shard containing the document before - performing the operation - :arg routing: Specific routing value - :arg stored_fields: A comma-separated list of stored fields to - return in the response + performing the operation. + :arg routing: Routing value. + :arg stored_fields: Comma-separated list of stored fields to + return. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1073,30 +1078,31 @@ def msearch(self, body, index=None, params=None, headers=None): :arg body: The request definitions (metadata-search request definition pairs), separated by newlines - :arg index: A comma-separated list of index names to use as - default + :arg index: Comma-separated list of indices to use as default. :arg ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg max_concurrent_searches: Controls the maximum number of - concurrent searches the multi search api will execute + concurrent searches the multi search api will execute. :arg max_concurrent_shard_requests: The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in - order to limit the number of concurrent shard requests Default: 5 - :arg pre_filter_shard_size: A threshold that enforces a pre- - filter roundtrip to prefilter search shards based on query rewriting if - the number of shards the search request expands to exceeds the - threshold. This filter roundtrip can limit the number of shards - significantly if for instance a shard can not match any documents based - on its rewrite method ie. if date filters are mandatory to match but the - shard bounds and the query are disjoint. + order to limit the number of concurrent shard requests. (default: 5) + :arg pre_filter_shard_size: Threshold that enforces a pre-filter + round-trip to prefilter search shards based on query rewriting if the + number of shards the search request expands to exceeds the threshold. + This filter round-trip can limit the number of shards significantly if + for instance a shard can not match any documents based on its rewrite + method ie. if date filters are mandatory to match but the shard bounds + and the query are disjoint. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg search_type: Search operation type Valid choices: - query_then_fetch, dfs_query_then_fetch + be rendered as an integer or an object in the rest search response. + (default: false) + :arg search_type: Search operation type. Valid choices: + query_then_fetch, query_and_fetch, dfs_query_then_fetch, + dfs_query_and_fetch :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response + should be prefixed by their respective types in the response. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1124,19 +1130,20 @@ def msearch_template(self, body, index=None, params=None, headers=None): :arg body: The request definitions (metadata-search request definition pairs), separated by newlines - :arg index: A comma-separated list of index names to use as - default + :arg index: Comma-separated list of indices to use as default. :arg ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg max_concurrent_searches: Controls the maximum number of - concurrent searches the multi search api will execute + concurrent searches the multi search api will execute. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg search_type: Search operation type Valid choices: - query_then_fetch, dfs_query_then_fetch + be rendered as an integer or an object in the rest search response. + (default: false) + :arg search_type: Search operation type. Valid choices: + query_then_fetch, query_and_fetch, dfs_query_then_fetch, + dfs_query_and_fetch :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response + should be prefixed by their respective types in the response. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1176,33 +1183,33 @@ def mtermvectors(self, body=None, index=None, params=None, headers=None): :arg field_statistics: Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified - in body "params" or "docs". Default: True - :arg fields: A comma-separated list of fields to return. Applies - to all returned documents unless otherwise specified in body "params" or - "docs". - :arg ids: A comma-separated list of documents ids. You must - define ids as parameter or set "ids" or "docs" in the request body + in body 'params' or 'docs'. (default: True) + :arg fields: Comma-separated list of fields to return. Applies + to all returned documents unless otherwise specified in body 'params' or + 'docs'. + :arg ids: Comma-separated list of documents ids. You must define + ids as parameter or set 'ids' or 'docs' in the request body. :arg offsets: Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body - "params" or "docs". Default: True + 'params' or 'docs'. (default: True) :arg payloads: Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body - "params" or "docs". Default: True + 'params' or 'docs'. (default: True) :arg positions: Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body - "params" or "docs". Default: True + 'params' or 'docs'. (default: True) :arg preference: Specify the node or shard the operation should - be performed on (default: random) .Applies to all returned documents - unless otherwise specified in body "params" or "docs". + be performed on. Applies to all returned documents unless otherwise + specified in body 'params' or 'docs'. (default: random) :arg realtime: Specifies if requests are real-time as opposed to - near-real-time (default: true). - :arg routing: Specific routing value. Applies to all returned - documents unless otherwise specified in body "params" or "docs". + near-real-time. (default: True) + :arg routing: Routing value. Applies to all returned documents + unless otherwise specified in body 'params' or 'docs'. :arg term_statistics: Specifies if total term frequency and document frequency should be returned. Applies to all returned documents - unless otherwise specified in body "params" or "docs". - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + unless otherwise specified in body 'params' or 'docs'. (default: false) + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ path = _make_path(index, "_mtermvectors") @@ -1211,18 +1218,21 @@ def mtermvectors(self, body=None, index=None, params=None, headers=None): "POST", path, params=params, headers=headers, body=body ) - @query_params("master_timeout", "cluster_manager_timeout", "timeout") + @query_params("cluster_manager_timeout", "master_timeout", "timeout") def put_script(self, id, body, context=None, params=None, headers=None): """ Creates or updates a script. - :arg id: Script ID + :arg id: Script ID. :arg body: The document - :arg context: Context name to compile script against - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + :arg context: Script context. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ for param in (id, body): if param in SKIP_IN_PATH: @@ -1242,27 +1252,22 @@ def put_script(self, id, body, context=None, params=None, headers=None): def rank_eval(self, body, index=None, params=None, headers=None): """ Allows to evaluate the quality of ranked search results over a set of typical - search queries - + search queries. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version :arg body: The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) - :arg search_type: Search operation type Valid choices: + should be ignored when unavailable (missing or closed). + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch """ if body in SKIP_IN_PATH: @@ -1296,24 +1301,24 @@ def reindex(self, body, params=None, headers=None): :arg body: The search definition using the Query DSL and the prototype for the index request. :arg max_docs: Maximum number of documents to process (default: - all documents) - :arg refresh: Should the affected indexes be refreshed? - :arg requests_per_second: The throttle to set on this request in - sub-requests per second. -1 means no throttle. - :arg scroll: Control how long to keep the search context alive - Default: 5m + all documents). + :arg refresh: Should the affected indexes be refreshed?. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. (default: 0) + :arg scroll: Specify how long a consistent view of the index + should be maintained for scrolled search. :arg slices: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be - set to `auto`. Default: 1 + set to `auto`. (default: 1) :arg timeout: Time each individual bulk request should wait for - shards that are unavailable. Default: 1m + shards that are unavailable. (default: 1m) :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the reindex operation. - Defaults to 1, meaning the primary shard only. Set to `all` for all - shard copies, otherwise set to any non-negative value less than or equal - to the total number of copies for the shard (number of replicas + 1) - :arg wait_for_completion: Should the request should block until - the reindex is complete. Default: True + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. (default: True) """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1328,9 +1333,9 @@ def reindex_rethrottle(self, task_id, params=None, headers=None): Changes the number of requests per second for a particular Reindex operation. - :arg task_id: The task id to rethrottle - :arg requests_per_second: The throttle to set on this request in - floating sub-requests per second. -1 means set no throttle. + :arg task_id: The task id to rethrottle. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") @@ -1349,7 +1354,7 @@ def render_search_template(self, body=None, id=None, params=None, headers=None): :arg body: The search definition template and its params - :arg id: The id of the stored search template + :arg id: The id of the stored search template. """ return self.transport.perform_request( "POST", @@ -1362,13 +1367,8 @@ def render_search_template(self, body=None, id=None, params=None, headers=None): @query_params() def scripts_painless_execute(self, body=None, params=None, headers=None): """ - Allows an arbitrary script to be executed and a result to be returned - - - .. warning:: + Allows an arbitrary script to be executed and a result to be returned. - This API is **experimental** so may include breaking changes - or be removed in a future version :arg body: The script to execute """ @@ -1388,11 +1388,12 @@ def scroll(self, body=None, scroll_id=None, params=None, headers=None): :arg body: The scroll ID if not passed by URL or query parameter. - :arg scroll_id: The scroll ID for scrolled search + :arg scroll_id: Scroll ID. :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. + (default: false) :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search + should be maintained for scrolled search. """ if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH: raise ValueError("You need to supply scroll_id or body.") @@ -1425,7 +1426,6 @@ def scroll(self, body=None, scroll_id=None, params=None, headers=None): "ignore_unavailable", "lenient", "max_concurrent_shard_requests", - "min_compatible_shard_node", "pre_filter_shard_size", "preference", "q", @@ -1456,101 +1456,99 @@ def search(self, body=None, index=None, params=None, headers=None): :arg body: The search definition using the Query DSL - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - be returned if there is a partial search failure or timeout Default: - True + be returned if there is a partial search failure or timeout. (default: + True) :arg analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. :arg batched_reduce_size: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. - Default: 512 + (default: 512) :arg ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg default_operator: The default operator for query string - query (AND or OR) Valid choices: AND, OR Default: OR + query (AND or OR). Valid choices: AND, OR :arg df: The field to use as default where no field prefix is - given in the query string - :arg docvalue_fields: A comma-separated list of fields to return - as the docvalue representation of a field for each hit + given in the query string. + :arg docvalue_fields: Comma-separated list of fields to return + as the docvalue representation of a field for each hit. :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :arg explain: Specify whether to return detailed information - about score computation as part of a hit - :arg from_: Starting offset (default: 0) + about score computation as part of a hit. + :arg from_: Starting offset. (default: 0) :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 - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg max_concurrent_shard_requests: The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order - to limit the number of concurrent shard requests Default: 5 - :arg min_compatible_shard_node: The minimum compatible version - that all shards involved in search should have for this request to be - successful - :arg pre_filter_shard_size: A threshold that enforces a pre- - filter roundtrip to prefilter search shards based on query rewriting if - the number of shards the search request expands to exceeds the - threshold. This filter roundtrip can limit the number of shards - significantly if for instance a shard can not match any documents based - on its rewrite method ie. if date filters are mandatory to match but the - shard bounds and the query are disjoint. + to limit the number of concurrent shard requests. (default: 5) + :arg pre_filter_shard_size: Threshold that enforces a pre-filter + round-trip to prefilter search shards based on query rewriting if the + number of shards the search request expands to exceeds the threshold. + This filter round-trip can limit the number of shards significantly if + for instance a shard can not match any documents based on its rewrite + method ie. if date filters are mandatory to match but the shard bounds + and the query are disjoint. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. :arg request_cache: Specify if request cache should be used for - this request or not, defaults to index level setting + this request or not, defaults to index level setting. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg routing: A comma-separated list of specific routing values + be rendered as an integer or an object in the rest search response. + (default: false) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg search_type: Search operation type Valid choices: + should be maintained for scrolled search. + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch :arg seq_no_primary_term: Specify whether to return sequence - number and primary term of the last modification of each hit - :arg size: Number of hits to return (default: 10) - :arg sort: A comma-separated list of : pairs + number and primary term of the last modification of each hit. + :arg size: Number of hits to return. (default: 10) + :arg sort: Comma-separated list of : pairs. :arg stats: Specific 'tag' of the request for logging and - statistical purposes - :arg stored_fields: A comma-separated list of stored fields to - return as part of a hit - :arg suggest_field: Specify which field to use for suggestions - :arg suggest_mode: Specify suggest mode Valid choices: missing, - popular, always Default: missing - :arg suggest_size: How many suggestions to return in response + statistical purposes. + :arg stored_fields: Comma-separated list of stored fields to + return. + :arg suggest_field: Specify which field to use for suggestions. + :arg suggest_mode: Specify suggest mode. Valid choices: + missing, popular, always + :arg suggest_size: How many suggestions to return in response. :arg suggest_text: The source text for which the suggestions - should be returned + should be returned. :arg terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - :arg timeout: Explicit operation timeout + :arg timeout: Operation timeout. :arg track_scores: Whether to calculate and return scores even - if they are not used for sorting + if they are not used for sorting. :arg track_total_hits: Indicate if the number of documents that - match the query should be tracked + match the query should be tracked. :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response - :arg version: Specify whether to return document version as part - of a hit + should be prefixed by their respective types in the response. + :arg version: Whether to return document version as part of a + hit. """ # from is a reserved word so it cannot be used, use from_ instead if "from_" in params: @@ -1578,21 +1576,21 @@ def search_shards(self, index=None, params=None, headers=None): executed against. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :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 - from cluster_manager node (default: false) + from cluster-manager node. (default: false) :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg routing: Specific routing value + be performed on. (default: random) + :arg routing: Routing value. """ return self.transport.perform_request( "GET", _make_path(index, "_search_shards"), params=params, headers=headers @@ -1619,35 +1617,37 @@ def search_template(self, body, index=None, params=None, headers=None): :arg body: The search definition template and its params - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 ccs_minimize_roundtrips: Indicates whether network round- trips should be minimized as part of cross-cluster search requests - execution Default: true + execution. (default: True) :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none :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 - aliased indices should be ignored when throttled + aliased indices should be ignored when throttled. :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg profile: Specify whether to profile the query execution + be performed on. (default: random) + :arg profile: Specify whether to profile the query execution. :arg rest_total_hits_as_int: Indicates whether hits.total should - be rendered as an integer or an object in the rest search response - :arg routing: A comma-separated list of specific routing values + be rendered as an integer or an object in the rest search response. + (default: false) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg search_type: Search operation type Valid choices: - query_then_fetch, dfs_query_then_fetch + should be maintained for scrolled search. + :arg search_type: Search operation type. Valid choices: + query_then_fetch, query_and_fetch, dfs_query_then_fetch, + dfs_query_and_fetch :arg typed_keys: Specify whether aggregation and suggester names - should be prefixed by their respective types in the response + should be prefixed by their respective types in the response. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -1682,27 +1682,27 @@ def termvectors(self, index, body=None, id=None, params=None, headers=None): :arg index: The index in which the document resides. :arg body: Define parameters and or supply a document to get termvectors for. See documentation. - :arg id: The id of the document, when not specified a doc param - should be supplied. + :arg id: Document ID. When not specified a doc param should be + supplied. :arg field_statistics: Specifies if document count, sum of document frequencies and sum of total term frequencies should be - returned. Default: True - :arg fields: A comma-separated list of fields to return. + returned. (default: True) + :arg fields: Comma-separated list of fields to return. :arg offsets: Specifies if term offsets should be returned. - Default: True + (default: True) :arg payloads: Specifies if term payloads should be returned. - Default: True + (default: True) :arg positions: Specifies if term positions should be returned. - Default: True + (default: True) :arg preference: Specify the node or shard the operation should - be performed on (default: random). + be performed on. (default: random) :arg realtime: Specifies if request is real-time as opposed to - near-real-time (default: true). - :arg routing: Specific routing value. + near-real-time. (default: True) + :arg routing: Routing value. :arg term_statistics: Specifies if total term frequency and - document frequency should be returned. - :arg version: Explicit version number for concurrency control - :arg version_type: Specific version type Valid choices: + document frequency should be returned. (default: false) + :arg version: Explicit version number for concurrency control. + :arg version_type: Specific version type. Valid choices: internal, external, external_gte, force """ if index in SKIP_IN_PATH: @@ -1733,38 +1733,36 @@ def update(self, index, id, body, params=None, headers=None): Updates a document with a script or partial document. - :arg index: The name of the index - :arg id: Document ID + :arg index: Index name. + :arg id: Document ID. :arg body: The request definition requires either `script` or partial `doc` :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field - :arg if_primary_term: only perform the update operation if the - last operation that has changed the document has the specified primary - term - :arg if_seq_no: only perform the update operation if the last - operation that has changed the document has the specified sequence - number - :arg lang: The script language (default: painless) + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. + :arg if_primary_term: only perform the operation if the last + operation that has changed the document has the specified primary term. + :arg if_seq_no: only perform the operation if the last operation + that has changed the document has the specified sequence number. + :arg lang: The script language. (default: painless) :arg refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. Valid choices: true, false, wait_for - :arg require_alias: When true, requires destination is an alias. - Default is false + :arg require_alias: When true, requires destination to be an + alias. (default: false) :arg retry_on_conflict: Specify how many times should the - operation be retried when a conflict occurs (default: 0) - :arg routing: Specific routing value - :arg timeout: Explicit operation timeout + operation be retried when a conflict occurs. (default: 0) + :arg routing: Routing value. + :arg timeout: Operation timeout. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the update operation. - Defaults to 1, meaning the primary shard only. Set to `all` for all - shard copies, otherwise set to any non-negative value less than or equal - to the total number of copies for the shard (number of replicas + 1) + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) """ for param in (index, id, body): if param in SKIP_IN_PATH: @@ -1809,7 +1807,6 @@ def update(self, index, id, body, params=None, headers=None): "terminate_after", "timeout", "version", - "version_type", "wait_for_active_shards", "wait_for_completion", ) @@ -1819,81 +1816,77 @@ def update_by_query(self, index, body=None, params=None, headers=None): for example to pick up a mapping change. - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg body: The search definition using the Query DSL - search; leave empty to perform the operation on all types :arg _source: True or false to return the _source field or not, - or a list of fields to return - :arg _source_excludes: A list of fields to exclude from the - returned _source field - :arg _source_includes: A list of fields to extract and return - from the _source field + or a list of fields to return. + :arg _source_excludes: List of fields to exclude from the + returned _source field. + :arg _source_includes: List of fields to extract and return from + the _source field. :arg allow_no_indices: Whether to ignore if a wildcard indices 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 analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed (default: false) - :arg analyzer: The analyzer to use for the query string - :arg conflicts: What to do when the update by query hits version - conflicts? Valid choices: abort, proceed Default: abort + queries should be analyzed. (default: false) + :arg analyzer: The analyzer to use for the query string. + :arg conflicts: What to do when the operation encounters version + conflicts?. Valid choices: abort, proceed :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 :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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg from_: Starting offset (default: 0) + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg from_: Starting offset. (default: 0) :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed) + should be ignored when unavailable (missing or closed). :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored + as providing text to a numeric field) should be ignored. :arg max_docs: Maximum number of documents to process (default: - all documents) - :arg pipeline: Ingest pipeline to set on index requests made by - this action. (default: none) + all documents). + :arg pipeline: The pipeline id to preprocess incoming documents + with. :arg preference: Specify the node or shard the operation should - be performed on (default: random) - :arg q: Query in the Lucene query string syntax - :arg refresh: Should the affected indexes be refreshed? + be performed on. (default: random) + :arg q: Query in the Lucene query string syntax. + :arg refresh: Should the affected indexes be refreshed?. :arg request_cache: Specify if request cache should be used for - this request or not, defaults to index level setting - :arg requests_per_second: The throttle to set on this request in - sub-requests per second. -1 means no throttle. - :arg routing: A comma-separated list of specific routing values + this request or not, defaults to index level setting. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. (default: 0) + :arg routing: Comma-separated list of specific routing values. :arg scroll: Specify how long a consistent view of the index - should be maintained for scrolled search - :arg scroll_size: Size on the scroll request powering the update - by query Default: 100 + should be maintained for scrolled search. + :arg scroll_size: Size on the scroll request powering the + operation. (default: 100) :arg search_timeout: Explicit timeout for each search request. Defaults to no timeout. - :arg search_type: Search operation type Valid choices: + :arg search_type: Search operation type. Valid choices: query_then_fetch, dfs_query_then_fetch - :arg size: Deprecated, please use `max_docs` instead + :arg size: Deprecated, please use `max_docs` instead. :arg slices: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be - set to `auto`. Default: 1 - :arg sort: A comma-separated list of : pairs + set to `auto`. (default: 1) + :arg sort: Comma-separated list of : pairs. :arg stats: Specific 'tag' of the request for logging and - statistical purposes + statistical purposes. :arg terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. :arg timeout: Time each individual bulk request should wait for - shards that are unavailable. Default: 1m - :arg version: Specify whether to return document version as part - of a hit - :arg version_type: Should the document increment the version - number (internal) on hit or not (reindex) + shards that are unavailable. (default: 1m) + :arg version: Whether to return document version as part of a + hit. :arg wait_for_active_shards: Sets the number of shard copies - that must be active before proceeding with the update by query - operation. Defaults to 1, meaning the primary shard only. Set to `all` - for all shard copies, otherwise set to any non-negative value less than - or equal to the total number of copies for the shard (number of replicas - + 1) - :arg wait_for_completion: Should the request should block until - the update by query operation is complete. Default: True + that must be active before proceeding with the operation. Defaults to 1, + meaning the primary shard only. Set to `all` for all shard copies, + otherwise set to any non-negative value less than or equal to the total + number of copies for the shard (number of replicas + 1). (default: 1) + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. (default: True) """ # from is a reserved word so it cannot be used, use from_ instead if "from_" in params: @@ -1917,9 +1910,9 @@ def update_by_query_rethrottle(self, task_id, params=None, headers=None): operation. - :arg task_id: The task id to rethrottle - :arg requests_per_second: The throttle to set on this request in - floating sub-requests per second. -1 means set no throttle. + :arg task_id: The task id to rethrottle. + :arg requests_per_second: The throttle for this request in sub- + requests per second. -1 means no throttle. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") @@ -1936,11 +1929,6 @@ def get_script_context(self, params=None, headers=None): """ Returns all script contexts. - - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version """ return self.transport.perform_request( "GET", "/_script_context", params=params, headers=headers @@ -1949,13 +1937,8 @@ def get_script_context(self, params=None, headers=None): @query_params() def get_script_languages(self, params=None, headers=None): """ - Returns available script types, languages and contexts + Returns available script types, languages and contexts. - - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version """ return self.transport.perform_request( "GET", "/_script_language", params=params, headers=headers @@ -1982,7 +1965,7 @@ def create_pit(self, index, params=None, headers=None): open, closed, hidden, none :arg keep_alive: Specify the keep alive for point in time. :arg preference: Specify the node or shard the operation should - be performed on. + be performed on. (default: random) :arg routing: Comma-separated list of specific routing values. """ if index in SKIP_IN_PATH: @@ -2025,36 +2008,8 @@ def delete_pit(self, body=None, params=None, headers=None): def get_all_pits(self, params=None, headers=None): """ Lists all active point in time searches. - """ - return self.transport.perform_request( - "GET", "/_search/point_in_time/_all", params=params, headers=headers - ) - @query_params() - def terms_enum(self, index, body=None, params=None, headers=None): """ - The terms enum API can be used to discover terms in the index that begin with - the provided string. It is designed for low-latency look-ups used in auto- - complete scenarios. - - - .. warning:: - - This API is **beta** so may include breaking changes - or be removed in a future version - - :arg index: A comma-separated list of index names to search; use - `_all` or empty string to perform the operation on all indices - :arg body: field name, string which is the prefix expected in - matching terms, timeout and size for max number of results - """ - if index in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'index'.") - return self.transport.perform_request( - "POST", - _make_path(index, "_terms_enum"), - params=params, - headers=headers, - body=body, + "GET", "/_search/point_in_time/_all", params=params, headers=headers ) diff --git a/opensearchpy/client/__init__.pyi b/opensearchpy/client/__init__.pyi index e1d1e359..5bf53ec7 100644 --- a/opensearchpy/client/__init__.pyi +++ b/opensearchpy/client/__init__.pyi @@ -25,6 +25,15 @@ # specific language governing permissions and limitations # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + from __future__ import unicode_literals import logging @@ -59,7 +68,10 @@ class OpenSearch(object): snapshot: SnapshotClient tasks: TasksClient def __init__( - self, hosts: Any = ..., transport_class: Type[Transport] = ..., **kwargs: Any + self, + hosts: Any = ..., + transport_class: Type[Transport] = ..., + **kwargs: Any, ) -> None: ... def __repr__(self) -> str: ... def __enter__(self) -> "OpenSearch": ... @@ -330,8 +342,8 @@ class OpenSearch(object): self, id: Any, *, - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -487,8 +499,8 @@ class OpenSearch(object): self, id: Any, *, - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -639,8 +651,8 @@ class OpenSearch(object): *, body: Any, context: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -799,7 +811,6 @@ class OpenSearch(object): ignore_unavailable: Optional[Any] = ..., lenient: Optional[Any] = ..., max_concurrent_shard_requests: Optional[Any] = ..., - min_compatible_shard_node: Optional[Any] = ..., pre_filter_shard_size: Optional[Any] = ..., preference: Optional[Any] = ..., q: Optional[Any] = ..., @@ -988,7 +999,6 @@ class OpenSearch(object): terminate_after: Optional[Any] = ..., timeout: Optional[Any] = ..., version: Optional[Any] = ..., - version_type: Optional[Any] = ..., wait_for_active_shards: Optional[Any] = ..., wait_for_completion: Optional[Any] = ..., pretty: Optional[bool] = ..., @@ -1125,21 +1135,3 @@ class OpenSearch(object): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def terms_enum( - self, - index: Any, - *, - body: Optional[Any] = ..., - pretty: Optional[bool] = ..., - human: Optional[bool] = ..., - error_trace: Optional[bool] = ..., - format: Optional[str] = ..., - filter_path: Optional[Union[str, Collection[str]]] = ..., - request_timeout: Optional[Union[int, float]] = ..., - ignore: Optional[Union[int, Collection[int]]] = ..., - opaque_id: Optional[str] = ..., - http_auth: Optional[Union[str, Tuple[str, str]]] = ..., - api_key: Optional[Union[str, Tuple[str, str]]] = ..., - params: Optional[MutableMapping[str, Any]] = ..., - headers: Optional[MutableMapping[str, str]] = ..., - ) -> Any: ... diff --git a/opensearchpy/client/_patch.pyi b/opensearchpy/client/_patch.pyi index be6e12a0..b01423b9 100644 --- a/opensearchpy/client/_patch.pyi +++ b/opensearchpy/client/_patch.pyi @@ -6,6 +6,7 @@ # # Modifications Copyright OpenSearch Contributors. See # GitHub history for details. + from typing import Any, Collection, MutableMapping, Optional, Tuple, Type, Union def list_all_point_in_time( diff --git a/opensearchpy/client/ingest.py b/opensearchpy/client/ingest.py index fb9d4f79..c846cb9d 100644 --- a/opensearchpy/client/ingest.py +++ b/opensearchpy/client/ingest.py @@ -117,7 +117,7 @@ def simulate(self, body, id=None, params=None, headers=None): :arg body: The simulate definition :arg id: Pipeline ID. :arg verbose: Verbose mode. Display data output for each - processor in executed pipeline. + processor in executed pipeline. (default: false) """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") diff --git a/opensearchpy/client/tasks.py b/opensearchpy/client/tasks.py index ff76a3a6..5e04ef2b 100644 --- a/opensearchpy/client/tasks.py +++ b/opensearchpy/client/tasks.py @@ -57,7 +57,8 @@ def list(self, params=None, headers=None): :arg actions: Comma-separated list of actions that should be returned. Leave empty to return all. - :arg detailed: Return detailed task information. + :arg detailed: Return detailed task information. (default: + false) :arg group_by: Group tasks by nodes or parent/child relationships. Valid choices: nodes, parents, none :arg nodes: Comma-separated list of node IDs or names to limit @@ -68,7 +69,7 @@ def list(self, params=None, headers=None): (node_id:task_number). Set to -1 to return all. :arg timeout: Operation timeout. :arg wait_for_completion: Should this request wait until the - operation has completed before returning. + operation has completed before returning. (default: false) """ return self.transport.perform_request( "GET", "/_tasks", params=params, headers=headers @@ -91,7 +92,7 @@ def cancel(self, task_id=None, params=None, headers=None): :arg parent_task_id: Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. :arg wait_for_completion: Should this request wait until the - operation has completed before returning. + operation has completed before returning. (default: false) """ return self.transport.perform_request( "POST", @@ -110,7 +111,7 @@ def get(self, task_id=None, params=None, headers=None): (node_id:task_number). :arg timeout: Operation timeout. :arg wait_for_completion: Should this request wait until the - operation has completed before returning. + operation has completed before returning. (default: false) """ if task_id in SKIP_IN_PATH: warnings.warn(