Function_score weight of 0.0 returns 1

Any ideas why this would return a score of 1, when the last (bool must_not)
matches, even though the weight is set to 0.0?

As a bit of background, this provides custom scoring where

  • if one field matches, score at .35,
  • if another more important field matches, score .65,
  • if both match, score 1.0 (the sume)
  • if non match, score 0

If I change the no match weight to -1 or something very small, like
0.000001, the weight for the must_not match comes back accurately.
I am thinking this is some kind of divide by 0 error handerl in ES, that
returns 1 when a score hits 0?

GET test/document/_search
{
"query": {
"function_score": {
"filter": { "term": { "type": "animal" } },
"functions": [
{
"filter": {
"bool" : {
"must" : {
"term" : { "content" : "fish"}
}}},
"weight": 0.35
},
{
"filter": {
"bool" : {
"must" : {
"term" : { "user_description" : "fish" }
}}},
"weight": 0.65
},
{
"filter": {
"bool" : {
"must_not" : [
{"term" : { "user_description" : "fish" }},
{"term" : { "content" : "fish" }}
]
}
},
"weight": 0.0
}
],
"score_mode": "sum"
}
}
}

--
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/de18cc05-c797-45d5-aa4d-b5426e9562d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

BTW, I am running against Elasticsearch version
1.4.4

On Monday, February 23, 2015 at 6:49:59 PM UTC-8, Jeff Steinmetz wrote:

Any ideas why this would return a score of 1, when the last (bool
must_not) matches, even though the weight is set to 0.0?

As a bit of background, this provides custom scoring where

  • if one field matches, score at .35,
  • if another more important field matches, score .65,
  • if both match, score 1.0 (the sume)
  • if non match, score 0

If I change the no match weight to -1 or something very small, like
0.000001, the weight for the must_not match comes back accurately.
I am thinking this is some kind of divide by 0 error handerl in ES, that
returns 1 when a score hits 0?

GET test/document/_search
{
"query": {
"function_score": {
"filter": { "term": { "type": "animal" } },
"functions": [
{
"filter": {
"bool" : {
"must" : {
"term" : { "content" : "fish"}
}}},
"weight": 0.35
},
{
"filter": {
"bool" : {
"must" : {
"term" : { "user_description" : "fish" }
}}},
"weight": 0.65
},
{
"filter": {
"bool" : {
"must_not" : [
{"term" : { "user_description" : "fish" }},
{"term" : { "content" : "fish" }}
]
}
},
"weight": 0.0
}
],
"score_mode": "sum"
}
}
}

--
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/7edb1ff9-a2f5-4770-9d83-d1afdd5af6ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.