Unable to Connect to ElasticSearch

Hi guys can you please look into this? It is taking too much of my time.
This is an error regarding connection from nodeJs client to Elasticsearch.

Trying to connect to elasticsearch domain using lambda and elasticsearch client but getting connection error.
this is my docker-compose.yml file

version: "2.1"
services:
  localstack:
    image: "localstack/localstack:latest"
    container_name: "localstack"
    ports:
      - "4566-4620:4566-4620"
      - "127.0.0.1:8055:8080"
    environment:
      - DEBUG=1
      - EDGE_PORT=4566
      - DATA_DIR=/var/lib/localstack/data
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
      - LAMBDA_EXECUTOR=docker
      - DYNAMODB_SHARE_DB=1
      - DISABLE_CORS_CHECKS=1
      - AWS_DDB_ENDPOINT=http://localhost:4566
    volumes:
      - "${TMPDIR:-/var/lib/localstack}:/var/lib/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
    networks:
      - "local"

  
networks:
  local:
    driver: "bridge"
 

this is my elasticsearch client

const {Client} = require('@elastic/elasticsearch')
module.exports.elasticClient = new Client({
    node: 'http://mydomain.us-east-1.es.localhost.localstack.cloud:4566',
})

I'm trying to create index from client but connection is refused.

Expected Behavior

It should create index using Client connector.

Environment

  • OS:windows 11 - LocalStack: 1.3.0

Error I'm getting

lambda process returned with error. Result: {"errorType":"ConfigurationError","errorMessage":"Invalid protocol: 'mydomain.us-east-1.es.localhost.localstack.cloud:'"}. Output: 2022-12-14T13:11:45.942Z undefined ERROR Uncaught Exception {"errorType":"ConfigurationError","errorMessage":"Invalid protocol: 'mydomain.us-east-1.es.localhost.localstack.cloud:'","name":"ConfigurationError"

Welcome to our community! :smiley: We aren't all guys here though.

It's not clear what that repo has to do with either Elasticsearch or nodejs sorry. If you have code and errors then it'd be great if you posted them directly here.

sure, i'll add the code as well

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