# Local Elasticsearch Connection

**URL:** <https://discuss.elastic.co/t/local-elasticsearch-connection/332467>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [May 3, 2023, 6:53pm UTC](https://discuss.elastic.co/t/local-elasticsearch-connection/332467 "2023-05-03T18:53:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbrimmer83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbrimmer83/32/52975_2.png) [@mbrimmer83](https://discuss.elastic.co/u/mbrimmer83)\
**Post date:** [May 3, 2023, 6:53pm UTC](https://discuss.elastic.co/t/local-elasticsearch-connection/332467/1 "2023-05-03T18:53:07Z")

</div>

We run Elasticsearch with Kibana and EnterpriseSearch locally for development. I can connect to AppSearch without issue, but I want to connect to Elasticsearch as [https://localhost:9200](https://localhost:9200) from my nodejs app with the latest elastic client using this configuration

```auto
{
            node: 'https://localhost:9200',
            auth: {
              apiKey: {
                id: ELASTIC_LOCAL_API_ID,
                api_key: ELASTIC_LOCAL_API_KEY
              }
            }
          }

```

I have tried multiple methods, including username and password and using the encoded key I got from ES, but I always get the same error. I followed some suggestions on StackOverflow but none of them worked.  
I get this error

```auto
ConnectionError: unable to verify the first certificate

```

---

<div class="post-metadata">

**Author:** ![demjened](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/demjened/32/109159_2.png) [@demjened](https://discuss.elastic.co/u/demjened)\
**Post date:** [May 26, 2023, 3:18pm UTC](https://discuss.elastic.co/t/local-elasticsearch-connection/332467/2 "2023-05-26T15:18:36Z")

</div>

Hi @mbrimmer83, localhost typically serves over plain HTTP, not HTTPS. Please try using [http://localhost:9200](http://localhost:9200) in your node configuration and see if the connection works.

---

<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:** [June 23, 2023, 3:18pm UTC](https://discuss.elastic.co/t/local-elasticsearch-connection/332467/3 "2023-06-23T15:18:37Z")

</div>

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