Elasticsearch Lab LangChain Sample App Requirements

Hello Elastic,

I found this github to run my own sample apps for a starting point for my project

Elastic LangChain Sample App

I would like to run this apps but I notice it requires Elastic Could ID?

Currently I've been using the Self-managed platform, how do I define the environment?

I'm interested to run this notebook also : Question-Answering, and I notice I need to use the Elastic Cloud ID also.

Couldn't we define the Hostname of the Elastic or we really need to use the Cloud Id for this notebook?

Thank you.

Hi @aisyaharifin , the notebooks use cloud because it's very easy to spin up. You could use these examples and the ElasticsearchStore documentation to modify cloud examples to work with an on prem deployment.

1 Like

as @Kathleen_DeRusso mentioned, you can adjust the connection details using the documentation.

This is a better documenation link which shows all the connection options available. https://python.langchain.com/docs/integrations/vectorstores/elasticsearch#authentication

In the case of using the url, you can use


For the app, you can update the code to connect to url here https://github.com/elastic/elasticsearch-labs/blob/main/example-apps/workplace-search/api/elasticsearch_client.py#L10-L12

We will in future support es_url via env variable soon.

1 Like

Thank you for the reply.

So I've countered this error on the ssl when I run the script, is there a way we could disable the ssl verification?

Error connecting to Elasticsearch: TLS error caused by: TlsError(TLS error caused by: SSLError([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)))


You can create connection and pass it like this

conn = Elasticsearch(
    ca_certs = "/tmp/ca.crt",
    basic_auth = ("username", "password")

es = ElasticsearchStore(

What Ashish is showing in this example is providing the self-signed SSL cert to the elasticsearch client.

If your self-hosted elasticsearch is only for development purposes, you can disable SSL. Heres an example of how to run via docker here Elasticsearch | 🦜️🔗 Langchain

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.