Skip to content

Commit ea624db

Browse files
committed
Rewording, adapting to final names in PR
1 parent 4f94cb5 commit ea624db

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/reference/search/search-your-data/knn-search.asciidoc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,13 @@ the global top `k` matches across shards. You cannot set the
10741074
==== Oversampling and rescoring for quantized vectors
10751075

10761076
When using <<dense-vector-quantization,quantized vectors>> for kNN search, you can optionally rescore results to balance performance and accuracy, by doing:
1077-
* Oversampling: Retrieve more candidates per shard using approximate kNN
1078-
* Rescoring: Use the original vector values for re-calculating the score on the oversampled candidates.
1077+
1078+
* *Oversampling*: Retrieve more candidates per shard.
1079+
* *Rescoring*: Use the original vector values for re-calculating the score on the oversampled candidates.
10791080

10801081
As the non-quantized, original vectors are used to calculate the final score on the top results, rescoring combines:
10811082

1082-
* The performance and memory gains of approximate retrieval using quantized vectors on the top candidates.
1083+
* The performance and memory gains of approximate retrieval using quantized vectors for retrieving the top candidates.
10831084
* The accuracy of using the original vectors for rescoring the top candidates.
10841085

10851086
All forms of quantization will result in some accuracy loss and as the quantization level increases the accuracy loss will also increase.
@@ -1097,17 +1098,15 @@ There are three main ways to oversample and rescore:
10971098

10981099
[discrete]
10991100
[[dense-vector-knn-search-reranking-rescore-parameter]]
1100-
===== Use the `rescore` option to rescore per shard
1101+
===== Use the `rescore_vector` option to rescore per shard
11011102

11021103
preview:[]
11031104

1104-
You can use the `rescore` option to automatically perform reranking.
1105-
When a rescore `oversample` parameter is specified, the approximate kNN search will retrieve the top `k * oversample` candidates per shard.
1105+
You can use the `rescore_vector` option to automatically perform reranking.
1106+
When a rescore `num_candidates_factor` parameter is specified, the approximate kNN search will retrieve the top `num_candidates * oversample` candidates per shard.
11061107
It will then use the original vectors to rescore them, and return the top `k` results.
11071108

1108-
`num_candidates` will not be affected by oversample, besides ensuring that there are at least `k * oversample` candidates per shard.
1109-
1110-
Here is an example of using the `rescore` option with the `oversample` parameter:
1109+
Here is an example of using the `rescore_vector` option with the `num_candidates_factor` parameter:
11111110

11121111
[source,console]
11131112
----
@@ -1118,8 +1117,8 @@ POST image-index/_search
11181117
"query_vector": [-5, 9, -12],
11191118
"k": 10,
11201119
"num_candidates": 100,
1121-
"rescore": {
1122-
"oversample": 2.0
1120+
"rescore_vector": {
1121+
"num_candidates_factor": 2.0
11231122
}
11241123
},
11251124
"fields": [ "title", "file-type" ]
@@ -1130,18 +1129,19 @@ POST image-index/_search
11301129
// TEST[s/"num_candidates": 100/"num_candidates": 3/]
11311130

11321131
This example will:
1133-
* Search using approximate kNN with `num_candidates` set to 100.
1134-
* Rescore the top 20 (`k * oversample`) candidates per shard using the original vectors.
1135-
* Return the top 10 (`k`) results from the rescored candidates.
1132+
1133+
* Search using approximate kNN with `num_candidates` set to 200 (`num_candidates` * `num_candidates_factor`).
1134+
* Rescore the top 200 candidates per shard using the original, non quantized vectors.
1135+
* Merge the rescored canddidates from all shards, and return the top 10 (`k`) results.
11361136

11371137

11381138
[discrete]
11391139
[[dense-vector-knn-search-reranking-rescore-section]]
1140-
===== Use the `rescore` section for top-level kNN search
1140+
===== Use the `rescore_vector` section for top-level kNN search
11411141

11421142
You can use the <<rescore, rescore section>> in the `_search` request to rescore the top results from a kNN search.
11431143

1144-
Here is an example using the top level `knn` search with oversampling and using `rescore` to rerank the results:
1144+
Here is an example using the top level `knn` search with oversampling and using `rescore_vector` to rerank the results:
11451145

11461146
[source,console]
11471147
--------------------------------------------------

0 commit comments

Comments
 (0)