FirstRank

更新时间:
复制 MD 格式

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

FieldTypeDescription
nameStringThe name of the expression.
descriptionStringA description of the expression.
activeBooleanIndicates whether the rough sort expression is the default one.
typeStringThe expression type. Valid values: STRUCT (default), STRING.
metaArray or StringThe 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)

FieldTypeDescription
[].attributeStringThe attribute, feature function, or field to score against. For supported values, see Rough sort functions.
[].argStringParameters passed to the function specified in attribute. For details, see Rough sort functions.
[].weightNumberThe weight applied to this attribute. Valid values: –100000 to 100000, excluding 0.