All methods and paths for this operation:
Evaluate the quality of ranked search results over a set of typical search queries.
Required authorization
- Index privileges:
read
Path parameters
-
A comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (
*) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use_allor*.
Query parameters
-
A setting that does two separate checks on the index expression. If
false, the request returns an error (1) if any wildcard expression (including_alland*) resolves to zero matching indices or (2) if the complete set of resolved indices, aliases or data streams is empty after all expressions are evaluated. Iftrue, index expressions that resolve to no indices are allowed and the request returns an empty result. -
Whether to expand wildcard expression to concrete indices that are open, closed or both.
Supported values include:
all: Match any data stream or index, including hidden ones.open: Match open, non-hidden indices. Also matches any non-hidden data stream.closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.hidden: Match hidden data streams and hidden indices. Must be combined withopen,closed, orboth.none: Wildcard expressions are not accepted.
Values are
all,open,closed,hidden, ornone. -
Search operation type
Supported values include:
query_then_fetch: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.dfs_query_then_fetch: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.
Values are
query_then_fetchordfs_query_then_fetch.
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"
client.rankEval(r -> r
.index("my-index-000001")
.metric(m -> m
.precision(p -> p
.ignoreUnlabeled(false)
.relevantRatingThreshold(1)
.k(20)
)
)
.requests(re -> re
.id("JFK query")
.request(req -> req
.query(q -> q
.matchAll(m -> m)
)
)
)
);
{
"requests": [
{
"id": "JFK query",
"request": { "query": { "match_all": {} } },
"ratings": []
} ],
"metric": {
"precision": {
"k": 20,
"relevant_rating_threshold": 1,
"ignore_unlabeled": false
}
}
}