Elasticsearch 8.5 Inconsistent Scoring with Custom Function Score Query
I need some guidance on I'm updating my dependencies and I'm converting an old project and I am currently using Elasticsearch 8.5 and I've encountered an issue with scoring inconsistencies when using a custom function score query..... My goal is to boost the score of documents based on a certain field and return results that reflect this boost accurately. However, I'm noticing that the score values seem to vary significantly between similar queries, even when the input parameters remain the same. Hereβs the query I am using: ```json { "query": { "function_score": { "query": { "match": { "title": "elasticsearch" } }, "functions": [ { "filter": { "term": { "is_featured": true } }, "weight": 2 } ], "score_mode": "multiply", "boost_mode": "sum" } } } ``` When I run this query, I expect that documents with `is_featured` set to `true` should consistently appear with a higher score, but the results often fluctuate. For example, one time the document with `is_featured:true` scores around 5, and another time it scores 15, despite the underlying data not changing. I have also tried using different `score_mode` and `boost_mode` combinations, such as `first` and `replace`, but the inconsistencies remain. Additionally, I confirmed that the index refresh interval is set to 1s and that I am using the latest version of the client library for Java: ```xml <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>8.5.0</version> </dependency> ``` To rule out any document data issues, I also checked the `is_featured` field across multiple documents and ensured that they were correctly indexed. Is there a known issue with function scoring in 8.5, or is there a potential misconfiguration that could lead to these scoring discrepancies? Any insights on troubleshooting or best practices for consistent scoring would be appreciated. Any advice would be much appreciated. This issue appeared after updating to Json LTS. Any examples would be super helpful. The stack includes Json and several other technologies. Thanks in advance!