Use a kvpairs clause to inject per-query key-value pairs into the mutable part of a sort expression. Feature functions consume these values at query time, letting you parameterize ranking logic.
Syntax
{
"kvpairs": {
"<key>": "<value>"
}
}| Parameter | Description |
|---|---|
<key> | A field name referenced in the mutable part of a sort expression. |
<value> | The value assigned to that field for this query. |
Specify multiple key-value pairs as needed.
Example
The following example defines two key-value pairs. A sort expression that references key1 or key2 in its mutable part receives the corresponding values at query time.
{
"kvpairs": {
"key1": "value1",
"key2": "value2"
}
}Usage notes
The
kvpairsclause is optional. Omit it when the sort expression does not reference any mutable fields.