Local Elasticsearch Connection

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 from my nodejs app with the latest elastic client using this configuration

{
            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

ConnectionError: unable to verify the first certificate

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

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