Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<index>` in the request path.
:param post_filter: Use the `post_filter` parameter to filter search results.
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <index> in the request path.
:param post_filter:
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <index> in the request path.
:param post_filter:
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/_sync/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<index>` in the request path.
:param post_filter: Use the `post_filter` parameter to filter search results.
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_sync/client/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <index> in the request path.
:param post_filter:
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_sync/client/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <index> in the request path.
:param post_filter:
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/dsl/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 56 additions & 6 deletions elasticsearch/dsl/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)


Expand Down