spring-projects / spring-projects/spring-ai

OpenSearch changed cosine similarity score in 2.19

Open
#4,765 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

I guess this is just a heads-up, because I spend a couple hours searching before I found the cause.
OpenSearch changed the formula to calculate cosine similarity in version 2.19, apparently they didn't realize this was a breaking change when you use minScore.

https://github.com/opensearch-project/k-NN/pull/2357
https://github.com/opensearch-project/k-NN/issues/2561

So, as of 2.19 it's not required anymore to add a 0.5 boost to the script_score query...
Not sure if it's the same for 3.x... sadly I'm stuck on 2.x, because of the infra guys :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the linked OpenSearch k-NN pull request #2357 and issue #2561 first, then search spring-ai for OpenSearch script_score and minScore handling. The report names no target file, test, or requested change; clarify whether compatibility changes or documentation are wanted before starting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.