I am using opensearch local client and that client I was using to create langchain instance to use that instance for creating embeddings and retrieve embeddings but it gives me the following error
error: raise ConnectionError("N/A", str(e), e) opensearchpy.exceptions.ConnectionError: ConnectionError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')))
caused by: ProtocolError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')))
I created opensearch local client and was storing documents and embeddings directly in opensearch using client.bulk(bulk_data) and bulk data has all the documents and chunks which are storing in opensearch, it means that local client of opensearch is working perfectly fine, but having problem with langchains instance. I want to work with langchain so I want to resolve the connection abort problem with langchain instance.
code:
index_instance = OpenSearchVectorSearch(
client=client,
index_name=index_name,
opensearch_url="http://localhost:9200",
embedding_function=OpenAIEmbeddings,
engine="faiss"
)
print("instance created")
texts = [d.page_content for d in chunks]
metadatas = [d.metadata for d in chunks]
embedder = OpenAIEmbeddings()
embeddings = embedder.embed_documents(texts)
doc_store = index_instance.from_embeddings(embeddings=embeddings, texts=texts, embedding=embedder,
metadatas=metadatas, opensearch_url="http://localhost:9200")