You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: solutions/search/ranking/learning-to-rank-search-usage.md
+50-8Lines changed: 50 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,11 +18,15 @@ products:
18
18
This feature was introduced in version 8.12.0 and is only available to certain subscription levels. For more information, see {{subscriptions}}.
19
19
::::
20
20
21
+
Once your LTR model is trained and deployed in {{es}}, there are two ways to use it with the [search API](../querying-for-search.md) to improve your search results:
22
+
23
+
1.**As a [rescorer](#learning-to-rank-rescorer)**
24
+
2.**As a [retriever](#learning-to-rank-retriever)**
21
25
22
26
23
27
## Learning To Rank as a rescorer [learning-to-rank-rescorer]
24
28
25
-
Once your LTR model is trained and deployed in {{es}}, it can be used as a [rescorer](elasticsearch://reference/elasticsearch/rest-apis/filter-search-results.md#rescore) in the [search API](../querying-for-search.md):
29
+
To use your LTR model as a [rescorer](elasticsearch://reference/elasticsearch/rest-apis/filter-search-results.md#rescore) in the [search API](../querying-for-search.md), follow this example:
26
30
27
31
```console
28
32
GET my-index/_search
@@ -50,22 +54,60 @@ GET my-index/_search
50
54
3. Named parameters to be passed to the query templates used for feature.
51
55
4. The number of documents that should be examined by the rescorer on each shard.
52
56
57
+
## Learning To Rank as a retriever [learning-to-rank-retriever]
53
58
59
+
```{applies_to}
60
+
stack: ga 9.1
61
+
serverless: ga
62
+
```
54
63
55
-
### Known limitations [learning-to-rank-rescorer-limitations]
64
+
LTR models can also be used as a [retriever](../retrievers-overview.md) in the search pipeline. You can implement this with a [rescorer retriever](elasticsearch://reference/elasticsearch/rest-apis/retrievers.md#rescorer-retriever) as shown in the following example:
1. First pass retrievers used to retrieve documents to be rescored
98
+
2. The unique identifier of the trained model uploaded to {{es}}.
99
+
3. Named parameters to be passed to the query templates used for feature extraction.
100
+
4. The number of documents that should be examined by the rescorer.
59
101
60
-
Scores returned by LTR models are usually not comparable with the scores issued by the first pass query and can be lower than the non-rescored score. This can cause the non-rescored result document to be ranked higher than the rescored document. To prevent this, the `window_size` parameter is mandatory for LTR rescorers and should be greater than or equal to `from + size`.
102
+
## Known limitations [learning-to-rank-rescorer-limitations]
When exposing pagination to users, `window_size` should remain constant as each page is progressed by passing different `from` values. Changing the `window_size`can alter the top hits causing results to confusingly shift as the user steps through pages.
107
+
Scores returned by LTR models are usually not comparable with the scores issued by the first pass query and can be lower than the non-rescored score. This can cause the non-rescored result document to be ranked higher than the rescored document. To prevent this, the `window_size`parameter is mandatory for LTR rescorers and should be greater than or equal to `from + size`.
Depending on how your model is trained, it’s possible that the model will return negative scores for documents. While negative scores are not allowed from first-stage retrieval and ranking, it is possible to use them in the LTR rescorer.
112
+
When exposing pagination to users, `window_size` should remain constant as each page is progressed by passing different `from` values. Changing the `window_size` can alter the top hits causing results to confusingly shift as the user steps through pages.
0 commit comments