Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ElasticsearchStore] Improve migration text to ElasticsearchStore #11158

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions libs/langchain/langchain/vectorstores/elastic_vector_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""[DEPRECATED] Please use ElasticsearchStore instead."""
from __future__ import annotations

import uuid
Expand Down Expand Up @@ -51,9 +50,19 @@ def _default_script_query(query_vector: List[float], filter: Optional[dict]) ->
}


@deprecated("0.0.265", alternative="ElasticsearchStore class.", pending=True)
class ElasticVectorSearch(VectorStore):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the deprecation notice? It sends a warning to users letting them know that there's a better implementation. It doesn't necessarily mean that this implementation will be removed soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @eyurtsev thanks for review. Will the notice "deprecated" be still mentioned in the docs if it continues to be there? Ideally we dont want this message there as gives the wrong signal. Thanks!

"""[DEPRECATED] `Elasticsearch` vector store.
"""

ElasticVectorSearch uses the brute force method of searching on vectors.

Recommended to use ElasticsearchStore instead, which gives you the option
to uses the approx HNSW algorithm which performs better on large datasets.

ElasticsearchStore also supports metadata filtering, customising the
query retriever and much more!

You can read more on ElasticsearchStore:
https://python.langchain.com/docs/integrations/vectorstores/elasticsearch

To connect to an `Elasticsearch` instance that does not require
login credentials, pass the Elasticsearch URL and index name along with the
Expand Down Expand Up @@ -339,10 +348,17 @@ def delete(self, ids: Optional[List[str]] = None, **kwargs: Any) -> None:
self.client.delete(index=self.index_name, id=id)


@deprecated("0.0.265", alternative="ElasticsearchStore class.", pending=True)
class ElasticKnnSearch(VectorStore):
"""[DEPRECATED] `Elasticsearch` with k-nearest neighbor search
(`k-NN`) vector store.

Recommended to use ElasticsearchStore instead, which supports
metadata filtering, customising the query retriever and much more!

You can read more on ElasticsearchStore:
https://python.langchain.com/docs/integrations/vectorstores/elasticsearch

It creates an Elasticsearch index of text data that
can be searched using k-NN search. The text data is transformed into
vector embeddings using a provided embedding model, and these embeddings
Expand Down