Skip to content

Commit

Permalink
Update APIs for 7.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Aug 5, 2021
1 parent c009b0a commit 5747874
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions elastic_enterprise_search/client/_workplace_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,24 +532,24 @@ def get_document(
ignore_status=ignore_status,
)

def delete_documents_by_query(
def delete_documents(
self,
content_source_id,
body,
document_ids,
params=None,
headers=None,
http_auth=DEFAULT,
request_timeout=DEFAULT,
ignore_status=(),
):
"""
Deletes documents by query in a custom content source
Deletes a list of documents from a custom content source
`<https://www.elastic.co/guide/en/workplace-search/7.14/workplace-search-custom-sources-api.html#delete-documents-by-query>`_
`<https://www.elastic.co/guide/en/workplace-search/7.14/workplace-search-custom-sources-api.html#delete-by-id>`_
:arg content_source_id: Unique ID for a Custom API source, provided upon
creation of a Custom API Source
:arg body: HTTP request body
:arg document_ids: HTTP request body
:arg params: Additional query params to send with the request
:arg headers: Additional headers to send with the request
:arg http_auth: Access token or HTTP basic auth username
Expand All @@ -559,76 +559,72 @@ def delete_documents_by_query(
:raises elastic_enterprise_search.BadRequestError:
:raises elastic_enterprise_search.UnauthorizedError:
:raises elastic_enterprise_search.NotFoundError:
:raises elastic_enterprise_search.PayloadTooLargeError:
"""
if content_source_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument")

params = QueryParams(params)

return self.perform_request(
"DELETE",
"POST",
to_path(
"api",
"ws",
"v1",
"sources",
content_source_id,
"documents",
"bulk_destroy",
),
body=body,
body=document_ids,
params=params,
headers=headers,
http_auth=http_auth,
request_timeout=request_timeout,
ignore_status=ignore_status,
)

def delete_documents(
def delete_all_documents(
self,
content_source_id,
document_ids,
params=None,
headers=None,
http_auth=DEFAULT,
request_timeout=DEFAULT,
ignore_status=(),
):
"""
Deletes a list of documents from a custom content source
Deletes all documents in a custom content source
`<https://www.elastic.co/guide/en/workplace-search/7.14/workplace-search-custom-sources-api.html#delete-by-id>`_
`<https://www.elastic.co/guide/en/workplace-search/7.14/workplace-search-custom-sources-api.html#delete-all-documents>`_
:arg content_source_id: Unique ID for a Custom API source, provided upon
creation of a Custom API Source
:arg document_ids: HTTP request body
:arg params: Additional query params to send with the request
:arg headers: Additional headers to send with the request
:arg http_auth: Access token or HTTP basic auth username
and password to send with the request
:arg request_timeout: Timeout in seconds
:arg ignore_status: HTTP status codes to not raise an error
:raises elastic_enterprise_search.BadRequestError:
:raises elastic_enterprise_search.UnauthorizedError:
:raises elastic_enterprise_search.NotFoundError:
:raises elastic_enterprise_search.PayloadTooLargeError:
"""
if content_source_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument")

params = QueryParams(params)

return self.perform_request(
"POST",
"DELETE",
to_path(
"api",
"ws",
"v1",
"sources",
content_source_id,
"documents",
"bulk_destroy",
),
body=document_ids,
params=params,
headers=headers,
http_auth=http_auth,
Expand Down

0 comments on commit 5747874

Please sign in to comment.