Fix copy_to functionality with vector fields. - #3162
krocky-cooky wants to merge 2 commits into
Conversation
dbdf7f6 to
6579880
Compare
kotwanikunal
left a comment
There was a problem hiding this comment.
@krocky-cooky - Thanks for raising the PR for testing the copy_to functionality. Before we can close out the linked issue - we need some additional tests with DerivedSource enabled as well as non happy path test cases.
| String targetField1 = "target_vector_1"; | ||
| String targetField2 = "target_vector_2"; | ||
|
|
||
| String mapping = XContentFactory.jsonBuilder() |
There was a problem hiding this comment.
There is a lot of duplication with the mapping creation logic. Can you please pull it out into a helper method or extend an existing one?
| .endObject() | ||
| .startObject(targetField1) | ||
| .field("type", "knn_vector") | ||
| .field("dimension", 2) |
There was a problem hiding this comment.
Can you add in a case where the dimensions across the mappings mismatch?
There was a problem hiding this comment.
Added non happy path test cases!
| assertEquals(1, results2.size()); | ||
| assertEquals("1", results2.get(0).getDocId()); | ||
|
|
||
| deleteKNNIndex(indexName); |
There was a problem hiding this comment.
Please wrap the delete behind a finally block - that should avoid any flakiness.
There was a problem hiding this comment.
Since ODFERestTestCase already has index cleanup logic in its @after method (wipeAllODFEIndices)
, I believe flakiness should be mitigated. That said, would you still prefer adding try-finally
blocks for clarity? My concern is that it would increase nesting depth in the test methods.
| } | ||
|
|
||
| @SneakyThrows | ||
| public void testCopyTo_whenSearchOnTargetField_thenSuccess() { |
There was a problem hiding this comment.
Can you also please add in a new test within DerivedSourceIT with the copy to functionality? That path is crucial and we should validate copyTo works with derived source enabled before closing out the issue
078b418 to
dad6ce2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3162 +/- ##
============================================
- Coverage 83.89% 83.87% -0.02%
Complexity 4430 4430
============================================
Files 456 456
Lines 15981 15981
Branches 2101 2101
============================================
- Hits 13407 13404 -3
- Misses 1777 1779 +2
- Partials 797 798 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8183f02 to
87fa2eb
Compare
73ab8a6 to
cb9ff23
Compare
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit cb9ff23.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍(Review updated until commit 812e48b)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 812e48b Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 819a512
Suggestions up to commit 020134b
Suggestions up to commit be9f72e
|
be9f72e to
020134b
Compare
|
Persistent review updated to latest commit 020134b |
020134b
020134b to
819a512
Compare
|
Persistent review updated to latest commit 819a512 |
|
Persistent review updated to latest commit 812e48b |
Description
Previously, adding the copy_to attribute to a vector field would cause an error during indexing. The root cause of this issue is the same as the cause of geo_point issue(opensearch-project/OpenSearch#20540) and has been resolved by opensearch-project/OpenSearch#20542. This PR includes integration tests that verify the copy_to attribute works correctly on vector fields.
Related Issues
Resolves #2636
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.