Skip to content

Commit

Permalink
Auto-generated code for main (#2521)
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Apr 5, 2024
1 parent fb88fbb commit 9a3277e
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 10 deletions.
21 changes: 21 additions & 0 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,7 @@ async def get(
id: str,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
force_synthetic_source: t.Optional[bool] = None,
human: t.Optional[bool] = None,
preference: t.Optional[str] = None,
pretty: t.Optional[bool] = None,
Expand All @@ -1958,6 +1959,10 @@ async def get(
:param index: Name of the index that contains the document.
:param id: Unique identifier of the document.
:param force_synthetic_source: Should this request force synthetic _source? Use
this to test if the mapping supports synthetic _source and to get a sense
of the worst case performance. Fetches with this enabled will be slower the
enabling synthetic source natively in the index.
:param preference: Specifies the node or shard the operation should be performed
on. Random by default.
:param realtime: If `true`, the request is real-time as opposed to near-real-time.
Expand Down Expand Up @@ -1989,6 +1994,8 @@ async def get(
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if force_synthetic_source is not None:
__query["force_synthetic_source"] = force_synthetic_source
if human is not None:
__query["human"] = human
if preference is not None:
Expand Down Expand Up @@ -2578,6 +2585,7 @@ async def mget(
docs: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
force_synthetic_source: t.Optional[bool] = None,
human: t.Optional[bool] = None,
ids: t.Optional[t.Union[str, t.Sequence[str]]] = None,
preference: t.Optional[str] = None,
Expand All @@ -2600,6 +2608,10 @@ async def mget(
or when a document in the `docs` array does not specify an index.
:param docs: The documents you want to retrieve. Required if no index is specified
in the request URI.
:param force_synthetic_source: Should this request force synthetic _source? Use
this to test if the mapping supports synthetic _source and to get a sense
of the worst case performance. Fetches with this enabled will be slower the
enabling synthetic source natively in the index.
:param ids: The IDs of the documents you want to retrieve. Allowed when the index
is specified in the request URI.
:param preference: Specifies the node or shard the operation should be performed
Expand Down Expand Up @@ -2634,6 +2646,8 @@ async def mget(
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if force_synthetic_source is not None:
__query["force_synthetic_source"] = force_synthetic_source
if human is not None:
__query["human"] = human
if preference is not None:
Expand Down Expand Up @@ -3677,6 +3691,7 @@ async def search(
ext: t.Optional[t.Mapping[str, t.Any]] = None,
fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
force_synthetic_source: t.Optional[bool] = None,
from_: t.Optional[int] = None,
highlight: t.Optional[t.Mapping[str, t.Any]] = None,
human: t.Optional[bool] = None,
Expand Down Expand Up @@ -3793,6 +3808,10 @@ async def search(
:param fields: Array of wildcard (`*`) patterns. The request returns values for
field names matching these patterns in the `hits.fields` property of the
response.
:param force_synthetic_source: Should this request force synthetic _source? Use
this to test if the mapping supports synthetic _source and to get a sense
of the worst case performance. Fetches with this enabled will be slower the
enabling synthetic source natively in the index.
:param from_: Starting document offset. Needs to be non-negative. By default,
you cannot page through more than 10,000 hits using the `from` and `size`
parameters. To page through more hits, use the `search_after` parameter.
Expand Down Expand Up @@ -3972,6 +3991,8 @@ async def search(
__query["expand_wildcards"] = expand_wildcards
if filter_path is not None:
__query["filter_path"] = filter_path
if force_synthetic_source is not None:
__query["force_synthetic_source"] = force_synthetic_source
if human is not None:
__query["human"] = human
if ignore_throttled is not None:
Expand Down
26 changes: 21 additions & 5 deletions elasticsearch/_async/client/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ async def delete_model(
*,
inference_id: str,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
Expand Down Expand Up @@ -85,7 +88,10 @@ async def get_model(
*,
inference_id: str,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
Expand Down Expand Up @@ -134,20 +140,24 @@ async def get_model(
)

@_rewrite_parameters(
body_fields=("input", "task_settings"),
body_fields=("input", "query", "task_settings"),
)
async def inference(
self,
*,
inference_id: str,
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[str] = None,
task_settings: t.Optional[t.Any] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
Expand All @@ -159,6 +169,7 @@ async def inference(
:param inference_id: The inference Id
:param input: Text input to the model. Either a string or an array of strings.
:param task_type: The task type
:param query: Query input, required for rerank task. Not required for other tasks.
:param task_settings: Optional task settings
"""
if inference_id in SKIP_IN_PATH:
Expand Down Expand Up @@ -190,6 +201,8 @@ async def inference(
if not __body:
if input is not None:
__body["input"] = input
if query is not None:
__body["query"] = query
if task_settings is not None:
__body["task_settings"] = task_settings
if not __body:
Expand Down Expand Up @@ -217,7 +230,10 @@ async def put_model(
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
body: t.Optional[t.Mapping[str, t.Any]] = None,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
Expand Down
15 changes: 15 additions & 0 deletions elasticsearch/_async/client/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ async def get_api_key(
realm_name: t.Optional[str] = None,
username: t.Optional[str] = None,
with_limited_by: t.Optional[bool] = None,
with_profile_uid: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Retrieves information for one or more API keys.
Expand All @@ -1123,6 +1124,8 @@ async def get_api_key(
:param with_limited_by: Return the snapshot of the owner user's role descriptors
associated with the API key. An API key's actual permission is the intersection
of its assigned role descriptors and the owner user's role descriptors.
:param with_profile_uid: Determines whether to also retrieve the profile uid,
for the API key owner principal, if it exists.
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_security/api_key"
Expand All @@ -1149,6 +1152,8 @@ async def get_api_key(
__query["username"] = username
if with_limited_by is not None:
__query["with_limited_by"] = with_limited_by
if with_profile_uid is not None:
__query["with_profile_uid"] = with_profile_uid
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET",
Expand Down Expand Up @@ -2375,7 +2380,9 @@ async def query_api_keys(
t.Union[str, t.Mapping[str, t.Any]],
]
] = None,
typed_keys: t.Optional[bool] = None,
with_limited_by: t.Optional[bool] = None,
with_profile_uid: t.Optional[bool] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand Down Expand Up @@ -2412,9 +2419,13 @@ async def query_api_keys(
:param sort: Other than `id`, all public fields of an API key are eligible for
sorting. In addition, sort can also be applied to the `_doc` field to sort
by index order.
:param typed_keys: Determines whether aggregation names are prefixed by their
respective types in the response.
:param with_limited_by: Return the snapshot of the owner user's role descriptors
associated with the API key. An API key's actual permission is the intersection
of its assigned role descriptors and the owner user's role descriptors.
:param with_profile_uid: Determines whether to also retrieve the profile uid,
for the API key owner principal, if it exists.
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_security/_query/api_key"
Expand All @@ -2439,8 +2450,12 @@ async def query_api_keys(
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if typed_keys is not None:
__query["typed_keys"] = typed_keys
if with_limited_by is not None:
__query["with_limited_by"] = with_limited_by
if with_profile_uid is not None:
__query["with_profile_uid"] = with_profile_uid
if not __body:
if aggregations is not None:
__body["aggregations"] = aggregations
Expand Down
21 changes: 21 additions & 0 deletions elasticsearch/_sync/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,7 @@ def get(
id: str,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
force_synthetic_source: t.Optional[bool] = None,
human: t.Optional[bool] = None,
preference: t.Optional[str] = None,
pretty: t.Optional[bool] = None,
Expand All @@ -1956,6 +1957,10 @@ def get(
:param index: Name of the index that contains the document.
:param id: Unique identifier of the document.
:param force_synthetic_source: Should this request force synthetic _source? Use
this to test if the mapping supports synthetic _source and to get a sense
of the worst case performance. Fetches with this enabled will be slower the
enabling synthetic source natively in the index.
:param preference: Specifies the node or shard the operation should be performed
on. Random by default.
:param realtime: If `true`, the request is real-time as opposed to near-real-time.
Expand Down Expand Up @@ -1987,6 +1992,8 @@ def get(
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if force_synthetic_source is not None:
__query["force_synthetic_source"] = force_synthetic_source
if human is not None:
__query["human"] = human
if preference is not None:
Expand Down Expand Up @@ -2576,6 +2583,7 @@ def mget(
docs: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
force_synthetic_source: t.Optional[bool] = None,
human: t.Optional[bool] = None,
ids: t.Optional[t.Union[str, t.Sequence[str]]] = None,
preference: t.Optional[str] = None,
Expand All @@ -2598,6 +2606,10 @@ def mget(
or when a document in the `docs` array does not specify an index.
:param docs: The documents you want to retrieve. Required if no index is specified
in the request URI.
:param force_synthetic_source: Should this request force synthetic _source? Use
this to test if the mapping supports synthetic _source and to get a sense
of the worst case performance. Fetches with this enabled will be slower the
enabling synthetic source natively in the index.
:param ids: The IDs of the documents you want to retrieve. Allowed when the index
is specified in the request URI.
:param preference: Specifies the node or shard the operation should be performed
Expand Down Expand Up @@ -2632,6 +2644,8 @@ def mget(
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if force_synthetic_source is not None:
__query["force_synthetic_source"] = force_synthetic_source
if human is not None:
__query["human"] = human
if preference is not None:
Expand Down Expand Up @@ -3675,6 +3689,7 @@ def search(
ext: t.Optional[t.Mapping[str, t.Any]] = None,
fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
force_synthetic_source: t.Optional[bool] = None,
from_: t.Optional[int] = None,
highlight: t.Optional[t.Mapping[str, t.Any]] = None,
human: t.Optional[bool] = None,
Expand Down Expand Up @@ -3791,6 +3806,10 @@ def search(
:param fields: Array of wildcard (`*`) patterns. The request returns values for
field names matching these patterns in the `hits.fields` property of the
response.
:param force_synthetic_source: Should this request force synthetic _source? Use
this to test if the mapping supports synthetic _source and to get a sense
of the worst case performance. Fetches with this enabled will be slower the
enabling synthetic source natively in the index.
:param from_: Starting document offset. Needs to be non-negative. By default,
you cannot page through more than 10,000 hits using the `from` and `size`
parameters. To page through more hits, use the `search_after` parameter.
Expand Down Expand Up @@ -3970,6 +3989,8 @@ def search(
__query["expand_wildcards"] = expand_wildcards
if filter_path is not None:
__query["filter_path"] = filter_path
if force_synthetic_source is not None:
__query["force_synthetic_source"] = force_synthetic_source
if human is not None:
__query["human"] = human
if ignore_throttled is not None:
Expand Down
26 changes: 21 additions & 5 deletions elasticsearch/_sync/client/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def delete_model(
*,
inference_id: str,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
Expand Down Expand Up @@ -85,7 +88,10 @@ def get_model(
*,
inference_id: str,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
Expand Down Expand Up @@ -134,20 +140,24 @@ def get_model(
)

@_rewrite_parameters(
body_fields=("input", "task_settings"),
body_fields=("input", "query", "task_settings"),
)
def inference(
self,
*,
inference_id: str,
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[str] = None,
task_settings: t.Optional[t.Any] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
Expand All @@ -159,6 +169,7 @@ def inference(
:param inference_id: The inference Id
:param input: Text input to the model. Either a string or an array of strings.
:param task_type: The task type
:param query: Query input, required for rerank task. Not required for other tasks.
:param task_settings: Optional task settings
"""
if inference_id in SKIP_IN_PATH:
Expand Down Expand Up @@ -190,6 +201,8 @@ def inference(
if not __body:
if input is not None:
__body["input"] = input
if query is not None:
__body["query"] = query
if task_settings is not None:
__body["task_settings"] = task_settings
if not __body:
Expand Down Expand Up @@ -217,7 +230,10 @@ def put_model(
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
body: t.Optional[t.Mapping[str, t.Any]] = None,
task_type: t.Optional[
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
t.Union[
"t.Literal['completion', 'rerank', 'sparse_embedding', 'text_embedding']",
str,
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
Expand Down

0 comments on commit 9a3277e

Please sign in to comment.