-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
The cross_fields scoring type can produce negative scores when some documents are missing fields.
This bug was already reported for Elasticsearch and fixed with this MR for Elasticsearch >= 8.4.
We encounter it randomly on production for certain queries when we search a field that does not exist in all documents.
It appears deterministically for these search queries.
Error message:
{ "error": { "root_cause": [ { "type": "exception", "reason": "function score query returned an invalid score: -0.05202394 for doc: 1123896" } ], "type": "search_phase_execution_exception", "reason": "all shards failed", "phase": "query", "grouped": true, "failed_shards": [ { "shard": 0, "index": "my_index", "node": "my_node", "reason": { "type": "exception", "reason": "function score query returned an invalid score: -0.05202394 for doc: 1123896" } } ] }, "status": 500 }
The document number mentioned in the error message does not exist.
To Reproduce
The steps to reproduce are in the above mentioned bug report for Elasticsearch.
Expected behavior
The function score should never return a negative value.
Plugins
None.
Host/Environment (please complete the following information):
OpenSearch version: 2.5
Metadata
Metadata
Assignees
Labels
Type
Projects
Status