elasticsearch-js: Unable to revive connection: http://localhost:9200/
I am using v0.10.25 still getting this .It was working fine 2 days ago .
Elasticsearch ERROR: 2014-03-19T08:05:18Z
Error: Request error, retrying -- connect ECONNREFUSED
at Log.error (/home/ajay/node_modules/elasticsearch/src/lib/log.js:213:60)
at checkRespForFailure (/home/ajay/node_modules/elasticsearch/src/lib/transport.js:185:18)
at HttpConnector.<anonymous> (/home/ajay/node_modules/elasticsearch/src/lib/connectors/http.js:150:7)
at ClientRequest.bound (/home/ajay/node_modules/elasticsearch/node_modules/lodash-node/modern/internals/baseBind.js:56:17)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1547:9)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
Elasticsearch WARNING: 2014-03-19T08:05:18Z
Unable to revive connection: http://127.0.0.1:9200/
Elasticsearch WARNING: 2014-03-19T08:05:18Z
No living connections
{ message: 'No Living connections' }
elasticsearch cluster is down!
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 21 (5 by maintainers)
On OSX with ElasticSearch server running in a docker container, I was getting the
ECONNREFUSED
error. I had mapped 9200 of the container to 9200 of the localhost and was trying to get to ElasticSearch throughlocalhost:9200
.Just had to change the elastic search’s ip in my JS code directly to
docker-machine
’s ip which you can get usingecho $(docker-machine ip)
and it started working. Strange, but might solve someone’s problem if just wanna get it to work.I’m using
"elasticsearch": "11.0.1"
I wouldn’t suggest putting the master version of elasticsearch.js in your package.json. Master is regularly broken and should not be relied on.
As far as using nock with elasticsearch.js, I would suggest mocking out elasticsearch at a higher level. By using nock, you are testing all of the client code, which is unnecessary and error prone.
When I’m using elasticsearch.js in a project, I usually mock it out in my tests like this:
Docs for sinon stubs can be found here