# Elasticsearch Lab LangChain Sample App Requirements

**URL:** <https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181>\
**Category:** Elastic Search\
**Tags:** elastic-app-search, elastic-workplace-search\
**Created:** [November 15, 2023, 1:04am UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181 "2023-11-15T01:04:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [November 15, 2023, 1:04am UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/1 "2023-11-15T01:04:16Z")

</div>

Hello Elastic,

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

[Elastic LangChain Sample App](https://github.com/elastic/elasticsearch-labs/blob/main/example-apps/workplace-search/README.md)

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?

 ![Screenshot 2023-11-15 at 9.03.33 AM](https://us1.discourse-cdn.com/elastic/original/3X/6/6/66cdb3b8ebdefa23d735e272bee73b2bc572adc2.png)

I'm interested to run this notebook also : [Question-Answering](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/generative-ai/question-answering.ipynb), and I notice I need to use the Elastic Cloud ID also.

 ![Screenshot 2023-11-15 at 9.08.03 AM](https://us1.discourse-cdn.com/elastic/original/3X/f/8/f89d626f42f72f18477a2d1666e8e8cbcfa855e7.png)

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

Thank you.

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [November 15, 2023, 1:01pm UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/2 "2023-11-15T13:01:00Z")

</div>

Hi @aisyaharifin , the notebooks use cloud because it's very easy to spin up. You could use these examples and the [ElasticsearchStore documentation](https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elasticsearch.ElasticsearchStore.html) to modify cloud examples to work with an on prem deployment.

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [November 15, 2023, 1:20pm UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/3 "2023-11-15T13:20:38Z")

</div>

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](https://python.langchain.com/docs/integrations/vectorstores/elasticsearch#authentication)

In the case of using the url, you can use

```auto
ElasticsearchStore(
    es_url="URL",
    es_user=CLOUD_USERNAME,
    es_password=CLOUD_PASSWORD,

```

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](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.

---

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [November 16, 2023, 3:44am UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/4 "2023-11-16T03:44:24Z")

</div>

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)))`

Thanks.

---

<div class="post-metadata">

**Author:** ![ashishtiwari1993](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishtiwari1993/32/135241_2.png) [@ashishtiwari1993](https://discuss.elastic.co/u/ashishtiwari1993)\
**Post date:** [November 16, 2023, 6:46am UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/5 "2023-11-16T06:46:25Z")

</div>

You can create connection and pass it like this

```py
conn = Elasticsearch(
    "https://localhost:9200",
    ca_certs = "/tmp/ca.crt",
    basic_auth = ("username", "password")
)

es = ElasticsearchStore(
    es_connection=conn,
    index_name="test",
    embedding=embeddings
)

```

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [November 16, 2023, 9:00am UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/6 "2023-11-16T09:00:46Z")

</div>

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](https://python.langchain.com/docs/integrations/vectorstores/elasticsearch#running-elasticsearch-via-docker)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 14, 2023, 9:01am UTC](https://discuss.elastic.co/t/elasticsearch-lab-langchain-sample-app-requirements/347181/7 "2023-12-14T09:01:09Z")

</div>

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