Skip to content

Commit afe95a7

Browse files
author
Christoph Büscher
authored
[Docs] Add rank_eval size parameter k (#29218)
The rank_eval documentation was missing an explanation of the parameter `k` that controls the number of top hits that are used in the ranking evaluation. Closes #29205
1 parent d400a08 commit afe95a7

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

docs/reference/search/rank-eval.asciidoc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
[[search-rank-eval]]
22
== Ranking Evaluation API
33

4+
experimental[The ranking evaluation API is experimental and may be changed or removed completely in a future release,
5+
as well as change in non-backwards compatible ways on minor versions updates. Elastic will take a best effort
6+
approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.]
7+
48
The ranking evaluation API allows to evaluate the quality of ranked search
59
results over a set of typical search queries. Given this set of queries and a
610
list or manually rated documents, the `_rank_eval` endpoint calculates and
711
returns typical information retrieval metrics like _mean reciprocal rank_,
812
_precision_ or _discounted cumulative gain_.
913

10-
experimental[The ranking evaluation API is new and may change in non-backwards compatible ways in the future, even on minor versions updates.]
11-
1214
[float]
1315
=== Overview
1416

@@ -41,7 +43,7 @@ GET /my_index/_rank_eval
4143
{
4244
"requests": [ ... ], <1>
4345
"metric": { <2>
44-
"reciprocal_rank": { ... } <3>
46+
"mean_reciprocal_rank": { ... } <3>
4547
}
4648
}
4749
------------------------------
@@ -85,7 +87,7 @@ The request section contains several search requests typical to your application
8587
<3> a list of document ratings, each entry containing the documents `_index` and `_id` together with
8688
the rating of the documents relevance with regards to this search request
8789

88-
A document `rating` can be any integer value that expresses the relevance of the document on a user defined scale. For some of the metrics, just giving a binary rating (e.g. `0` for irrelevant and `1` for relevant) will be sufficient, other metrics can use a more fine grained scale.
90+
A document `rating` can be any integer value that expresses the relevance of the document on a user defined scale. For some of the metrics, just giving a binary rating (e.g. `0` for irrelevant and `1` for relevant) will be sufficient, other metrics can use a more fine grained scale.
8991

9092
[float]
9193
=== Template based ranking evaluation
@@ -158,6 +160,7 @@ GET /twitter/_rank_eval
158160
}],
159161
"metric": {
160162
"precision": {
163+
"k" : 20,
161164
"relevant_rating_threshold": 1,
162165
"ignore_unlabeled": false
163166
}
@@ -172,7 +175,9 @@ The `precision` metric takes the following optional parameters
172175
[cols="<,<",options="header",]
173176
|=======================================================================
174177
|Parameter |Description
175-
|`relevant_rating_threshold` |Sets the rating threshold above which documents are considered to be
178+
|`k` |sets the maximum number of documents retrieved per query. This value will act in place of the usual `size` parameter
179+
in the query. Defaults to 10.
180+
|`relevant_rating_threshold` |sets the rating threshold above which documents are considered to be
176181
"relevant". Defaults to `1`.
177182
|`ignore_unlabeled` |controls how unlabeled documents in the search results are counted.
178183
If set to 'true', unlabeled documents are ignored and neither count as relevant or irrelevant. Set to 'false' (the default), they are treated as irrelevant.
@@ -198,6 +203,7 @@ GET /twitter/_rank_eval
198203
}],
199204
"metric": {
200205
"mean_reciprocal_rank": {
206+
"k" : 20,
201207
"relevant_rating_threshold" : 1
202208
}
203209
}
@@ -211,6 +217,8 @@ The `mean_reciprocal_rank` metric takes the following optional parameters
211217
[cols="<,<",options="header",]
212218
|=======================================================================
213219
|Parameter |Description
220+
|`k` |sets the maximum number of documents retrieved per query. This value will act in place of the usual `size` parameter
221+
in the query. Defaults to 10.
214222
|`relevant_rating_threshold` |Sets the rating threshold above which documents are considered to be
215223
"relevant". Defaults to `1`.
216224
|=======================================================================
@@ -234,6 +242,7 @@ GET /twitter/_rank_eval
234242
}],
235243
"metric": {
236244
"dcg": {
245+
"k" : 20,
237246
"normalize": false
238247
}
239248
}
@@ -247,6 +256,8 @@ The `dcg` metric takes the following optional parameters:
247256
[cols="<,<",options="header",]
248257
|=======================================================================
249258
|Parameter |Description
259+
|`k` |sets the maximum number of documents retrieved per query. This value will act in place of the usual `size` parameter
260+
in the query. Defaults to 10.
250261
|`normalize` | If set to `true`, this metric will calculate the https://en.wikipedia.org/wiki/Discounted_cumulative_gain#Normalized_DCG[Normalized DCG].
251262
|=======================================================================
252263

0 commit comments

Comments
 (0)