Skip to content

Commit 26307f1

Browse files
Auto-generated API code
1 parent b45f50e commit 26307f1

File tree

15 files changed

+464
-39
lines changed

15 files changed

+464
-39
lines changed

elasticsearch/_async/client/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ async def knn_search(
30503050
</ul>
30513051
30523052
3053-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/knn-search-api.html>`_
3053+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-knn-search>`_
30543054
30553055
:param index: A comma-separated list of index names to search; use `_all` or
30563056
to perform the operation on all indices.
@@ -4388,7 +4388,7 @@ async def scripts_painless_execute(
43884388
<p>Each context requires a script, but additional parameters depend on the context you're using for that script.</p>
43894389
43904390
4391-
`<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html>`_
4391+
`<https://www.elastic.co/docs/reference/scripting-languages/painless/painless-api-examples>`_
43924392
43934393
:param context: The context that the script should run in. NOTE: Result ordering
43944394
in the field contexts is not guaranteed.

elasticsearch/_async/client/esql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ async def query(
416416
Get search results for an ES|QL (Elasticsearch query language) query.</p>
417417
418418
419-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-rest.html>`_
419+
`<https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql-rest>`_
420420
421421
:param query: The ES|QL query API accepts an ES|QL query string in the query
422422
parameter, runs it, and returns the results.

elasticsearch/_async/client/fleet.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ async def msearch(
155155
example, a request targeting foo*,bar* returns an error if an index starts
156156
with foo but no index starts with bar.
157157
:param allow_partial_search_results: If true, returns partial results if there
158-
are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures).
159-
If false, returns an error with no partial results. Defaults to the configured
160-
cluster setting `search.default_allow_partial_results` which is true by default.
158+
are shard request timeouts or shard failures. If false, returns an error
159+
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
160+
which is true by default.
161161
:param ccs_minimize_roundtrips: If true, network roundtrips between the coordinating
162162
node and remote clusters are minimized for cross-cluster search requests.
163163
:param expand_wildcards: Type of index that wildcard expressions can match. If
@@ -401,9 +401,9 @@ async def search(
401401
:param aggs:
402402
:param allow_no_indices:
403403
:param allow_partial_search_results: If true, returns partial results if there
404-
are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures).
405-
If false, returns an error with no partial results. Defaults to the configured
406-
cluster setting `search.default_allow_partial_results` which is true by default.
404+
are shard request timeouts or shard failures. If false, returns an error
405+
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
406+
which is true by default.
407407
:param analyze_wildcard:
408408
:param analyzer:
409409
:param batched_reduce_size:

elasticsearch/_async/client/inference.py

+218
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,224 @@ async def get(
234234
path_parts=__path_parts,
235235
)
236236

237+
@_rewrite_parameters(
238+
body_fields=("input", "query", "task_settings"),
239+
)
240+
async def inference(
241+
self,
242+
*,
243+
inference_id: str,
244+
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
245+
task_type: t.Optional[
246+
t.Union[
247+
str,
248+
t.Literal[
249+
"chat_completion",
250+
"completion",
251+
"rerank",
252+
"sparse_embedding",
253+
"text_embedding",
254+
],
255+
]
256+
] = None,
257+
error_trace: t.Optional[bool] = None,
258+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
259+
human: t.Optional[bool] = None,
260+
pretty: t.Optional[bool] = None,
261+
query: t.Optional[str] = None,
262+
task_settings: t.Optional[t.Any] = None,
263+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
264+
body: t.Optional[t.Dict[str, t.Any]] = None,
265+
) -> ObjectApiResponse[t.Any]:
266+
"""
267+
.. raw:: html
268+
269+
<p>Perform inference on the service.</p>
270+
<p>This API enables you to use machine learning models to perform specific tasks on data that you provide as an input.
271+
It returns a response with the results of the tasks.
272+
The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.</p>
273+
<p>For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation.</p>
274+
<blockquote>
275+
<p>info
276+
The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.</p>
277+
</blockquote>
278+
279+
280+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference>`_
281+
282+
:param inference_id: The unique identifier for the inference endpoint.
283+
:param input: The text on which you want to perform the inference task. It can
284+
be a single string or an array. > info > Inference endpoints for the `completion`
285+
task type currently only support a single string as input.
286+
:param task_type: The type of inference task that the model performs.
287+
:param query: The query input, which is required only for the `rerank` task.
288+
It is not required for other tasks.
289+
:param task_settings: Task settings for the individual inference request. These
290+
settings are specific to the task type you specified and override the task
291+
settings specified when initializing the service.
292+
:param timeout: The amount of time to wait for the inference request to complete.
293+
"""
294+
if inference_id in SKIP_IN_PATH:
295+
raise ValueError("Empty value passed for parameter 'inference_id'")
296+
if input is None and body is None:
297+
raise ValueError("Empty value passed for parameter 'input'")
298+
__path_parts: t.Dict[str, str]
299+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
300+
__path_parts = {
301+
"task_type": _quote(task_type),
302+
"inference_id": _quote(inference_id),
303+
}
304+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}'
305+
elif inference_id not in SKIP_IN_PATH:
306+
__path_parts = {"inference_id": _quote(inference_id)}
307+
__path = f'/_inference/{__path_parts["inference_id"]}'
308+
else:
309+
raise ValueError("Couldn't find a path for the given parameters")
310+
__query: t.Dict[str, t.Any] = {}
311+
__body: t.Dict[str, t.Any] = body if body is not None else {}
312+
if error_trace is not None:
313+
__query["error_trace"] = error_trace
314+
if filter_path is not None:
315+
__query["filter_path"] = filter_path
316+
if human is not None:
317+
__query["human"] = human
318+
if pretty is not None:
319+
__query["pretty"] = pretty
320+
if timeout is not None:
321+
__query["timeout"] = timeout
322+
if not __body:
323+
if input is not None:
324+
__body["input"] = input
325+
if query is not None:
326+
__body["query"] = query
327+
if task_settings is not None:
328+
__body["task_settings"] = task_settings
329+
if not __body:
330+
__body = None # type: ignore[assignment]
331+
__headers = {"accept": "application/json"}
332+
if __body is not None:
333+
__headers["content-type"] = "application/json"
334+
return await self.perform_request( # type: ignore[return-value]
335+
"POST",
336+
__path,
337+
params=__query,
338+
headers=__headers,
339+
body=__body,
340+
endpoint_id="inference.inference",
341+
path_parts=__path_parts,
342+
)
343+
344+
@_rewrite_parameters(
345+
body_fields=("input", "query", "task_settings"),
346+
)
347+
@_stability_warning(
348+
Stability.DEPRECATED,
349+
version="8.18.0",
350+
message="inference.inference() is deprecated in favor of provider-specific APIs such as inference.put_elasticsearch() or inference.put_hugging_face()",
351+
)
352+
async def inference(
353+
self,
354+
*,
355+
inference_id: str,
356+
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
357+
task_type: t.Optional[
358+
t.Union[
359+
str,
360+
t.Literal[
361+
"chat_completion",
362+
"completion",
363+
"rerank",
364+
"sparse_embedding",
365+
"text_embedding",
366+
],
367+
]
368+
] = None,
369+
error_trace: t.Optional[bool] = None,
370+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
371+
human: t.Optional[bool] = None,
372+
pretty: t.Optional[bool] = None,
373+
query: t.Optional[str] = None,
374+
task_settings: t.Optional[t.Any] = None,
375+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
376+
body: t.Optional[t.Dict[str, t.Any]] = None,
377+
) -> ObjectApiResponse[t.Any]:
378+
"""
379+
.. raw:: html
380+
381+
<p>Perform inference on the service.</p>
382+
<p>This API enables you to use machine learning models to perform specific tasks on data that you provide as an input.
383+
It returns a response with the results of the tasks.
384+
The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.</p>
385+
<blockquote>
386+
<p>info
387+
The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.</p>
388+
</blockquote>
389+
390+
391+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference>`_
392+
393+
:param inference_id: The unique identifier for the inference endpoint.
394+
:param input: The text on which you want to perform the inference task. It can
395+
be a single string or an array. > info > Inference endpoints for the `completion`
396+
task type currently only support a single string as input.
397+
:param task_type: The type of inference task that the model performs.
398+
:param query: The query input, which is required only for the `rerank` task.
399+
It is not required for other tasks.
400+
:param task_settings: Task settings for the individual inference request. These
401+
settings are specific to the task type you specified and override the task
402+
settings specified when initializing the service.
403+
:param timeout: The amount of time to wait for the inference request to complete.
404+
"""
405+
if inference_id in SKIP_IN_PATH:
406+
raise ValueError("Empty value passed for parameter 'inference_id'")
407+
if input is None and body is None:
408+
raise ValueError("Empty value passed for parameter 'input'")
409+
__path_parts: t.Dict[str, str]
410+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
411+
__path_parts = {
412+
"task_type": _quote(task_type),
413+
"inference_id": _quote(inference_id),
414+
}
415+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}'
416+
elif inference_id not in SKIP_IN_PATH:
417+
__path_parts = {"inference_id": _quote(inference_id)}
418+
__path = f'/_inference/{__path_parts["inference_id"]}'
419+
else:
420+
raise ValueError("Couldn't find a path for the given parameters")
421+
__query: t.Dict[str, t.Any] = {}
422+
__body: t.Dict[str, t.Any] = body if body is not None else {}
423+
if error_trace is not None:
424+
__query["error_trace"] = error_trace
425+
if filter_path is not None:
426+
__query["filter_path"] = filter_path
427+
if human is not None:
428+
__query["human"] = human
429+
if pretty is not None:
430+
__query["pretty"] = pretty
431+
if timeout is not None:
432+
__query["timeout"] = timeout
433+
if not __body:
434+
if input is not None:
435+
__body["input"] = input
436+
if query is not None:
437+
__body["query"] = query
438+
if task_settings is not None:
439+
__body["task_settings"] = task_settings
440+
if not __body:
441+
__body = None # type: ignore[assignment]
442+
__headers = {"accept": "application/json"}
443+
if __body is not None:
444+
__headers["content-type"] = "application/json"
445+
return await self.perform_request( # type: ignore[return-value]
446+
"POST",
447+
__path,
448+
params=__query,
449+
headers=__headers,
450+
body=__body,
451+
endpoint_id="inference.inference",
452+
path_parts=__path_parts,
453+
)
454+
237455
@_rewrite_parameters(
238456
body_name="inference_config",
239457
)

elasticsearch/_async/client/ingest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ async def geo_ip_stats(
208208
Get download statistics for GeoIP2 databases that are used with the GeoIP processor.</p>
209209
210210
211-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-processor.html>`_
211+
`<https://www.elastic.co/docs/reference/enrich-processor/geoip-processor>`_
212212
"""
213213
__path_parts: t.Dict[str, str] = {}
214214
__path = "/_ingest/geoip/stats"
@@ -412,7 +412,7 @@ async def processor_grok(
412412
A grok pattern is like a regular expression that supports aliased expressions that can be reused.</p>
413413
414414
415-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html>`_
415+
`<https://www.elastic.co/docs/reference/enrich-processor/grok-processor>`_
416416
"""
417417
__path_parts: t.Dict[str, str] = {}
418418
__path = "/_ingest/processor/grok"
@@ -620,7 +620,7 @@ async def put_pipeline(
620620
Changes made using this API take effect immediately.</p>
621621
622622
623-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html>`_
623+
`<https://www.elastic.co/docs/manage-data/ingest/transform-enrich/ingest-pipelines>`_
624624
625625
:param id: ID of the ingest pipeline to create or update.
626626
:param deprecated: Marks this ingest pipeline as deprecated. When a deprecated

elasticsearch/_async/client/nodes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def get_repositories_metering_info(
108108
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-get-repositories-metering-info>`_
109109
110110
:param node_id: Comma-separated list of node IDs or names used to limit returned
111-
information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes).
111+
information.
112112
"""
113113
if node_id in SKIP_IN_PATH:
114114
raise ValueError("Empty value passed for parameter 'node_id'")

elasticsearch/_async/client/snapshot.py

-5
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ async def clone(
105105
human: t.Optional[bool] = None,
106106
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
107107
pretty: t.Optional[bool] = None,
108-
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
109108
body: t.Optional[t.Dict[str, t.Any]] = None,
110109
) -> ObjectApiResponse[t.Any]:
111110
"""
@@ -126,8 +125,6 @@ async def clone(
126125
:param master_timeout: The period to wait for the master node. If the master
127126
node is not available before the timeout expires, the request fails and returns
128127
an error. To indicate that the request should never timeout, set it to `-1`.
129-
:param timeout: The period of time to wait for a response. If no response is
130-
received before the timeout expires, the request fails and returns an error.
131128
"""
132129
if repository in SKIP_IN_PATH:
133130
raise ValueError("Empty value passed for parameter 'repository'")
@@ -155,8 +152,6 @@ async def clone(
155152
__query["master_timeout"] = master_timeout
156153
if pretty is not None:
157154
__query["pretty"] = pretty
158-
if timeout is not None:
159-
__query["timeout"] = timeout
160155
if not __body:
161156
if indices is not None:
162157
__body["indices"] = indices

elasticsearch/_sync/client/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ def knn_search(
30483048
</ul>
30493049
30503050
3051-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/knn-search-api.html>`_
3051+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-knn-search>`_
30523052
30533053
:param index: A comma-separated list of index names to search; use `_all` or
30543054
to perform the operation on all indices.
@@ -4386,7 +4386,7 @@ def scripts_painless_execute(
43864386
<p>Each context requires a script, but additional parameters depend on the context you're using for that script.</p>
43874387
43884388
4389-
`<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html>`_
4389+
`<https://www.elastic.co/docs/reference/scripting-languages/painless/painless-api-examples>`_
43904390
43914391
:param context: The context that the script should run in. NOTE: Result ordering
43924392
in the field contexts is not guaranteed.

elasticsearch/_sync/client/esql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def query(
416416
Get search results for an ES|QL (Elasticsearch query language) query.</p>
417417
418418
419-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-rest.html>`_
419+
`<https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql-rest>`_
420420
421421
:param query: The ES|QL query API accepts an ES|QL query string in the query
422422
parameter, runs it, and returns the results.

0 commit comments

Comments
 (0)