Skip to content

ElasticsearchVectorStore: no reconnect persistence + deprecated/removed body= (breaks on es-py 9.x) — hidden by MagicMock #833

Closed

Description

@AmitoVrito

Summary

ElasticsearchVectorStore (src/synapsekit/retrieval/elasticsearch_vector.py), previously only MagicMock-tested, had two bugs found via real elasticsearch:8.15 testcontainers (epic #829).

Bugs

  1. No reconnect persistence — search() returned [] whenever not self._index_created and self._dims is None, so a freshly reconnected instance never found vectors already indexed in Elasticsearch. (Proven: write with one client, read with a second → empty.)
  2. Deprecated/removed body= — indices.create(..., body=...) and search(..., body=...) are deprecated in elasticsearch-py 8.x (DeprecationWarning) and removed in 9.x, so the store breaks entirely for users on the 9.x client (the elasticsearch extra is unpinned >=8.0).

Fix

  • Use modern kwargs: indices.create(index=, mappings=...) and search(index=, knn=..., size=...).
  • Drop the _dims is None guard; _search_sync returns [] on NotFoundError (covers search-before-add and reconnect).

Test

Real elasticsearch:8.15.3 testcontainer: true kNN nearest-neighbour ranking, metadata filter, top_k, persistence across reconnect, empty/negative. Replaces the MagicMock test; runs in the CI integration job.

Part of epic #829.

Activity

  1. added this to the v2.0.1 milestone on Jul 21, 2026
  2. added
    bug
    retrieval
    v2.0.1
    on Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugretrievalv2.0.1

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions