Skip to content

Commit

Permalink
[Backport 8.10] Update APIs to 8.10 (#179)
Browse files Browse the repository at this point in the history
* Update APIs to 8.10 (#175)

(cherry picked from commit f8ef115)

Co-authored-by: Quentin Pradet <[email protected]>
  • Loading branch information
github-actions[bot] and pquentin authored Oct 11, 2023
1 parent c67f2c6 commit f0e263f
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 18 deletions.
22 changes: 13 additions & 9 deletions elastic_enterprise_search/_async/client/app_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@ async def search(
engine_name: str,
query: str,
analytics: t.Optional[t.Mapping[str, t.Any]] = None,
boost: t.Optional[t.Mapping[str, t.Any]] = None,
boosts: t.Optional[t.Mapping[str, t.Any]] = None,
current_page: t.Optional[int] = None,
facets: t.Optional[t.Mapping[str, t.Any]] = None,
filters: t.Optional[t.Mapping[str, t.Any]] = None,
Expand All @@ -2341,7 +2341,7 @@ async def search(
:param engine_name: Name of the engine
:param query:
:param analytics:
:param boost:
:param boosts:
:param current_page:
:param facets:
:param filters:
Expand All @@ -2360,8 +2360,8 @@ async def search(
__body["query"] = query
if analytics is not None:
__body["analytics"] = analytics
if boost is not None:
__body["boost"] = boost
if boosts is not None:
__body["boosts"] = boosts
if current_page is not None:
__body.setdefault("page", {})
__body["page"]["current"] = current_page
Expand Down Expand Up @@ -2431,7 +2431,7 @@ async def search_explain(
engine_name: str,
query: str,
analytics: t.Optional[t.Mapping[str, t.Any]] = None,
boost: t.Optional[t.Mapping[str, t.Any]] = None,
boosts: t.Optional[t.Mapping[str, t.Any]] = None,
current_page: t.Optional[int] = None,
facets: t.Optional[t.Mapping[str, t.Any]] = None,
filters: t.Optional[t.Mapping[str, t.Any]] = None,
Expand All @@ -2451,7 +2451,7 @@ async def search_explain(
:param engine_name: Name of the engine
:param query:
:param analytics:
:param boost:
:param boosts:
:param current_page:
:param facets:
:param filters:
Expand All @@ -2470,8 +2470,8 @@ async def search_explain(
__body["query"] = query
if analytics is not None:
__body["analytics"] = analytics
if boost is not None:
__body["boost"] = boost
if boosts is not None:
__body["boosts"] = boosts
if current_page is not None:
__body.setdefault("page", {})
__body["page"]["current"] = current_page
Expand All @@ -2493,7 +2493,7 @@ async def search_explain(
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
f"/api/as/v0/engines/{_quote(engine_name)}/search_explain",
f"/api/as/v1/engines/{_quote(engine_name)}/search_explain",
body=__body,
headers=__headers,
)
Expand Down Expand Up @@ -2529,6 +2529,7 @@ async def put_search_settings(
engine_name: str,
boosts: t.Optional[t.Mapping[str, t.Any]] = None,
precision: t.Optional[int] = None,
precision_enabled: t.Optional[bool] = None,
result_fields: t.Optional[t.Mapping[str, t.Any]] = None,
search_fields: t.Optional[t.Mapping[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
Expand All @@ -2540,6 +2541,7 @@ async def put_search_settings(
:param engine_name: Name of the engine
:param boosts:
:param precision:
:param precision_enabled:
:param result_fields:
:param search_fields:
"""
Expand All @@ -2550,6 +2552,8 @@ async def put_search_settings(
__body["boosts"] = boosts
if precision is not None:
__body["precision"] = precision
if precision_enabled is not None:
__body["precision_enabled"] = precision_enabled
if result_fields is not None:
__body["result_fields"] = result_fields
if search_fields is not None:
Expand Down
52 changes: 52 additions & 0 deletions elastic_enterprise_search/_async/client/enterprise_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,58 @@ async def get_stats(
"GET", "/api/ent/v1/internal/stats", params=__query, headers=__headers
)

@_rewrite_parameters()
async def get_storage(
self,
) -> ObjectApiResponse[t.Any]:
"""
Get information on the application indices and the space used
`<https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#get-storage-api>`_
"""
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET", "/api/ent/v1/internal/storage", headers=__headers
)

@_rewrite_parameters()
async def get_stale_storage(
self,
) -> ObjectApiResponse[t.Any]:
"""
Get information on the outdated application indices
`<https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#get-stale-storage-api>`_
"""
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET", "/api/ent/v1/internal/storage/stale", headers=__headers
)

@_rewrite_parameters()
async def delete_stale_storage(
self,
*,
force: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Cleanup outdated application indices
`<https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#delete-stale-storage-api>`_
:param force: The value for the "force" flag
"""
__query: t.Dict[str, t.Any] = {}
if force is not None:
__query["force"] = force
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"DELETE",
"/api/ent/v1/internal/storage/stale",
params=__query,
headers=__headers,
)

@_rewrite_parameters()
async def get_version(
self,
Expand Down
22 changes: 13 additions & 9 deletions elastic_enterprise_search/_sync/client/app_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@ def search(
engine_name: str,
query: str,
analytics: t.Optional[t.Mapping[str, t.Any]] = None,
boost: t.Optional[t.Mapping[str, t.Any]] = None,
boosts: t.Optional[t.Mapping[str, t.Any]] = None,
current_page: t.Optional[int] = None,
facets: t.Optional[t.Mapping[str, t.Any]] = None,
filters: t.Optional[t.Mapping[str, t.Any]] = None,
Expand All @@ -2341,7 +2341,7 @@ def search(
:param engine_name: Name of the engine
:param query:
:param analytics:
:param boost:
:param boosts:
:param current_page:
:param facets:
:param filters:
Expand All @@ -2360,8 +2360,8 @@ def search(
__body["query"] = query
if analytics is not None:
__body["analytics"] = analytics
if boost is not None:
__body["boost"] = boost
if boosts is not None:
__body["boosts"] = boosts
if current_page is not None:
__body.setdefault("page", {})
__body["page"]["current"] = current_page
Expand Down Expand Up @@ -2431,7 +2431,7 @@ def search_explain(
engine_name: str,
query: str,
analytics: t.Optional[t.Mapping[str, t.Any]] = None,
boost: t.Optional[t.Mapping[str, t.Any]] = None,
boosts: t.Optional[t.Mapping[str, t.Any]] = None,
current_page: t.Optional[int] = None,
facets: t.Optional[t.Mapping[str, t.Any]] = None,
filters: t.Optional[t.Mapping[str, t.Any]] = None,
Expand All @@ -2451,7 +2451,7 @@ def search_explain(
:param engine_name: Name of the engine
:param query:
:param analytics:
:param boost:
:param boosts:
:param current_page:
:param facets:
:param filters:
Expand All @@ -2470,8 +2470,8 @@ def search_explain(
__body["query"] = query
if analytics is not None:
__body["analytics"] = analytics
if boost is not None:
__body["boost"] = boost
if boosts is not None:
__body["boosts"] = boosts
if current_page is not None:
__body.setdefault("page", {})
__body["page"]["current"] = current_page
Expand All @@ -2493,7 +2493,7 @@ def search_explain(
__headers = {"accept": "application/json", "content-type": "application/json"}
return self.perform_request( # type: ignore[return-value]
"POST",
f"/api/as/v0/engines/{_quote(engine_name)}/search_explain",
f"/api/as/v1/engines/{_quote(engine_name)}/search_explain",
body=__body,
headers=__headers,
)
Expand Down Expand Up @@ -2529,6 +2529,7 @@ def put_search_settings(
engine_name: str,
boosts: t.Optional[t.Mapping[str, t.Any]] = None,
precision: t.Optional[int] = None,
precision_enabled: t.Optional[bool] = None,
result_fields: t.Optional[t.Mapping[str, t.Any]] = None,
search_fields: t.Optional[t.Mapping[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
Expand All @@ -2540,6 +2541,7 @@ def put_search_settings(
:param engine_name: Name of the engine
:param boosts:
:param precision:
:param precision_enabled:
:param result_fields:
:param search_fields:
"""
Expand All @@ -2550,6 +2552,8 @@ def put_search_settings(
__body["boosts"] = boosts
if precision is not None:
__body["precision"] = precision
if precision_enabled is not None:
__body["precision_enabled"] = precision_enabled
if result_fields is not None:
__body["result_fields"] = result_fields
if search_fields is not None:
Expand Down
52 changes: 52 additions & 0 deletions elastic_enterprise_search/_sync/client/enterprise_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,58 @@ def get_stats(
"GET", "/api/ent/v1/internal/stats", params=__query, headers=__headers
)

@_rewrite_parameters()
def get_storage(
self,
) -> ObjectApiResponse[t.Any]:
"""
Get information on the application indices and the space used
`<https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#get-storage-api>`_
"""
__headers = {"accept": "application/json"}
return self.perform_request( # type: ignore[return-value]
"GET", "/api/ent/v1/internal/storage", headers=__headers
)

@_rewrite_parameters()
def get_stale_storage(
self,
) -> ObjectApiResponse[t.Any]:
"""
Get information on the outdated application indices
`<https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#get-stale-storage-api>`_
"""
__headers = {"accept": "application/json"}
return self.perform_request( # type: ignore[return-value]
"GET", "/api/ent/v1/internal/storage/stale", headers=__headers
)

@_rewrite_parameters()
def delete_stale_storage(
self,
*,
force: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Cleanup outdated application indices
`<https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#delete-stale-storage-api>`_
:param force: The value for the "force" flag
"""
__query: t.Dict[str, t.Any] = {}
if force is not None:
__query["force"] = force
__headers = {"accept": "application/json"}
return self.perform_request( # type: ignore[return-value]
"DELETE",
"/api/ent/v1/internal/storage/stale",
params=__query,
headers=__headers,
)

@_rewrite_parameters()
def get_version(
self,
Expand Down

0 comments on commit f0e263f

Please sign in to comment.