diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 185b31e3d..c7d190220 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -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, @@ -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. @@ -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: @@ -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, @@ -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 @@ -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: @@ -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, @@ -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. @@ -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: diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index ac0bb7908..07e4953cf 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -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, @@ -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, @@ -134,7 +140,7 @@ async def get_model( ) @_rewrite_parameters( - body_fields=("input", "task_settings"), + body_fields=("input", "query", "task_settings"), ) async def inference( self, @@ -142,12 +148,16 @@ async def inference( 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]: @@ -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: @@ -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: @@ -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, diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index 71ca4e4c3..3171ddfc8 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -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. @@ -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" @@ -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", @@ -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]: """ @@ -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" @@ -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 diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index d342466b8..2b722719b 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -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, @@ -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. @@ -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: @@ -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, @@ -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 @@ -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: @@ -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, @@ -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. @@ -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: diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 8490cbd9e..7d4a207ce 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -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, @@ -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, @@ -134,7 +140,7 @@ def get_model( ) @_rewrite_parameters( - body_fields=("input", "task_settings"), + body_fields=("input", "query", "task_settings"), ) def inference( self, @@ -142,12 +148,16 @@ def inference( 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]: @@ -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: @@ -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: @@ -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, diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index 3f0f021d4..2ce01eadb 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -1097,6 +1097,7 @@ 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. @@ -1123,6 +1124,8 @@ 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" @@ -1149,6 +1152,8 @@ 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 self.perform_request( # type: ignore[return-value] "GET", @@ -2375,7 +2380,9 @@ 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]: """ @@ -2412,9 +2419,13 @@ 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" @@ -2439,8 +2450,12 @@ 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