Skip to content

Commit

Permalink
API: Update Elasticsearch APIs for 8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Oct 20, 2020
1 parent 403ab50 commit 44ec60e
Show file tree
Hide file tree
Showing 120 changed files with 2,326 additions and 708 deletions.
40 changes: 40 additions & 0 deletions elasticsearch/_async/client/__init__.py
Expand Up @@ -262,6 +262,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/master/index.html>`_
"""
try:
Expand All @@ -275,6 +276,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/master/index.html>`_
"""
return await self.transport.perform_request(
Expand All @@ -294,6 +296,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/master/docs-index_.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -350,6 +353,7 @@ async def create(self, index, id, body, doc_type=None, params=None, headers=None
async def index(self, index, body, id=None, params=None, headers=None):
"""
Creates or updates a document in an index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -409,6 +413,7 @@ async def index(self, index, body, id=None, params=None, headers=None):
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/master/docs-bulk.html>`_
:arg body: The operation definition and data (action-data
Expand Down Expand Up @@ -455,6 +460,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/master/clear-scroll-api.html>`_
:arg body: A comma-separated list of scroll IDs to clear if none
Expand Down Expand Up @@ -491,6 +497,7 @@ async def clear_scroll(self, body=None, scroll_id=None, params=None, headers=Non
async def count(self, body=None, index=None, params=None, headers=None):
"""
Returns number of documents matching a query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html>`_
:arg body: A query to restrict the results specified with the
Expand Down Expand Up @@ -546,6 +553,7 @@ async def count(self, body=None, index=None, params=None, headers=None):
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/master/docs-delete.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -620,6 +628,7 @@ async def delete(self, index, id, doc_type=None, params=None, headers=None):
async def delete_by_query(self, index, body, params=None, headers=None):
"""
Deletes documents matching the provided query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html>`_
:arg index: A comma-separated list of index names to search; use
Expand Down Expand Up @@ -713,6 +722,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/master/docs-delete-by-query.html>`_
:arg task_id: The task id to rethrottle
Expand All @@ -733,6 +743,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/master/modules-scripting.html>`_
:arg id: Script ID
Expand Down Expand Up @@ -761,6 +772,7 @@ async def delete_script(self, id, params=None, headers=None):
async def exists(self, index, id, params=None, headers=None):
"""
Returns information about whether a document exists in an index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -806,6 +818,7 @@ async def exists(self, index, id, 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/master/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -857,6 +870,7 @@ async def exists_source(self, index, id, doc_type=None, params=None, headers=Non
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.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -907,6 +921,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/master/search-field-caps.html>`_
:arg body: An index filter specified with the Query DSL
Expand Down Expand Up @@ -947,6 +962,7 @@ async def field_caps(self, body=None, index=None, params=None, headers=None):
async def get(self, index, id, params=None, headers=None):
"""
Returns a document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -982,6 +998,7 @@ async def get(self, index, id, 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/master/modules-scripting.html>`_
:arg id: Script ID
Expand All @@ -1008,6 +1025,7 @@ async def get_script(self, id, params=None, headers=None):
async def get_source(self, index, id, params=None, headers=None):
"""
Returns the source of a document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -1050,6 +1068,7 @@ async def get_source(self, index, id, params=None, headers=None):
async def mget(self, body, index=None, params=None, headers=None):
"""
Allows to get multiple documents in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html>`_
:arg body: Document identifiers; can be either `docs`
Expand Down Expand Up @@ -1095,6 +1114,7 @@ async def mget(self, body, index=None, params=None, headers=None):
async def msearch(self, body, index=None, params=None, headers=None):
"""
Allows to execute several search operations in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html>`_
:arg body: The request definitions (metadata-search request
Expand Down Expand Up @@ -1141,6 +1161,7 @@ async def msearch(self, body, index=None, params=None, headers=None):
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/master/modules-scripting.html>`_
:arg id: Script ID
Expand Down Expand Up @@ -1168,6 +1189,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/master/search-rank-eval.html>`_
:arg body: The ranking evaluation search definition, including
Expand Down Expand Up @@ -1211,6 +1233,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/master/docs-reindex.html>`_
:arg body: The search definition using the Query DSL and the
Expand Down Expand Up @@ -1246,6 +1269,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/master/docs-reindex.html>`_
:arg task_id: The task id to rethrottle
Expand All @@ -1268,6 +1292,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/master/search-template.html#_validating_templates>`_
:arg body: The search definition template and its params
Expand All @@ -1285,6 +1310,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 @@ -1301,6 +1327,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/master/search-request-body.html#request-body-search-scroll>`_
:arg body: The scroll ID if not passed by URL or query
Expand Down Expand Up @@ -1369,6 +1396,7 @@ async def scroll(self, body=None, scroll_id=None, params=None, headers=None):
async def search(self, body=None, index=None, params=None, headers=None):
"""
Returns results matching a query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html>`_
:arg body: The search definition using the Query DSL
Expand Down Expand Up @@ -1490,6 +1518,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/master/search-shards.html>`_
:arg index: A comma-separated list of index names to search; use
Expand Down Expand Up @@ -1529,6 +1558,7 @@ async def search_shards(self, index=None, params=None, headers=None):
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/master/docs-update.html>`_
:arg index: The name of the index
Expand Down Expand Up @@ -1583,6 +1613,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/master/docs-update-by-query.html>`_
:arg task_id: The task id to rethrottle
Expand All @@ -1603,6 +1634,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 @@ -1613,6 +1645,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/master/modules-scripting.html>`_
"""
return await self.transport.perform_request(
Expand All @@ -1629,6 +1662,7 @@ async def get_script_languages(self, params=None, headers=None):
async def msearch_template(self, body, index=None, params=None, headers=None):
"""
Allows to execute several search template operations in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html>`_
:arg body: The request definitions (metadata-search request
Expand Down Expand Up @@ -1677,6 +1711,7 @@ async def msearch_template(self, body, index=None, params=None, headers=None):
async def mtermvectors(self, body=None, index=None, params=None, headers=None):
"""
Returns multiple termvectors in one request.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html>`_
:arg body: Define ids, documents, parameters or a list of
Expand Down Expand Up @@ -1741,6 +1776,7 @@ async def mtermvectors(self, body=None, index=None, params=None, headers=None):
async def search_template(self, body, index=None, params=None, headers=None):
"""
Allows to use the Mustache language to pre-render a search definition.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-template.html>`_
:arg body: The search definition template and its params
Expand Down Expand Up @@ -1803,6 +1839,7 @@ async def termvectors(self, index, body=None, id=None, params=None, headers=None
"""
Returns information and statistics about terms in the fields of a particular
document.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html>`_
:arg index: The index in which the document resides.
Expand Down Expand Up @@ -1882,6 +1919,7 @@ async def update_by_query(self, index, body=None, params=None, headers=None):
"""
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/master/docs-update-by-query.html>`_
:arg index: A comma-separated list of index names to search; use
Expand Down Expand Up @@ -1977,6 +2015,7 @@ async def update_by_query(self, index, body=None, 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/master/point-in-time-api.html>`_
:arg body: a point-in-time id to close
Expand All @@ -1991,6 +2030,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/master/point-in-time-api.html>`_
:arg index: A comma-separated list of index names to open point
Expand Down

0 comments on commit 44ec60e

Please sign in to comment.