Skip to content

Commit

Permalink
API: Update Elasticsearch APIs for 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Oct 20, 2020
1 parent 6344ec4 commit 68f0077
Show file tree
Hide file tree
Showing 116 changed files with 2,258 additions and 700 deletions.
40 changes: 40 additions & 0 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ async def close(self):
async def ping(self, params=None, headers=None):
"""
Returns whether the cluster is running.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index.html>`_
"""
try:
Expand All @@ -279,6 +280,7 @@ async def ping(self, params=None, headers=None):
async def info(self, params=None, headers=None):
"""
Returns basic information about the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index.html>`_
"""
return await self.transport.perform_request(
Expand All @@ -298,6 +300,7 @@ async def create(self, index, id, body, doc_type=None, params=None, headers=None
"""
Creates a new document in the index. Returns a 409 response when a document
with a same ID already exists in the index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-index_.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -352,6 +355,7 @@ async def index(
):
"""
Creates or updates a document in an index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-index_.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -415,6 +419,7 @@ async def index(
async def bulk(self, body, index=None, doc_type=None, params=None, headers=None):
"""
Allows to perform multiple index/update/delete operations in a single request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html>`_
:arg body: The operation definition and data (action-data
Expand Down Expand Up @@ -461,6 +466,7 @@ async def bulk(self, body, index=None, doc_type=None, params=None, headers=None)
async def clear_scroll(self, body=None, scroll_id=None, params=None, headers=None):
"""
Explicitly clears the search context for a scroll.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/clear-scroll-api.html>`_
:arg body: A comma-separated list of scroll IDs to clear if none
Expand Down Expand Up @@ -499,6 +505,7 @@ async def count(
):
"""
Returns number of documents matching a query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-count.html>`_
:arg body: A query to restrict the results specified with the
Expand Down Expand Up @@ -556,6 +563,7 @@ async def count(
async def delete(self, index, id, doc_type=None, params=None, headers=None):
"""
Removes a document from the index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-delete.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -633,6 +641,7 @@ async def delete_by_query(
):
"""
Deletes documents matching the provided query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-delete-by-query.html>`_
:arg index: A comma-separated list of index names to search; use
Expand Down Expand Up @@ -729,6 +738,7 @@ async def delete_by_query_rethrottle(self, task_id, params=None, headers=None):
"""
Changes the number of requests per second for a particular Delete By Query
operation.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-delete-by-query.html>`_
:arg task_id: The task id to rethrottle
Expand All @@ -749,6 +759,7 @@ async def delete_by_query_rethrottle(self, task_id, params=None, headers=None):
async def delete_script(self, id, params=None, headers=None):
"""
Deletes a script.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-scripting.html>`_
:arg id: Script ID
Expand Down Expand Up @@ -777,6 +788,7 @@ async def delete_script(self, id, params=None, headers=None):
async def exists(self, index, id, doc_type=None, params=None, headers=None):
"""
Returns information about whether a document exists in an index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -827,6 +839,7 @@ async def exists(self, index, id, doc_type=None, params=None, headers=None):
async def exists_source(self, index, id, doc_type=None, params=None, headers=None):
"""
Returns information about whether a document source exists in an index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -882,6 +895,7 @@ async def explain(
):
"""
Returns information about why a specific matches (or doesn't match) a query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-explain.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -934,6 +948,7 @@ async def field_caps(self, body=None, index=None, params=None, headers=None):
"""
Returns the information about the capabilities of fields among multiple
indices.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-field-caps.html>`_
:arg body: An index filter specified with the Query DSL
Expand Down Expand Up @@ -974,6 +989,7 @@ async def field_caps(self, body=None, index=None, params=None, headers=None):
async def get(self, index, id, doc_type=None, params=None, headers=None):
"""
Returns a document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -1014,6 +1030,7 @@ async def get(self, index, id, doc_type=None, params=None, headers=None):
async def get_script(self, id, params=None, headers=None):
"""
Returns a script.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-scripting.html>`_
:arg id: Script ID
Expand All @@ -1040,6 +1057,7 @@ async def get_script(self, id, params=None, headers=None):
async def get_source(self, index, id, doc_type=None, params=None, headers=None):
"""
Returns the source of a document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -1089,6 +1107,7 @@ async def get_source(self, index, id, doc_type=None, params=None, headers=None):
async def mget(self, body, index=None, doc_type=None, params=None, headers=None):
"""
Allows to get multiple documents in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-multi-get.html>`_
:arg body: Document identifiers; can be either `docs`
Expand Down Expand Up @@ -1135,6 +1154,7 @@ async def mget(self, body, index=None, doc_type=None, params=None, headers=None)
async def msearch(self, body, index=None, doc_type=None, params=None, headers=None):
"""
Allows to execute several search operations in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-multi-search.html>`_
:arg body: The request definitions (metadata-search request
Expand Down Expand Up @@ -1191,6 +1211,7 @@ async def msearch_template(
):
"""
Allows to execute several search template operations in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-multi-search.html>`_
:arg body: The request definitions (metadata-search request
Expand Down Expand Up @@ -1243,6 +1264,7 @@ async def mtermvectors(
):
"""
Returns multiple termvectors in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-multi-termvectors.html>`_
:arg body: Define ids, documents, parameters or a list of
Expand Down Expand Up @@ -1295,6 +1317,7 @@ async def mtermvectors(
async def put_script(self, id, body, context=None, params=None, headers=None):
"""
Creates or updates a script.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-scripting.html>`_
:arg id: Script ID
Expand Down Expand Up @@ -1322,6 +1345,7 @@ 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
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-rank-eval.html>`_
:arg body: The ranking evaluation search definition, including
Expand Down Expand Up @@ -1365,6 +1389,7 @@ async def reindex(self, body, params=None, headers=None):
Allows to copy documents from one index to another, optionally filtering the
source documents by a query, changing the destination index settings, or
fetching the documents from a remote cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-reindex.html>`_
:arg body: The search definition using the Query DSL and the
Expand Down Expand Up @@ -1400,6 +1425,7 @@ async def reindex(self, body, params=None, headers=None):
async def reindex_rethrottle(self, task_id, params=None, headers=None):
"""
Changes the number of requests per second for a particular Reindex operation.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-reindex.html>`_
:arg task_id: The task id to rethrottle
Expand All @@ -1422,6 +1448,7 @@ async def render_search_template(
):
"""
Allows to use the Mustache language to pre-render a search definition.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-template.html#_validating_templates>`_
:arg body: The search definition template and its params
Expand All @@ -1439,6 +1466,7 @@ async def render_search_template(
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
`<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html>`_
:arg body: The script to execute
Expand All @@ -1455,6 +1483,7 @@ async def scripts_painless_execute(self, body=None, params=None, headers=None):
async def scroll(self, body=None, scroll_id=None, params=None, headers=None):
"""
Allows to retrieve a large numbers of results from a single search request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-request-body.html#request-body-search-scroll>`_
:arg body: The scroll ID if not passed by URL or query
Expand Down Expand Up @@ -1525,6 +1554,7 @@ async def search(
):
"""
Returns results matching a query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-search.html>`_
:arg body: The search definition using the Query DSL
Expand Down Expand Up @@ -1647,6 +1677,7 @@ async def search_shards(self, index=None, params=None, headers=None):
"""
Returns information about the indices and shards that a search request would be
executed against.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-shards.html>`_
:arg index: A comma-separated list of index names to search; use
Expand Down Expand Up @@ -1689,6 +1720,7 @@ async def search_template(
):
"""
Allows to use the Mustache language to pre-render a search definition.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-template.html>`_
:arg body: The search definition template and its params
Expand Down Expand Up @@ -1755,6 +1787,7 @@ async def termvectors(
"""
Returns information and statistics about terms in the fields of a particular
document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-termvectors.html>`_
:arg index: The index in which the document resides.
Expand Down Expand Up @@ -1813,6 +1846,7 @@ async def termvectors(
async def update(self, index, id, body, doc_type=None, params=None, headers=None):
"""
Updates a document with a script or partial document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-update.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -1905,6 +1939,7 @@ async def update_by_query(
"""
Performs an update on every document in the index without changing the source,
for example to pick up a mapping change.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-update-by-query.html>`_
:arg index: A comma-separated list of index names to search; use
Expand Down Expand Up @@ -2004,6 +2039,7 @@ async def update_by_query_rethrottle(self, task_id, params=None, headers=None):
"""
Changes the number of requests per second for a particular Update By Query
operation.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-update-by-query.html>`_
:arg task_id: The task id to rethrottle
Expand All @@ -2024,6 +2060,7 @@ async def update_by_query_rethrottle(self, task_id, params=None, headers=None):
async def get_script_context(self, params=None, headers=None):
"""
Returns all script contexts.
`<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html>`_
"""
return await self.transport.perform_request(
Expand All @@ -2034,6 +2071,7 @@ async def get_script_context(self, params=None, headers=None):
async def get_script_languages(self, params=None, headers=None):
"""
Returns available script types, languages and contexts
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-scripting.html>`_
"""
return await self.transport.perform_request(
Expand All @@ -2044,6 +2082,7 @@ async def get_script_languages(self, params=None, headers=None):
async def close_point_in_time(self, body=None, params=None, headers=None):
"""
Close a point in time
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/point-in-time-api.html>`_
:arg body: a point-in-time id to close
Expand All @@ -2058,6 +2097,7 @@ async def close_point_in_time(self, body=None, params=None, headers=None):
async def open_point_in_time(self, index=None, params=None, headers=None):
"""
Open a point in time that can be used in subsequent searches
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/point-in-time-api.html>`_
:arg index: A comma-separated list of index names to open point
Expand Down

0 comments on commit 68f0077

Please sign in to comment.