Bug Fix: Correct Parameter Type for KnnSearch$Builder.k Method in ElasticsearchVectorStore.java #1915
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug Fix
Correct Parameter Type for KnnSearch$Builder.k Method in ElasticsearchVectorStore.java
Description
This PR addresses a bug in ElasticsearchVectorStore.java where an incorrect parameter type was passed to the
KnnSearch$Builder.k
method of the ElasticSearchClient during the execution of similaritySearch. The issue caused the following error:Root Cause
The
KnnSearch$Builder.k
method inelasticsearch-rest-client:8.15.4
requires an Integer parameter, but the code passed a long value, leading to the NoSuchMethodError.Fix
The fix involves changing the parameter type from long to Integer when calling the
KnnSearch$Builder.k
method.Changes
Updated ElasticsearchVectorStore.java to pass an Integer parameter to the
KnnSearch$Builder.k
method.