From 6384c1ec8f79542b57729d98cdb98732922ad065 Mon Sep 17 00:00:00 2001 From: happyxhw <44490504+happyxhw@users.noreply.github.com> Date: Thu, 27 Jul 2023 01:33:52 +0800 Subject: [PATCH] fix: ElasticVectorSearch.from_documents failed #8293 (#8296) - Description: fix ElasticVectorSearch.from_documents with elasticsearch_url param, - Issue: ElasticVectorSearch.from_documents failed #8293 # it fixes (if applicable), --------- Co-authored-by: Bagatur --- libs/langchain/langchain/vectorstores/elastic_vector_search.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/langchain/langchain/vectorstores/elastic_vector_search.py b/libs/langchain/langchain/vectorstores/elastic_vector_search.py index 9b931c5ea4e..6de04aff82b 100644 --- a/libs/langchain/langchain/vectorstores/elastic_vector_search.py +++ b/libs/langchain/langchain/vectorstores/elastic_vector_search.py @@ -294,6 +294,8 @@ class ElasticVectorSearch(VectorStore, ABC): elasticsearch_url = get_from_dict_or_env( kwargs, "elasticsearch_url", "ELASTICSEARCH_URL" ) + if "elasticsearch_url" in kwargs: + del kwargs["elasticsearch_url"] index_name = index_name or uuid.uuid4().hex vectorsearch = cls(elasticsearch_url, index_name, embedding, **kwargs) vectorsearch.add_texts(