A FirstRank object defines the rough sort expression configured for a version of an OpenSearch application.
Open Search supports two expression types:
STRUCT — defines the expression as a structured array of weighted attributes or feature functions. This is the default.
STRING — defines the expression as a custom formula string, such as
random()*100+now().
Examples
STRUCT type — a structured expression using the static BM25 scoring function:
{
"name": "default",
"description": "",
"active": true,
"type": "STRUCT",
"meta": [
{
"attribute": "static_bm25()",
"arg": "",
"weight": 10
}
]
}STRING type — a custom formula expression:
{
"name": "my_demo",
"description": "",
"active": false,
"type": "STRING",
"meta": "random()*100+now()"
}Structure
| Field | Type | Description |
|---|---|---|
name | String | The name of the expression. |
description | String | A description of the expression. |
active | Boolean | Indicates whether the rough sort expression is the default one. |
type | String | The expression type. Valid values: STRUCT (default), STRING. |
meta | Array or String | The content of the expression. When type is STRUCT, this is an array of attribute objects (see below). When type is STRING, this is a formula string. |
meta fields (when type is STRUCT)
| Field | Type | Description |
|---|---|---|
[].attribute | String | The attribute, feature function, or field to score against. For supported values, see Rough sort functions. |
[].arg | String | Parameters passed to the function specified in attribute. For details, see Rough sort functions. |
[].weight | Number | The weight applied to this attribute. Valid values: –100000 to 100000, excluding 0. |
该文章对您有帮助吗?