diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py
index 927c0efc8..84d1f3d4d 100644
--- a/elasticsearch/_async/client/__init__.py
+++ b/elasticsearch/_async/client/__init__.py
@@ -2999,127 +2999,6 @@ async def info(
path_parts=__path_parts,
)
- @_rewrite_parameters(
- body_fields=(
- "knn",
- "docvalue_fields",
- "fields",
- "filter",
- "source",
- "stored_fields",
- ),
- parameter_aliases={"_source": "source"},
- )
- @_stability_warning(Stability.EXPERIMENTAL)
- async def knn_search(
- self,
- *,
- index: t.Union[str, t.Sequence[str]],
- knn: t.Optional[t.Mapping[str, t.Any]] = None,
- docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
- error_trace: t.Optional[bool] = None,
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
- filter: t.Optional[
- t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
- ] = None,
- filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
- human: t.Optional[bool] = None,
- pretty: t.Optional[bool] = None,
- routing: t.Optional[str] = None,
- source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
- stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
- body: t.Optional[t.Dict[str, t.Any]] = None,
- ) -> ObjectApiResponse[t.Any]:
- """
- .. raw:: html
-
-
Run a knn search.
- NOTE: The kNN search API has been replaced by the knn
option in the search API.
- Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.
- Given a query vector, the API finds the k closest vectors and returns those documents as search hits.
- Elasticsearch uses the HNSW algorithm to support efficient kNN search.
- Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.
- This means the results returned are not always the true k closest neighbors.
- The kNN search API supports restricting the search using a filter.
- The search will return the top k documents that also match the filter query.
- A kNN search response has the exact same structure as a search API response.
- However, certain sections have a meaning specific to kNN search:
-
- - The document
_score
is determined by the similarity between the query and document vector.
- - The
hits.total
object contains the total number of nearest neighbor candidates considered, which is num_candidates * num_shards
. The hits.total.relation
will always be eq
, indicating an exact value.
-
-
-
- ``_
-
- :param index: A comma-separated list of index names to search; use `_all` or
- to perform the operation on all indices.
- :param knn: The kNN query to run.
- :param docvalue_fields: The request returns doc values for field names matching
- these patterns in the `hits.fields` property of the response. It accepts
- wildcard (`*`) patterns.
- :param fields: The request returns values for field names matching these patterns
- in the `hits.fields` property of the response. It accepts wildcard (`*`)
- patterns.
- :param filter: A query to filter the documents that can match. The kNN search
- will return the top `k` documents that also match this filter. The value
- can be a single query or a list of queries. If `filter` isn't provided, all
- documents are allowed to match.
- :param routing: A comma-separated list of specific routing values.
- :param source: Indicates which source fields are returned for matching documents.
- These fields are returned in the `hits._source` property of the search response.
- :param stored_fields: A list of stored fields to return as part of a hit. If
- no fields are specified, no stored fields are included in the response. If
- this field is specified, the `_source` parameter defaults to `false`. You
- can pass `_source: true` to return both source fields and stored fields in
- the search response.
- """
- if index in SKIP_IN_PATH:
- raise ValueError("Empty value passed for parameter 'index'")
- if knn is None and body is None:
- raise ValueError("Empty value passed for parameter 'knn'")
- __path_parts: t.Dict[str, str] = {"index": _quote(index)}
- __path = f'/{__path_parts["index"]}/_knn_search'
- __query: t.Dict[str, t.Any] = {}
- __body: t.Dict[str, t.Any] = body if body is not None else {}
- if error_trace is not None:
- __query["error_trace"] = error_trace
- if filter_path is not None:
- __query["filter_path"] = filter_path
- if human is not None:
- __query["human"] = human
- if pretty is not None:
- __query["pretty"] = pretty
- if routing is not None:
- __query["routing"] = routing
- if not __body:
- if knn is not None:
- __body["knn"] = knn
- if docvalue_fields is not None:
- __body["docvalue_fields"] = docvalue_fields
- if fields is not None:
- __body["fields"] = fields
- if filter is not None:
- __body["filter"] = filter
- if source is not None:
- __body["_source"] = source
- if stored_fields is not None:
- __body["stored_fields"] = stored_fields
- if not __body:
- __body = None # type: ignore[assignment]
- __headers = {"accept": "application/json"}
- if __body is not None:
- __headers["content-type"] = "application/json"
- return await self.perform_request( # type: ignore[return-value]
- "POST",
- __path,
- params=__query,
- headers=__headers,
- body=__body,
- endpoint_id="knn_search",
- path_parts=__path_parts,
- )
-
@_rewrite_parameters(
body_fields=("docs", "ids"),
parameter_aliases={
diff --git a/elasticsearch/_async/client/connector.py b/elasticsearch/_async/client/connector.py
index debf9e3ce..6c4bca043 100644
--- a/elasticsearch/_async/client/connector.py
+++ b/elasticsearch/_async/client/connector.py
@@ -1539,7 +1539,7 @@ async def update_filtering_validation(
Update the draft filtering validation info for a connector.
- ``_
+ ``_
:param connector_id: The unique identifier of the connector to be updated
:param validation:
@@ -1710,7 +1710,7 @@ async def update_native(
Update the connector is_native flag.
- ``_
+ ``_
:param connector_id: The unique identifier of the connector to be updated
:param is_native:
diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py
index f3cdd9c7e..85eec185d 100644
--- a/elasticsearch/_async/client/esql.py
+++ b/elasticsearch/_async/client/esql.py
@@ -330,7 +330,7 @@ async def async_query_stop(
If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.
- ``_
+ ``_
:param id: The unique identifier of the query. A query ID is provided in the
ES|QL async query API response for a query that does not complete in the
diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py
index 37cc2d98c..f2535776f 100644
--- a/elasticsearch/_async/client/indices.py
+++ b/elasticsearch/_async/client/indices.py
@@ -265,7 +265,7 @@ async def cancel_migrate_reindex(
Cancel a migration reindex attempt for a data stream or index.
- ``_
+ ``_
:param index: The index or data stream name
"""
@@ -794,7 +794,7 @@ async def create_from(
Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.
- ``_
+ ``_
:param source: The source index or data stream name
:param dest: The destination index or data stream name
@@ -2728,7 +2728,7 @@ async def get_migrate_reindex_status(
Get the status of a migration reindex attempt for a data stream or index.
- ``_
+ ``_
:param index: The index or data stream name.
"""
@@ -2947,7 +2947,7 @@ async def migrate_reindex(
The persistent task ID is returned immediately and the reindexing work is completed in that task.
- ``_
+ ``_
:param reindex:
"""
diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py
index 7b2fbcbaa..cace6bd52 100644
--- a/elasticsearch/_sync/client/__init__.py
+++ b/elasticsearch/_sync/client/__init__.py
@@ -2997,127 +2997,6 @@ def info(
path_parts=__path_parts,
)
- @_rewrite_parameters(
- body_fields=(
- "knn",
- "docvalue_fields",
- "fields",
- "filter",
- "source",
- "stored_fields",
- ),
- parameter_aliases={"_source": "source"},
- )
- @_stability_warning(Stability.EXPERIMENTAL)
- def knn_search(
- self,
- *,
- index: t.Union[str, t.Sequence[str]],
- knn: t.Optional[t.Mapping[str, t.Any]] = None,
- docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
- error_trace: t.Optional[bool] = None,
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
- filter: t.Optional[
- t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
- ] = None,
- filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
- human: t.Optional[bool] = None,
- pretty: t.Optional[bool] = None,
- routing: t.Optional[str] = None,
- source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
- stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
- body: t.Optional[t.Dict[str, t.Any]] = None,
- ) -> ObjectApiResponse[t.Any]:
- """
- .. raw:: html
-
- Run a knn search.
- NOTE: The kNN search API has been replaced by the knn
option in the search API.
- Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.
- Given a query vector, the API finds the k closest vectors and returns those documents as search hits.
- Elasticsearch uses the HNSW algorithm to support efficient kNN search.
- Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.
- This means the results returned are not always the true k closest neighbors.
- The kNN search API supports restricting the search using a filter.
- The search will return the top k documents that also match the filter query.
- A kNN search response has the exact same structure as a search API response.
- However, certain sections have a meaning specific to kNN search:
-
- - The document
_score
is determined by the similarity between the query and document vector.
- - The
hits.total
object contains the total number of nearest neighbor candidates considered, which is num_candidates * num_shards
. The hits.total.relation
will always be eq
, indicating an exact value.
-
-
-
- ``_
-
- :param index: A comma-separated list of index names to search; use `_all` or
- to perform the operation on all indices.
- :param knn: The kNN query to run.
- :param docvalue_fields: The request returns doc values for field names matching
- these patterns in the `hits.fields` property of the response. It accepts
- wildcard (`*`) patterns.
- :param fields: The request returns values for field names matching these patterns
- in the `hits.fields` property of the response. It accepts wildcard (`*`)
- patterns.
- :param filter: A query to filter the documents that can match. The kNN search
- will return the top `k` documents that also match this filter. The value
- can be a single query or a list of queries. If `filter` isn't provided, all
- documents are allowed to match.
- :param routing: A comma-separated list of specific routing values.
- :param source: Indicates which source fields are returned for matching documents.
- These fields are returned in the `hits._source` property of the search response.
- :param stored_fields: A list of stored fields to return as part of a hit. If
- no fields are specified, no stored fields are included in the response. If
- this field is specified, the `_source` parameter defaults to `false`. You
- can pass `_source: true` to return both source fields and stored fields in
- the search response.
- """
- if index in SKIP_IN_PATH:
- raise ValueError("Empty value passed for parameter 'index'")
- if knn is None and body is None:
- raise ValueError("Empty value passed for parameter 'knn'")
- __path_parts: t.Dict[str, str] = {"index": _quote(index)}
- __path = f'/{__path_parts["index"]}/_knn_search'
- __query: t.Dict[str, t.Any] = {}
- __body: t.Dict[str, t.Any] = body if body is not None else {}
- if error_trace is not None:
- __query["error_trace"] = error_trace
- if filter_path is not None:
- __query["filter_path"] = filter_path
- if human is not None:
- __query["human"] = human
- if pretty is not None:
- __query["pretty"] = pretty
- if routing is not None:
- __query["routing"] = routing
- if not __body:
- if knn is not None:
- __body["knn"] = knn
- if docvalue_fields is not None:
- __body["docvalue_fields"] = docvalue_fields
- if fields is not None:
- __body["fields"] = fields
- if filter is not None:
- __body["filter"] = filter
- if source is not None:
- __body["_source"] = source
- if stored_fields is not None:
- __body["stored_fields"] = stored_fields
- if not __body:
- __body = None # type: ignore[assignment]
- __headers = {"accept": "application/json"}
- if __body is not None:
- __headers["content-type"] = "application/json"
- return self.perform_request( # type: ignore[return-value]
- "POST",
- __path,
- params=__query,
- headers=__headers,
- body=__body,
- endpoint_id="knn_search",
- path_parts=__path_parts,
- )
-
@_rewrite_parameters(
body_fields=("docs", "ids"),
parameter_aliases={
diff --git a/elasticsearch/_sync/client/connector.py b/elasticsearch/_sync/client/connector.py
index fc9b193a1..58771108a 100644
--- a/elasticsearch/_sync/client/connector.py
+++ b/elasticsearch/_sync/client/connector.py
@@ -1539,7 +1539,7 @@ def update_filtering_validation(
Update the draft filtering validation info for a connector.
- ``_
+ ``_
:param connector_id: The unique identifier of the connector to be updated
:param validation:
@@ -1710,7 +1710,7 @@ def update_native(
Update the connector is_native flag.
- ``_
+ ``_
:param connector_id: The unique identifier of the connector to be updated
:param is_native:
diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py
index 3f1dea979..0897feb54 100644
--- a/elasticsearch/_sync/client/esql.py
+++ b/elasticsearch/_sync/client/esql.py
@@ -330,7 +330,7 @@ def async_query_stop(
If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.
- ``_
+ ``_
:param id: The unique identifier of the query. A query ID is provided in the
ES|QL async query API response for a query that does not complete in the
diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py
index 89e027a6a..a63f0319f 100644
--- a/elasticsearch/_sync/client/indices.py
+++ b/elasticsearch/_sync/client/indices.py
@@ -265,7 +265,7 @@ def cancel_migrate_reindex(
Cancel a migration reindex attempt for a data stream or index.
- ``_
+ ``_
:param index: The index or data stream name
"""
@@ -794,7 +794,7 @@ def create_from(
Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.
- ``_
+ ``_
:param source: The source index or data stream name
:param dest: The destination index or data stream name
@@ -2728,7 +2728,7 @@ def get_migrate_reindex_status(
Get the status of a migration reindex attempt for a data stream or index.
- ``_
+ ``_
:param index: The index or data stream name.
"""
@@ -2947,7 +2947,7 @@ def migrate_reindex(
The persistent task ID is returned immediately and the reindexing work is completed in that task.
- ``_
+ ``_
:param reindex:
"""