Elasticsearch-js: TypeError: URL is not a constructor

Created on 15 Jul 2019  路  3Comments  路  Source: elastic/elasticsearch-js

馃悰 Bug Report

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

Paste your code here:

const client6 = new elastic.Client({ node: "http://127.0.0.1:9200" });

image

Your Environment

  • node version: 8
  • @elastic/elasticsearch version: >=6.0.0
  • os: Mac
  • any other relevant information

All 3 comments

Hello! From the log it seems that you are using the client from the browser, am I right?
In such case, there is no official support for the browser since expose your Elasticsearch instance to the rest of the world will cause you security issues eventually.
I recommend you to write a lightweight proxy that uses this client instead.

so does it mean it won't work with Angular app?

@alishah730 correct. The client is not intended to be used in a browser environment, and we highly discourage you to connect to Elasticsearch directly form the browser, see https://github.com/elastic/elasticsearch-js/issues/1066.

Was this page helpful?
0 / 5 - 0 ratings