Support for script_score in function_score in Golang client

Hi. The docs show the following example for using script_score within function_score:

"query" : {
         "score_mode": "multiply",
         "rescore_query" : {
            "function_score" : {
               "script_score": {
                  "script": {
                    "source": "Math.log10(doc.count.value + 2)"
                  }
               }
            }
         }
}

The example has script_score directly within function_score. I'm trying to recreate this using the Go ES library. However, the FunctionScoreQuery in the Go lib does not support adding a script_score directly:

type FunctionScoreQuery struct {
	Boost      *float32                             `json:"boost,omitempty"`
	BoostMode  *functionboostmode.FunctionBoostMode `json:"boost_mode,omitempty"`
	Functions  []FunctionScore                      `json:"functions,omitempty"`
	MaxBoost   *Float64                             `json:"max_boost,omitempty"`
	MinScore   *Float64                             `json:"min_score,omitempty"`
	Query      *Query                               `json:"query,omitempty"`
	QueryName_ *string                              `json:"_name,omitempty"`
	ScoreMode  *functionscoremode.FunctionScoreMode `json:"score_mode,omitempty"`
}

Instead, you have to define an array of functions, and within the first element, you can define a script_score

Is there any difference between using "function_score" : { "script_score": { ... vs "function_score" : { "functions": [{"script_score": {....? Is there a reason why the Go library does not support the former?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.