Guest User

Untitled

a guest
Nov 23rd, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. code for connecting to elastic cloud
  2.  
  3. const elasticsearch = require('elasticsearch');
  4. const getElasticClient = () => {
  5.   // const esClient = new elasticsearch.Client({
  6.   //   host: 'localhost:9200',
  7.   //   log: 'info'
  8.   // });
  9.   const esClient = new elasticsearch.Client({
  10.     hosts: [
  11.     //   'https://elastic:mM320Lv403eWrtQKXA3VWgfl@79c3a93ce95743f2b6d28add4db92cd8.ap-southeast-1.aws.found.io:9243/']
  12.     });
  13.   return esClient;
  14. };
  15.  
  16.  
  17. Error i keep getting whenever i start the code is
  18.  
  19. ERROR: 2018-11-23T05:33:01Z
  20.   Error: Request error, retrying
  21.   HEAD http://localhost:9200/ => connect ECONNREFUSED 127.0.0.1:9200
  22.       at Log.error (D:\newOg-tk\og-tk3\og-tk\node_modules\elasticsearch\src\lib\log.js:226:56)
  23.       at checkRespForFailure (D:\newOg-tk\og-tk3\og-tk\node_modules\elasticsearch\src\lib\transport.js:259:18)
  24.       at HttpConnector.<anonymous> (D:\newOg-tk\og-tk3\og-tk\node_modules\elasticsearch\src\lib\connectors\http.js:163:7)
  25.       at ClientRequest.wrapper (D:\newOg-tk\og-tk3\og-tk\node_modules\lodash\lodash.js:4949:19)
  26.       at ClientRequest.emit (events.js:180:13)
  27.       at Socket.socketErrorListener (_http_client.js:395:9)
  28.       at Socket.emit (events.js:180:13)
  29.       at emitErrorNT (internal/streams/destroy.js:64:8)
  30.       at process._tickCallback (internal/process/next_tick.js:178:19)
Add Comment
Please, Sign In to add comment