function score

This block is part of the query group and was last modified in core v14.0.4.

Connection Type

This block connects from a query type block. Make sure to connect this block to the appropriate left-hand side connection.

function score v14.0.4

Wraps a query with function_score for custom relevance scoring. Builds script_score, random_score and decay functions from pins. The script_score scores documents by matching their tags field against the provided params : documents without a tags field return a neutral score of 1.

In pins 13
  • Query required
    query

    The inner query to apply scoring functions to.

  • script params
    object

    Parameters passed to the script_score function (e.g. { interests: { technology: 12 } }).

  • script weight
    number

    Weight for the script_score function.

    Default 1

  • random weight
    number

    Weight for random_score function for discovery sprinkle.

    Default 0.15

  • decay type
    value

    Decay function type: exp, gauss, or linear.

    Default exp

  • decay field
    value

    Field to apply decay to.

    Default _meta.created

  • decay origin
    value

    Origin point for the decay function.

    Default now

  • decay scale
    value

    Scale for the decay function (e.g. 7d, 30d).

    Default 7d

  • decay value
    number

    Decay factor (0 to 1).

    Default 0.5

  • decay weight
    number

    Weight for the decay function.

    Default 0.3

  • score mode
    value

    How function scores are combined: multiply, sum, avg, first, max, min.

    Default sum

  • boost mode
    value

    How function score combines with query score: multiply, replace, sum, avg, max, min.

    Default replace

  • max boost
    number

    Caps the maximum effect of scoring functions.

Out pins 1
  • query
    query

A typical wiring for function score: fields feeds the query pin; the query out pin feeds cast to object.

Studio canvas example for the function score block: typical wiring for function score.

Version history

Introduced in v14.0.4.


Back to query Return to the main group to view all sub-groups Back to query Return to the group to view all blocks within this group