Repository navigation
Real testcontainers tests for Elasticsearch (fixes reconnect + es-py 9.x break) — #829 - #834
Merged
Merged
Conversation
…odern clients (#833) Only ever tested with a MagicMock, which hid two bugs found against a real Elasticsearch: search() returned [] after a reconnect (it short-circuited on a missing cached dimension), and it used the `body=` argument that is deprecated in elasticsearch-py 8.x and removed in 9.x, so the store breaks entirely on the 9.x client. Use modern kwargs — `indices.create(mappings=...)` and `search(knn=..., size=...)` — and drop the `_dims is None` guard; `_search_sync` returns [] on NotFoundError, which covers both search-before-add and a genuinely missing index while letting a reconnected instance find already-indexed vectors. Adds real elasticsearch:8.15 testcontainers tests (kNN nearest-neighbour ranking, metadata filter, top_k, persistence, negatives) and removes the MagicMock test. Part of #829. Closes #833.
Closed
18 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Next backend in epic #829: Elasticsearch converted to real testcontainers tests. Deep testing against a real
elasticsearch:8.15found 2 mock-hidden bugs (#833).Bugs found & fixed
search()returned[]after a reconnect (short-circuited on a missing cached dim), so a fresh instance never found already-indexed vectors. Proven: write with one client, read with a second → empty.body=—indices.create(body=)/search(body=)are deprecated in elasticsearch-py 8.x and removed in 9.x; the store breaks entirely on the 9.x client. Now usesmappings=/knn=kwargs.Verification (real data, real queries)
Inserts real docs into a real ES index, refreshes, runs real kNN vector search, asserts the true nearest neighbour +
_scoreorder + metadata round-trip; persistence test reads back through a second client. 7/7 pass againstelasticsearch:8.15.3, wired into the CIintegrationjob.Commits
fix(retrieval): make ElasticsearchVectorStore work on reconnect and modern clients (#833)ci(test): add elasticsearch to the integration group and CI job (#829)Part of #829.