Skip to content

Commit 8354f39

Browse files
Auto-generated API code (elastic#2919)
1 parent fe1b3dc commit 8354f39

File tree

8 files changed

+14
-256
lines changed

8 files changed

+14
-256
lines changed

elasticsearch/_async/client/__init__.py

-121
Original file line numberDiff line numberDiff line change
@@ -2999,127 +2999,6 @@ async def info(
29992999
path_parts=__path_parts,
30003000
)
30013001

3002-
@_rewrite_parameters(
3003-
body_fields=(
3004-
"knn",
3005-
"docvalue_fields",
3006-
"fields",
3007-
"filter",
3008-
"source",
3009-
"stored_fields",
3010-
),
3011-
parameter_aliases={"_source": "source"},
3012-
)
3013-
@_stability_warning(Stability.EXPERIMENTAL)
3014-
async def knn_search(
3015-
self,
3016-
*,
3017-
index: t.Union[str, t.Sequence[str]],
3018-
knn: t.Optional[t.Mapping[str, t.Any]] = None,
3019-
docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
3020-
error_trace: t.Optional[bool] = None,
3021-
fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3022-
filter: t.Optional[
3023-
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
3024-
] = None,
3025-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3026-
human: t.Optional[bool] = None,
3027-
pretty: t.Optional[bool] = None,
3028-
routing: t.Optional[str] = None,
3029-
source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
3030-
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3031-
body: t.Optional[t.Dict[str, t.Any]] = None,
3032-
) -> ObjectApiResponse[t.Any]:
3033-
"""
3034-
.. raw:: html
3035-
3036-
<p>Run a knn search.</p>
3037-
<p>NOTE: The kNN search API has been replaced by the <code>knn</code> option in the search API.</p>
3038-
<p>Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.
3039-
Given a query vector, the API finds the k closest vectors and returns those documents as search hits.</p>
3040-
<p>Elasticsearch uses the HNSW algorithm to support efficient kNN search.
3041-
Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.
3042-
This means the results returned are not always the true k closest neighbors.</p>
3043-
<p>The kNN search API supports restricting the search using a filter.
3044-
The search will return the top k documents that also match the filter query.</p>
3045-
<p>A kNN search response has the exact same structure as a search API response.
3046-
However, certain sections have a meaning specific to kNN search:</p>
3047-
<ul>
3048-
<li>The document <code>_score</code> is determined by the similarity between the query and document vector.</li>
3049-
<li>The <code>hits.total</code> object contains the total number of nearest neighbor candidates considered, which is <code>num_candidates * num_shards</code>. The <code>hits.total.relation</code> will always be <code>eq</code>, indicating an exact value.</li>
3050-
</ul>
3051-
3052-
3053-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-knn-search>`_
3054-
3055-
:param index: A comma-separated list of index names to search; use `_all` or
3056-
to perform the operation on all indices.
3057-
:param knn: The kNN query to run.
3058-
:param docvalue_fields: The request returns doc values for field names matching
3059-
these patterns in the `hits.fields` property of the response. It accepts
3060-
wildcard (`*`) patterns.
3061-
:param fields: The request returns values for field names matching these patterns
3062-
in the `hits.fields` property of the response. It accepts wildcard (`*`)
3063-
patterns.
3064-
:param filter: A query to filter the documents that can match. The kNN search
3065-
will return the top `k` documents that also match this filter. The value
3066-
can be a single query or a list of queries. If `filter` isn't provided, all
3067-
documents are allowed to match.
3068-
:param routing: A comma-separated list of specific routing values.
3069-
:param source: Indicates which source fields are returned for matching documents.
3070-
These fields are returned in the `hits._source` property of the search response.
3071-
:param stored_fields: A list of stored fields to return as part of a hit. If
3072-
no fields are specified, no stored fields are included in the response. If
3073-
this field is specified, the `_source` parameter defaults to `false`. You
3074-
can pass `_source: true` to return both source fields and stored fields in
3075-
the search response.
3076-
"""
3077-
if index in SKIP_IN_PATH:
3078-
raise ValueError("Empty value passed for parameter 'index'")
3079-
if knn is None and body is None:
3080-
raise ValueError("Empty value passed for parameter 'knn'")
3081-
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
3082-
__path = f'/{__path_parts["index"]}/_knn_search'
3083-
__query: t.Dict[str, t.Any] = {}
3084-
__body: t.Dict[str, t.Any] = body if body is not None else {}
3085-
if error_trace is not None:
3086-
__query["error_trace"] = error_trace
3087-
if filter_path is not None:
3088-
__query["filter_path"] = filter_path
3089-
if human is not None:
3090-
__query["human"] = human
3091-
if pretty is not None:
3092-
__query["pretty"] = pretty
3093-
if routing is not None:
3094-
__query["routing"] = routing
3095-
if not __body:
3096-
if knn is not None:
3097-
__body["knn"] = knn
3098-
if docvalue_fields is not None:
3099-
__body["docvalue_fields"] = docvalue_fields
3100-
if fields is not None:
3101-
__body["fields"] = fields
3102-
if filter is not None:
3103-
__body["filter"] = filter
3104-
if source is not None:
3105-
__body["_source"] = source
3106-
if stored_fields is not None:
3107-
__body["stored_fields"] = stored_fields
3108-
if not __body:
3109-
__body = None # type: ignore[assignment]
3110-
__headers = {"accept": "application/json"}
3111-
if __body is not None:
3112-
__headers["content-type"] = "application/json"
3113-
return await self.perform_request( # type: ignore[return-value]
3114-
"POST",
3115-
__path,
3116-
params=__query,
3117-
headers=__headers,
3118-
body=__body,
3119-
endpoint_id="knn_search",
3120-
path_parts=__path_parts,
3121-
)
3122-
31233002
@_rewrite_parameters(
31243003
body_fields=("docs", "ids"),
31253004
parameter_aliases={

elasticsearch/_async/client/connector.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ async def update_filtering_validation(
15391539
<p>Update the draft filtering validation info for a connector.</p>
15401540
15411541
1542-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-validation-api.html>`_
1542+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-update-filtering-validation>`_
15431543
15441544
:param connector_id: The unique identifier of the connector to be updated
15451545
:param validation:
@@ -1710,7 +1710,7 @@ async def update_native(
17101710
<p>Update the connector is_native flag.</p>
17111711
17121712
1713-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-native-api.html>`_
1713+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-update-native>`_
17141714
17151715
:param connector_id: The unique identifier of the connector to be updated
17161716
:param is_native:

elasticsearch/_async/client/esql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ async def async_query_stop(
330330
If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.</p>
331331
332332
333-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-stop-api.html>`_
333+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-async-query-stop>`_
334334
335335
:param id: The unique identifier of the query. A query ID is provided in the
336336
ES|QL async query API response for a query that does not complete in the

elasticsearch/_async/client/indices.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ async def cancel_migrate_reindex(
265265
<p>Cancel a migration reindex attempt for a data stream or index.</p>
266266
267267
268-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
268+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-cancel-migrate-reindex>`_
269269
270270
:param index: The index or data stream name
271271
"""
@@ -794,7 +794,7 @@ async def create_from(
794794
<p>Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.</p>
795795
796796
797-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
797+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-create-from>`_
798798
799799
:param source: The source index or data stream name
800800
:param dest: The destination index or data stream name
@@ -2728,7 +2728,7 @@ async def get_migrate_reindex_status(
27282728
<p>Get the status of a migration reindex attempt for a data stream or index.</p>
27292729
27302730
2731-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
2731+
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-migration>`_
27322732
27332733
:param index: The index or data stream name.
27342734
"""
@@ -2947,7 +2947,7 @@ async def migrate_reindex(
29472947
The persistent task ID is returned immediately and the reindexing work is completed in that task.</p>
29482948
29492949
2950-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
2950+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-migrate-reindex>`_
29512951
29522952
:param reindex:
29532953
"""

elasticsearch/_sync/client/__init__.py

-121
Original file line numberDiff line numberDiff line change
@@ -2997,127 +2997,6 @@ def info(
29972997
path_parts=__path_parts,
29982998
)
29992999

3000-
@_rewrite_parameters(
3001-
body_fields=(
3002-
"knn",
3003-
"docvalue_fields",
3004-
"fields",
3005-
"filter",
3006-
"source",
3007-
"stored_fields",
3008-
),
3009-
parameter_aliases={"_source": "source"},
3010-
)
3011-
@_stability_warning(Stability.EXPERIMENTAL)
3012-
def knn_search(
3013-
self,
3014-
*,
3015-
index: t.Union[str, t.Sequence[str]],
3016-
knn: t.Optional[t.Mapping[str, t.Any]] = None,
3017-
docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
3018-
error_trace: t.Optional[bool] = None,
3019-
fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3020-
filter: t.Optional[
3021-
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
3022-
] = None,
3023-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3024-
human: t.Optional[bool] = None,
3025-
pretty: t.Optional[bool] = None,
3026-
routing: t.Optional[str] = None,
3027-
source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
3028-
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3029-
body: t.Optional[t.Dict[str, t.Any]] = None,
3030-
) -> ObjectApiResponse[t.Any]:
3031-
"""
3032-
.. raw:: html
3033-
3034-
<p>Run a knn search.</p>
3035-
<p>NOTE: The kNN search API has been replaced by the <code>knn</code> option in the search API.</p>
3036-
<p>Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.
3037-
Given a query vector, the API finds the k closest vectors and returns those documents as search hits.</p>
3038-
<p>Elasticsearch uses the HNSW algorithm to support efficient kNN search.
3039-
Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.
3040-
This means the results returned are not always the true k closest neighbors.</p>
3041-
<p>The kNN search API supports restricting the search using a filter.
3042-
The search will return the top k documents that also match the filter query.</p>
3043-
<p>A kNN search response has the exact same structure as a search API response.
3044-
However, certain sections have a meaning specific to kNN search:</p>
3045-
<ul>
3046-
<li>The document <code>_score</code> is determined by the similarity between the query and document vector.</li>
3047-
<li>The <code>hits.total</code> object contains the total number of nearest neighbor candidates considered, which is <code>num_candidates * num_shards</code>. The <code>hits.total.relation</code> will always be <code>eq</code>, indicating an exact value.</li>
3048-
</ul>
3049-
3050-
3051-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-knn-search>`_
3052-
3053-
:param index: A comma-separated list of index names to search; use `_all` or
3054-
to perform the operation on all indices.
3055-
:param knn: The kNN query to run.
3056-
:param docvalue_fields: The request returns doc values for field names matching
3057-
these patterns in the `hits.fields` property of the response. It accepts
3058-
wildcard (`*`) patterns.
3059-
:param fields: The request returns values for field names matching these patterns
3060-
in the `hits.fields` property of the response. It accepts wildcard (`*`)
3061-
patterns.
3062-
:param filter: A query to filter the documents that can match. The kNN search
3063-
will return the top `k` documents that also match this filter. The value
3064-
can be a single query or a list of queries. If `filter` isn't provided, all
3065-
documents are allowed to match.
3066-
:param routing: A comma-separated list of specific routing values.
3067-
:param source: Indicates which source fields are returned for matching documents.
3068-
These fields are returned in the `hits._source` property of the search response.
3069-
:param stored_fields: A list of stored fields to return as part of a hit. If
3070-
no fields are specified, no stored fields are included in the response. If
3071-
this field is specified, the `_source` parameter defaults to `false`. You
3072-
can pass `_source: true` to return both source fields and stored fields in
3073-
the search response.
3074-
"""
3075-
if index in SKIP_IN_PATH:
3076-
raise ValueError("Empty value passed for parameter 'index'")
3077-
if knn is None and body is None:
3078-
raise ValueError("Empty value passed for parameter 'knn'")
3079-
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
3080-
__path = f'/{__path_parts["index"]}/_knn_search'
3081-
__query: t.Dict[str, t.Any] = {}
3082-
__body: t.Dict[str, t.Any] = body if body is not None else {}
3083-
if error_trace is not None:
3084-
__query["error_trace"] = error_trace
3085-
if filter_path is not None:
3086-
__query["filter_path"] = filter_path
3087-
if human is not None:
3088-
__query["human"] = human
3089-
if pretty is not None:
3090-
__query["pretty"] = pretty
3091-
if routing is not None:
3092-
__query["routing"] = routing
3093-
if not __body:
3094-
if knn is not None:
3095-
__body["knn"] = knn
3096-
if docvalue_fields is not None:
3097-
__body["docvalue_fields"] = docvalue_fields
3098-
if fields is not None:
3099-
__body["fields"] = fields
3100-
if filter is not None:
3101-
__body["filter"] = filter
3102-
if source is not None:
3103-
__body["_source"] = source
3104-
if stored_fields is not None:
3105-
__body["stored_fields"] = stored_fields
3106-
if not __body:
3107-
__body = None # type: ignore[assignment]
3108-
__headers = {"accept": "application/json"}
3109-
if __body is not None:
3110-
__headers["content-type"] = "application/json"
3111-
return self.perform_request( # type: ignore[return-value]
3112-
"POST",
3113-
__path,
3114-
params=__query,
3115-
headers=__headers,
3116-
body=__body,
3117-
endpoint_id="knn_search",
3118-
path_parts=__path_parts,
3119-
)
3120-
31213000
@_rewrite_parameters(
31223001
body_fields=("docs", "ids"),
31233002
parameter_aliases={

elasticsearch/_sync/client/connector.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ def update_filtering_validation(
15391539
<p>Update the draft filtering validation info for a connector.</p>
15401540
15411541
1542-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-validation-api.html>`_
1542+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-update-filtering-validation>`_
15431543
15441544
:param connector_id: The unique identifier of the connector to be updated
15451545
:param validation:
@@ -1710,7 +1710,7 @@ def update_native(
17101710
<p>Update the connector is_native flag.</p>
17111711
17121712
1713-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-native-api.html>`_
1713+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-update-native>`_
17141714
17151715
:param connector_id: The unique identifier of the connector to be updated
17161716
:param is_native:

elasticsearch/_sync/client/esql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def async_query_stop(
330330
If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.</p>
331331
332332
333-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-stop-api.html>`_
333+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-async-query-stop>`_
334334
335335
:param id: The unique identifier of the query. A query ID is provided in the
336336
ES|QL async query API response for a query that does not complete in the

elasticsearch/_sync/client/indices.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def cancel_migrate_reindex(
265265
<p>Cancel a migration reindex attempt for a data stream or index.</p>
266266
267267
268-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
268+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-cancel-migrate-reindex>`_
269269
270270
:param index: The index or data stream name
271271
"""
@@ -794,7 +794,7 @@ def create_from(
794794
<p>Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.</p>
795795
796796
797-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
797+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-create-from>`_
798798
799799
:param source: The source index or data stream name
800800
:param dest: The destination index or data stream name
@@ -2728,7 +2728,7 @@ def get_migrate_reindex_status(
27282728
<p>Get the status of a migration reindex attempt for a data stream or index.</p>
27292729
27302730
2731-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
2731+
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-migration>`_
27322732
27332733
:param index: The index or data stream name.
27342734
"""
@@ -2947,7 +2947,7 @@ def migrate_reindex(
29472947
The persistent task ID is returned immediately and the reindexing work is completed in that task.</p>
29482948
29492949
2950-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
2950+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-migrate-reindex>`_
29512951
29522952
:param reindex:
29532953
"""

0 commit comments

Comments
 (0)