Script function score default score combiner

Hello,

I see that ScriptScoreFunction defaults to Replace, which makes total sense:

public ScriptScoreFunction(String sScript, Map<String, Object> params, SearchScript script) {
    super(CombineFunction.REPLACE);
    this.sScript = sScript;
    this.params = params;
    this.script = script;
}

However, when I try to combine a nested query score into my script score, I
get the Multiply behavior.

For example, this query will return a score of 1 ((-1)*(-1)) if I drop the
line "boost_mode" : "replace",
POST _search
{
"query": {
"function_score": {
"boost_mode" : "replace",
"query": {
"nested": {
"score_mode": "max",
"query": {
"function_score": {
"query": {
"match_all": {}
},
"script_score": {
"script": "-1"
}
}
},
"path": "some_nested_path"
}
},
"script_score": {
"script": "_score"
}
}
}
}

Makes sense to anyone?

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/143c4bd7-fbe9-4fc5-a56f-8449e8cdf981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Well documentation says that boost default is indeed Multiply (I was
looking at the default of combine):

So I guess nothing suspicious here :slight_smile:

On Sunday, May 18, 2014 2:31:10 PM UTC+3, Meidan wrote:

Hello,

I see that ScriptScoreFunction defaults to Replace, which makes total
sense:

public ScriptScoreFunction(String sScript, Map<String, Object> params, SearchScript script) {
    super(CombineFunction.REPLACE);
    this.sScript = sScript;
    this.params = params;
    this.script = script;
}

However, when I try to combine a nested query score into my script score,
I get the Multiply behavior.

For example, this query will return a score of 1 ((-1)*(-1)) if I drop the
line "boost_mode" : "replace",
POST _search
{
"query": {
"function_score": {
"boost_mode" : "replace",
"query": {
"nested": {
"score_mode": "max",
"query": {
"function_score": {
"query": {
"match_all": {}
},
"script_score": {
"script": "-1"
}
}
},
"path": "some_nested_path"
}
},
"script_score": {
"script": "_score"
}
}
}
}

Makes sense to anyone?

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/16d5102a-6773-4af7-9292-43c83b6e23b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.