-
Notifications
You must be signed in to change notification settings - Fork 24.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-field type creates broken scores when not all fields have the same docCount #44700
Comments
Pinging @elastic/es-search |
@jpountz |
Below is the bug detail and reproduce step which I wrote in discuss.elastic.co. Elasticsearch version (
Plugins installed: []
JVM version (
OS version (
Reproduce Step: Create index
Add docs
Query
Response
|
@HanguChoi is there at least a work-around here which I can apply to my queries? The issue is opened for ~8 months, and there is a little hope that it will be fixed anytime soon. Maybe there is a way to tweak the |
@dko-slapdash , I am using It wasn't bad for our product. |
Any updates on this issue? |
Running into sporadic errors like this after upgrading from Elasticsearch 6.x to v7.9.3: {
"error" : {
"root_cause" : [
{
"type" : "exception",
"reason" : "function score query returned an invalid score: -5.805419 for doc: 1325"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "auto-complete",
"node" : "AR72bFoxQ0-8MfmP9np4NQ",
"reason" : {
"type" : "exception",
"reason" : "function score query returned an invalid score: -5.805419 for doc: 1325"
}
}
]
},
"status" : 500
} I'm also using a |
I am wondering if this is the same issue with what I am currently facing: I am using a cross-field multi-match query (with a tie breaker of 0.1) and all seems to work well. After wrapping the query in a script_score query, I start to get negative score exceptions. In the beginning I thought it had something to do with the script, but after changing the script to "_score", I still get the same errors. There seems to be some king of issue when script_score is combined with cross_fields, unless the issue has only to do with script_score and the negative scores are somehow automatically mitigated by ES when in normal query mode (not script_score). EDIT: As a temporary workaround, I have adjusted my script_score script, so that it returns 0 if _score is < 0; I suppose this messes with the scores, but at least it does not throw exceptions. |
An update on this issue: we are working on #41106, which will add a new multi-fields mode based on the BM25F scoring model. The recommendation going forward will be to use this new mode instead of |
@jtibshirani sounds good! Is there any (approximate) timeframe on this? We are working on a project that is dependent on cross-fields due to be released within 2-3 months. |
combined_fields cannot be used be in query_string query. Can we add this functionality |
I merged #89016, which fixes the From your feedback, we realized that I'm sorry that this took so long! In retrospect we could have fixed it sooner. Hopefully you were able to work around the issue in the meantime. |
This was reported at https://discuss.elastic.co/t/query-can-return-negative-score-i-couldnt-find-any-spec-on-documentation-the-minimum-value-of-score-is-not-0/191307. In this case, scores even get negative due to the fact that the docCount is less than the docFreq.
This would be addressed by #41106.
The text was updated successfully, but these errors were encountered: