Custom scoring lets you change how hosted SuggestAPI results are ordered, beyond the default lexical and semantic ranking. It has three parts: boost rules, static document scores, and a scoring webhook.

Not supported in search proxy mode. When Search serving is Your search API (plugin), boost rules, static document scores, and scoring webhooks are ignored, and your webhook endpoint is never called. Set ranking on your origin search engine instead. See Search capabilities.

Feature What it does Works in search proxy mode
Boost rules Adds a boost to a document when one of its fields matches a condition No
Static document scores Sets a fixed score for specific document IDs No
Scoring webhook Your endpoint returns a score for each candidate document No

These settings are part of the index schema. Read and update them with the Indexes API (GET and PUT /v1/indexes/{index_id}/schema). Changes apply to hosted search only.

The Boost weight on a field in Search index settings is a separate control. It changes how much a searchable field counts in text matching. Custom scoring adds boosts based on document values.

Boost rules

Set boost rules under ranking.boost_rules. Each key is a document field. When the field matches the condition, the rule adds its boost to the document’s score.

{
  "ranking": {
    "boost_rules": {
      "featured": { "boost": 0.3, "condition": "truthy" },
      "on_sale": { "boost": 0.5, "condition": "==", "value": true },
      "category": { "boost": 0.2, "condition": "in", "value": ["Electronics", "Gadgets"] },
      "rating": { "boost": 0.1, "condition": ">=", "value": 4.5 }
    }
  }
}

A rule can also be a plain number, which is a boost applied when the field is truthy: "featured": 0.3.

Condition Matches when Needs value
truthy The field is truthy No
falsy The field is falsy No
== The field equals value Yes
!= The field does not equal value Yes
>, >=, <, <= The numeric field compares to value Yes
in The field is one of the values in the value list Yes

If several rules match a document, their boosts add together.

Static document scores

Use ranking.custom_doc_scores to pin scores for specific documents, for example hero products or campaign items. Keys are document IDs as stored in the index. Values are scores from 0.0 to 1.0.

{
  "ranking": {
    "custom_doc_scores": {
      "hero_product_1": 0.9,
      "promo_sku_42": 0.5
    }
  }
}

Documents that are not listed score 0.

Scoring webhook

Set ranking.scoring_webhook to have SuggestAPI call your endpoint during hybrid search.

{
  "ranking": {
    "scoring_webhook": {
      "enabled": true,
      "url": "https://your-service.example.com/score",
      "timeout_sec": 2.0,
      "headers": { "Authorization": "Bearer YOUR_SECRET" }
    }
  }
}
Field Description
enabled Turns the webhook on or off
url Full URL to POST to. Use HTTPS in production
timeout_sec Request timeout, from 0.5 to 30 seconds. Default 2.0
headers Optional headers, such as authentication

Request. SuggestAPI sends a JSON body with the normalized query, the candidate doc_ids, and, where available, a documents array with each document’s doc_id and payload.

Response. Return a scores object that maps each document ID to a number:

{
  "scores": {
    "doc_1": 0.8,
    "doc_2": 0.2
  }
}

Missing IDs score 0, and extra IDs are ignored. If your endpoint times out or returns a non-2xx response, the search still succeeds and that request uses no webhook scores.

How scores combine

In hybrid search, each document’s custom score is the higher of its webhook score and its static score. That custom score is blended with lexical, semantic, personalization, and graph signals. Boost rules are added as a separate business-rules term.

Limits

  • Available on paid plans. Check your plan in the console before you configure these settings.
  • Applies to hosted search only. Search proxy mode ignores every setting on this page.
  • Webhook scores depend on your endpoint responding within timeout_sec. Keep the endpoint fast, since a slow response means the request goes without webhook scores.