Is it possible to change the score mode of SHOULD clause?


(Xudong You) #1

For example I have following 2 documents:

{"id":"1", "title":"elasticsearch", " description":"elasticsearch" }

{"id":"1", "title":"elasticsearch", " description":"bing" }

And following query:
{
"query" : {
"bool": {
"should": [
{
"match": {
"title": {
"query": "elasticsearch"
}
}
},
{
"match": {
"description": {
"query": "elasticsearch"
}
}
}]
}
}
}

The result score of documetn "1" is just the SUM of the scores of 2 sub
should clause, since both title and description contains "elasticsearch":

_explanation:
{
value: 0.4339554
description: "sum of:"
details: [2]
0:
{
value: 0.2169777
description: "weight(title:google in 0) [PerFieldSimilarity], result of:"
}
1:
{
value: 0.2169777
description: "weight(description:google in 0) [PerFieldSimilarity], result
of:"
}
}

The result score of document "2", however, is different:

explanation:
{
value: 0.04500804
description: "product of:"
details: [2]
0:
{
value: 0.09001608
}
1:
{
value: 0.5
description: "coord(1/2)"
}

The final score if NOT "SUM of" but "product of", I think it is because
in document "2", the "description" field does not contains
"elastticsearch", that is, half of all sub should clause match the query
term, that is why *coord(1/2) *comes in explanation.

My question is, is it possible to change the score mode of SHOULD clause so
that, the final score of SHOULD clause is always the *SUM *of sub clause,
no matter whether the sub clause match the query term or not?

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/

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/30417c8c-35a5-427c-989b-dff063d23eeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Kemp) #2

Have you tried the disable_coord feature of bool queries?
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

It might give you what you need.

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/

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/61402bae-4ff5-42f9-bd4f-046cc7fc9972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3