def test_search_bm25(self, sync_client: Elasticsearch, index: str) -> None:
        """Test end to end using the BM25Strategy retrieval strategy."""
        store = VectorStore(
            index=index,
            retrieval_strategy=BM25Strategy(),
            client=sync_client,
        )

        texts = ["foo", "bar", "baz"]
        store.add_texts(texts)

        def assert_query(query_body: dict, query: Optional[str]) -> dict:
            assert query_body == {
                "query": {
                    "bool": {
                        "must": [{"match": {"text_field": {"query": "foo"}}}],
                        "filter": [],
                    }
                }
            }
            return query_body

        output = store.search(query="foo", k=1, custom_query=assert_query)
        assert [doc["_source"]["text_field"] for doc in output] == ["foo"]
Test end to end using the BM25Strategy retrieval strategy.
test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py