diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 32f555030..650ebeeb4 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -4745,7 +4745,8 @@ async def search( limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. :param min_score: The minimum `_score` for matching documents. Documents with - a lower `_score` are not included in the search results. + a lower `_score` are not included in search results and results collected + by aggregations. :param pit: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. :param post_filter: Use the `post_filter` parameter to filter search results. diff --git a/elasticsearch/_async/client/async_search.py b/elasticsearch/_async/client/async_search.py index b667d9463..4d1c32974 100644 --- a/elasticsearch/_async/client/async_search.py +++ b/elasticsearch/_async/client/async_search.py @@ -401,7 +401,7 @@ async def submit( limit the impact of the search on the cluster in order to limit the number of concurrent shard requests :param min_score: Minimum _score for matching documents. Documents with a lower - _score are not included in the search results. + _score are not included in search results and results collected by aggregations. :param pit: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. :param post_filter: diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index 896ba78b6..9778bb1d5 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -430,7 +430,7 @@ async def search( :param lenient: :param max_concurrent_shard_requests: :param min_score: Minimum _score for matching documents. Documents with a lower - _score are not included in the search results. + _score are not included in search results and results collected by aggregations. :param pit: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. :param post_filter: diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index a863d577c..6ac45cb31 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -4743,7 +4743,8 @@ def search( limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. :param min_score: The minimum `_score` for matching documents. Documents with - a lower `_score` are not included in the search results. + a lower `_score` are not included in search results and results collected + by aggregations. :param pit: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. :param post_filter: Use the `post_filter` parameter to filter search results. diff --git a/elasticsearch/_sync/client/async_search.py b/elasticsearch/_sync/client/async_search.py index 7ee7f4404..3042ae07a 100644 --- a/elasticsearch/_sync/client/async_search.py +++ b/elasticsearch/_sync/client/async_search.py @@ -401,7 +401,7 @@ def submit( limit the impact of the search on the cluster in order to limit the number of concurrent shard requests :param min_score: Minimum _score for matching documents. Documents with a lower - _score are not included in the search results. + _score are not included in search results and results collected by aggregations. :param pit: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. :param post_filter: diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index adb4665d9..820e661cb 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -430,7 +430,7 @@ def search( :param lenient: :param max_concurrent_shard_requests: :param min_score: Minimum _score for matching documents. Documents with a lower - _score are not included in the search results. + _score are not included in search results and results collected by aggregations. :param pit: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. :param post_filter: diff --git a/elasticsearch/dsl/query.py b/elasticsearch/dsl/query.py index 1282d3b02..b2f4eb3cc 100644 --- a/elasticsearch/dsl/query.py +++ b/elasticsearch/dsl/query.py @@ -1084,7 +1084,7 @@ class Knn(Query): :arg similarity: The minimum similarity for a vector to be considered a match :arg rescore_vector: Apply oversampling and rescoring to quantized - vectors * + vectors :arg boost: Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases diff --git a/elasticsearch/dsl/types.py b/elasticsearch/dsl/types.py index 772e596cd..9dba981e4 100644 --- a/elasticsearch/dsl/types.py +++ b/elasticsearch/dsl/types.py @@ -324,31 +324,58 @@ class DenseVectorIndexOptions(AttrDict[Any]): `int4_flat` index types. :arg ef_construction: The number of candidates to track while assembling the list of nearest neighbors for each new node. Only - applicable to `hnsw`, `int8_hnsw`, and `int4_hnsw` index types. - Defaults to `100` if omitted. + applicable to `hnsw`, `int8_hnsw`, `bbq_hnsw`, and `int4_hnsw` + index types. Defaults to `100` if omitted. :arg m: The number of neighbors each node will be connected to in the - HNSW graph. Only applicable to `hnsw`, `int8_hnsw`, and - `int4_hnsw` index types. Defaults to `16` if omitted. + HNSW graph. Only applicable to `hnsw`, `int8_hnsw`, `bbq_hnsw`, + and `int4_hnsw` index types. Defaults to `16` if omitted. + :arg rescore_vector: The rescore vector options. This is only + applicable to `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, `bbq_flat`, + `int4_flat`, and `int8_flat` index types. """ type: Union[ - Literal["flat", "hnsw", "int4_flat", "int4_hnsw", "int8_flat", "int8_hnsw"], + Literal[ + "bbq_flat", + "bbq_hnsw", + "flat", + "hnsw", + "int4_flat", + "int4_hnsw", + "int8_flat", + "int8_hnsw", + ], DefaultType, ] confidence_interval: Union[float, DefaultType] ef_construction: Union[int, DefaultType] m: Union[int, DefaultType] + rescore_vector: Union[ + "DenseVectorIndexOptionsRescoreVector", Dict[str, Any], DefaultType + ] def __init__( self, *, type: Union[ - Literal["flat", "hnsw", "int4_flat", "int4_hnsw", "int8_flat", "int8_hnsw"], + Literal[ + "bbq_flat", + "bbq_hnsw", + "flat", + "hnsw", + "int4_flat", + "int4_hnsw", + "int8_flat", + "int8_hnsw", + ], DefaultType, ] = DEFAULT, confidence_interval: Union[float, DefaultType] = DEFAULT, ef_construction: Union[int, DefaultType] = DEFAULT, m: Union[int, DefaultType] = DEFAULT, + rescore_vector: Union[ + "DenseVectorIndexOptionsRescoreVector", Dict[str, Any], DefaultType + ] = DEFAULT, **kwargs: Any, ): if type is not DEFAULT: @@ -359,6 +386,29 @@ def __init__( kwargs["ef_construction"] = ef_construction if m is not DEFAULT: kwargs["m"] = m + if rescore_vector is not DEFAULT: + kwargs["rescore_vector"] = rescore_vector + super().__init__(kwargs) + + +class DenseVectorIndexOptionsRescoreVector(AttrDict[Any]): + """ + :arg oversample: (required) The oversampling factor to use when + searching for the nearest neighbor. This is only applicable to the + quantized formats: `bbq_*`, `int4_*`, and `int8_*`. When provided, + `oversample * k` vectors will be gathered and then their scores + will be re-computed with the original vectors. valid values are + between `1.0` and `10.0` (inclusive), or `0` exactly to disable + oversampling. + """ + + oversample: Union[float, DefaultType] + + def __init__( + self, *, oversample: Union[float, DefaultType] = DEFAULT, **kwargs: Any + ): + if oversample is not DEFAULT: + kwargs["oversample"] = oversample super().__init__(kwargs)