Lack of live connection Error connecting Elasticsearch in nodejs

I am having this problem when connecting elasticsearch connections.


var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({ host: 'localhost:9200',
                                       log: 'trace'});


Elasticsearch ERROR: 2016-07-19T19: 09: 26Z
  Error: Request error, retrying - connect ECONNREFUSED 127.0.0.1:9200
      at Log.error (/root/git_build/FirstMoveChess/node_modules/elasticsearch/src/lib/log.js:225:56)
      at checkRespForFailure (/root/git_build/FirstMoveChess/node_modules/elasticsearch/src/lib/transport.js:195:18)
      at HttpConnector. (/root/git_build/FirstMoveChess/node_modules/elasticsearch/src/lib/connectors/http.js:154:7)
      at ClientRequest.bound (/root/git_build/FirstMoveChess/node_modules/lodash-node/modern/internals/baseBind.js:56:17)
      at emitOne (events.js: 96: 13)
      at ClientRequest.emit (events.js: 188: 7)
      at Socket.socketErrorListener (_http_client.js: 308: 9)
      at emitOne (events.js: 96: 13)
      at Socket.emit (events.js: 188: 7)
      at emitErrorNT (net.js: 1272: 8)
      at _combinedTickCallback (internal / process / next_tick.js: 74: 11)
      at process._tickCallback (internal / process / next_tick.js: 98: 9)

Elasticsearch TRACE: 2016-07-19T19: 09: 27Z
  -> HEAD http: // localhost: 9200 /

  
+4
source share
1 answer

I understand that this question is quite old, but I wanted to share how you can solve this problem.

  • If you use local elasticsearch search

The first thing you need to do is run elasticsearch on your machine.

Error: Request error, retrying -- connect ECONNREFUSED 127.0.0.1:9200

, elasticsearch .

, .

.

.

node.js elasticsearch client, elasticsearch host 172.24.0.1.

container_name private IP of container docker-compose.yml, .

+1

Source: https://habr.com/ru/post/1648423/


All Articles