langchain
langchain copied to clipboard
Issue: ElasticsearchEmbeddings does not work on hosted elasticsearch (Platinum)
Issue you'd like to raise.
LangChain 0.0.179, hosted elasticsearch (Platinum edition)
V0.0.179 introduced elasticsearch embeddings, great!
But it is only implemented for elastic cloud.
I want to be able to do embeddings on my own elastic cluster.
@jeffvestal @derickson
Suggestion:
No response
I can add in the ability to use a url (the elasticsearch url) to the connection object rather than the cloud_id.
Would that work for you @lemig ?
I would rather pass ES client. If not, I need to pass an elasticsearch url plus elastic client options. See ssl_verify param in: https://github.com/hwchase17/langchain/commit/039f8f1abb03cc7983282bfa285920d00231e360#diff-6df1e93fbce8079475f40ff4465b79aa5e41131e63eb1d3c57b42b7779cb7adbR137
That should work. I'll take a look at it soon.
@lemig PR was merged.
# Create Elasticsearch connection
es_connection = Elasticsearch(
hosts=['https://es_cluster_url:port'],
basic_auth=('user', 'password')
)
# Instantiate ElasticsearchEmbeddings using es_connection
embeddings = ElasticsearchEmbeddings.from_es_connection(
model_id,
es_connection,
)
Awesome. Thanks @jeffvestal & Elastic!