Evaluate ranked search results
Generally available
Evaluate the quality of ranked search results over a set of typical search queries.
Required authorization
- Index privileges:
read
Query parameters
-
allow_no_indices
boolean If
false
, the request returns an error if any wildcard expression, index alias, or_all
value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*
returns an error if an index starts withfoo
but no index starts withbar
. -
expand_wildcards
string | array[string] Whether to expand wildcard expression to concrete indices that are open, closed or both.
Values are
all
,open
,closed
,hidden
, ornone
. -
search_type
string Search operation type
GET
/_rank_eval
Console
GET /my-index-000001/_rank_eval
{
"requests": [
{
"id": "JFK query",
"request": { "query": { "match_all": {} } },
"ratings": []
} ],
"metric": {
"precision": {
"k": 20,
"relevant_rating_threshold": 1,
"ignore_unlabeled": false
}
}
}
resp = client.rank_eval(
index="my-index-000001",
requests=[
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
metric={
"precision": {
"k": 20,
"relevant_rating_threshold": 1,
"ignore_unlabeled": False
}
},
)
const response = await client.rankEval({
index: "my-index-000001",
requests: [
{
id: "JFK query",
request: {
query: {
match_all: {},
},
},
ratings: [],
},
],
metric: {
precision: {
k: 20,
relevant_rating_threshold: 1,
ignore_unlabeled: false,
},
},
});
response = client.rank_eval(
index: "my-index-000001",
body: {
"requests": [
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
"metric": {
"precision": {
"k": 20,
"relevant_rating_threshold": 1,
"ignore_unlabeled": false
}
}
}
)
$resp = $client->rankEval([
"index" => "my-index-000001",
"body" => [
"requests" => array(
[
"id" => "JFK query",
"request" => [
"query" => [
"match_all" => new ArrayObject([]),
],
],
"ratings" => array(
),
],
),
"metric" => [
"precision" => [
"k" => 20,
"relevant_rating_threshold" => 1,
"ignore_unlabeled" => false,
],
],
],
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"requests":[{"id":"JFK query","request":{"query":{"match_all":{}}},"ratings":[]}],"metric":{"precision":{"k":20,"relevant_rating_threshold":1,"ignore_unlabeled":false}}}' "$ELASTICSEARCH_URL/my-index-000001/_rank_eval"
Request example
An example body for a `GET /my-index-000001/_rank_eval` request.
{
"requests": [
{
"id": "JFK query",
"request": { "query": { "match_all": {} } },
"ratings": []
} ],
"metric": {
"precision": {
"k": 20,
"relevant_rating_threshold": 1,
"ignore_unlabeled": false
}
}
}