def test_search_with_sparse_infer_instack(
        self, sync_client: Elasticsearch, index: str
    ) -> None:
        """test end to end with sparse retrieval strategy and inference in-stack"""

        if not model_is_deployed(sync_client, ELSER_MODEL_ID):
            reason = f"{ELSER_MODEL_ID} model not deployed in ML Node, skipping test"
            pytest.skip(reason)

        store = VectorStore(
            index=index,
            retrieval_strategy=SparseVectorStrategy(model_id=ELSER_MODEL_ID),
            client=sync_client,
        )

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

        output = store.search(query="foo", k=1)
        assert [doc["_source"]["text_field"] for doc in output] == ["foo"]
test end to end with sparse retrieval strategy and inference in-stack
test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py