-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Cleanup: Remove obsolete TODO from SparseVectorQueryBuilder #134702
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
Cleanup: Remove obsolete TODO from SparseVectorQueryBuilder #134702
Conversation
|
Hi @kderusso 👋 This draft PR addresses the SparseVectorQueryBuilder refactoring. Highlights:
Would love your thoughts, especially on whether the InferenceAction.Request standardization and overall approach match the intended architectural direction. 🙏 |
kderusso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mridula-s109 so sorry about the confusion here, the Jira ticket you were assigned said that Sparse Vector was still in ml and we didn't verify that it had already been moved to core during planning 😅
I think the cleanup refactoring that you've done here makes sense for the most part, with some caveats:
- I would like to understand the difference between a CoordinatedInferenceAction and an InferenceAction. By changing this, what is actually changing under the hood and what side effects are there? Knowing that someone has done this research is important for peace of mind
- The bulk of the work for this type of refactor lies in test failures - and there are a lot of these in your PR.
It would be worth thinking about whether we need this PR, or since it's already in core if we just try to do a refactoring to server.
...ugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java
Outdated
Show resolved
Hide resolved
...core/src/main/java/org/elasticsearch/xpack/core/search/vectors/SparseVectorQueryBuilder.java
Outdated
Show resolved
Hide resolved
...ugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java
Outdated
Show resolved
Hide resolved
...core/src/main/java/org/elasticsearch/xpack/core/search/vectors/SparseVectorQueryBuilder.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/elasticsearch/xpack/core/search/vectors/SparseVectorQueryBuilderTests.java
Outdated
Show resolved
Hide resolved
Hey @kderusso, thanks for clarifying!Since sparse vector is already in core, would you be okay with me closing this PR and also resolving the Jira issue? |
Can you please open a smaller PR to clear out the TODOs to avoid confusion down the line? |
|
Also, did you time box looking into moving this to |
|
I noticed that sparse vector yaml tests are still in ML, if we're keeping this PR we should probably move them (unless there's a compelling "this will break everything" reason to keep them) |
3ff23bf to
2b3a991
Compare
Thanks for the thoughtful feedback @kderusso and @ioanatia 🙏 To clarify the CoordinatedInferenceAction vs InferenceAction part:
Since SparseVector queries don’t currently need cross-cluster coordination, switching to InferenceAction.Request aligns with what we already do in SemanticQueryBuilder. Functionally, this shouldn’t change behaviour for local queries, but it does reduce unnecessary complexity. On the scope of the refactor:
|
I tested everything locally with ./gradlew :x-pack:plugin:inference:check and all the tests passed. I’ll also double-check any failures once CI finishes running. |
Is that true, or would that break CCS for sparse vector search? |
This does not break CCS support. The CCS support that we recently added for SparseVectorQueryBuilder kicks in only when we query Taking a closer look at This change actually breaks something else, in a more subtle way. On this branch, if |
|
Pinging @elastic/search-relevance (Team:Search - Relevance) |
|
Hi @mridula-s109, I've created a changelog YAML for you. |
|
As its already removed to core, just removed the redundant todo @kderusso . We can evaluate moving to server later when necessary. |
...ugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java
Show resolved
Hide resolved
...ugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java
Outdated
Show resolved
Hide resolved
…ml/search/SparseVectorQueryBuilder.java Co-authored-by: Kathleen DeRusso <[email protected]>
...ugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java
Outdated
Show resolved
Hide resolved
kderusso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
…134702) * Removed the TODO * Updated the sparevector similar to Semantic query builder * Update docs/changelog/134702.yaml * Remove obsolete TODO comment from SparseVectorQueryBuilder * [CI] Auto commit changes from spotless * Modified the TODO to make more sense * Delete docs/changelog/134702.yaml * Update x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java Co-authored-by: Kathleen DeRusso <[email protected]> * Update SparseVectorQueryBuilder.java --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Kathleen DeRusso <[email protected]>
Summary
Small cleanup to bring
SparseVectorQueryBuilderin line with current inference APIs and the pattern used bySemanticQueryBuilder.Changes
CoordinatedInferenceAction.RequestwithInferenceAction.Request(parity withSemanticQueryBuilder).TODOabout moving this to xpack core (it’s already in core).validateAndExtractTextExpansionResults(...)helper for clearer errors and consistency.