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!
Is it fair to assume this in reference to the same issue reported in #49? If not, please update the description of the issue.
Are you certain that elasticsearch is running on port 9200? I'm pretty sure that ECONNREFUSED means nothing is listening for requests at that port.
Below is the output of me trying to reach an es node running on port 9200. (note that curl reports "Connection refused" when I curl port 9201)
~/dev $ curl localhost:9201
curl: (7) Failed connect to localhost:9201; Connection refused
~/dev $ curl localhost:9200
{
"status" : 200,
"name" : "Tabitha Smith",
"version" : {
"number" : "2.0.0",
"build_hash" : "7d3f49c43b23a0a4db2feafe20a0e28baf39f164",
"build_timestamp" : "2014-03-18T15:22:16Z",
"build_snapshot" : true,
"lucene_version" : "4.7"
},
"tagline" : "You Know, for Search"
}
I did what was given in #49 ,but it did not work .This is stopped working recently.
I may be having the same error. I'm using version 2.1.4... on IE9 only it seems to my cluster with the console reporting "No living connections". Not sure if a new ticket is needed for this.
Getting this error as well:
Elasticsearch ERROR: 2014-05-16T22:13:54Z
Error: Request error, retrying -- connect ENOENT
at Log.error (.../node_modules/elasticsearch/src/lib/log.js:213:60)
at checkRespForFailure (.../node_modules/elasticsearch/src/lib/transport.js:187:18)
at HttpConnector.<anonymous> (.../node_modules/elasticsearch/src/lib/connectors/http.js:145:7)
at ClientRequest.bound (.../node_modules/elasticsearch/node_modules/lodash-node/modern/internals/baseBind.js:56:17)
at ClientRequest.EventEmitter.emit (events.js:107:17)
at Socket.socketErrorListener (_http_client.js:267:9)
at Socket.EventEmitter.emit (events.js:107:17)
at net.js:436:14
at process._tickCallback (node.js:343:11)
Elasticsearch WARNING: 2014-05-16T22:13:54Z
Unable to revive connection: http://localhost:9200/
Elasticsearch WARNING: 2014-05-16T22:13:54Z
No living connections
Possibly unhandled Error: No Living connections
at sendReqWithConnection (.../node_modules/elasticsearch/src/lib/transport.js:172:15)
at next (...node_modules/elasticsearch/src/lib/connection_pool.js:213:7)
at process._tickCallback (node.js:343:11)
Elasticsearch WARNING: 2014-05-16T22:13:54Z
Unable to revive connection: http://localhost:9200/
$ npm list | grep elastic
├─┬ [email protected]
$ curl http://localhost:9200/
{
"status" : 200,
"name" : "Dr. John Grey",
"version" : {
"number" : "1.1.1",
"build_hash" : "f1585f096d3f3985e73456debdc1a0745f512bbc",
"build_timestamp" : "2014-04-16T14:27:12Z",
"build_snapshot" : false,
"lucene_version" : "4.7"
},
"tagline" : "You Know, for Search"
}
$ node -v
v0.11.13
@JonDum thank you for all the info!
Unfortunately, we aren't supporting node v0.11 as it is unstable. Are you able to run 0.10 and see if it works?
Too bad, ElasticSearch would be playing nice with Koa.js, but Koa only runs under 0.11.x.
What exactly is incompatible with node v0.11 ?
@Gijsjan what is your alternative? I'm hitting walls everywhere...
I'm still having some major issues with this, has anyone figured out whats going wrong with this?
@faiqyou I'll take a look tomorrow and try to narrow down what is incompatible. 0.11 is probably stable enough now.
@spenceralger - were you able to get a chance to figure out whats up with the module? Thanks a lot btw.
@faiqyou I believe so. If you want to try out the updated version you can install master:
npm install elasticsearch/elasticsearch-js#master
What should I put in for my package.json
EDIT: Besides that, Im still having trouble here faking the ES calls with nock
nock('http://localhost:9200')
.post('/_search?fields=name%2Ckeywords%2Cdescription%2Cauthor%2Cversion%2Cstars%2CdlScore%2CdlDay%2CdlWeek', {"from":null,"size":null,"query":{"dis_max":{"tie_breaker":0.7,"boost":1.2,"queries":[{"function_score":{"query":{"match":{"name.untouched":"express"}},"boost_factor":100}},{"bool":{"should":[{"match_phrase":{"name":"express"}},{"match_phrase":{"keywords":"express"}},{"match_phrase":{"description":"express"}},{"match_phrase":{"readme":"express"}}],"minimum_should_match":1,"boost":50}},{"function_score":{"query":{"multi_match":{"query":"express","fields":["name^4","keywords","description","readme"]}},"functions":[{"script_score":{"script":"(doc['dlScore'].isEmpty() ? 0 : doc['dlScore'].value)"}},{"script_score":{"script":"doc['stars'].isEmpty() ? 0 : doc['stars'].value"}}],"score_mode":"sum","boost_mode":"multiply"}}]}}})
.reply(200, {"took":88,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":121,"max_score":93.445816,"hits":[{"_index":"npm","_type":"package","_id":"express","_score":93.445816,"fields":{"dlWeek":[301386],"author":["dougwilson"],"keywords":["express","framework","sinatra","web","rest","restful","router","app","api"],"dlScore":[1.0378859753189307],"dlDay":[27050],"description":["Fast, unopinionated, minimalist web framework"],"stars":[418],"name":["express"],"version":["4.5.1"]}},{"_index":"npm","_type":"package","_id":"express-err","_score":4.864109,"fields":{"dlWeek":[45],"author":["neoziro"],"keywords":["express","middleware","error","handler"],"dlScore":[0.7692307692307693],"dlDay":[5],"description":["Basic error handler for express."],"stars":[0],"name":["express-err"],"version":["0.1.1"]}},{"_index":"npm","_type":"package","_id":"express-jsonstream","_score":4.176355,"fields":{"dlWeek":[26],"author":["smurthas"],"keywords":["express","json","streaming"],"dlScore":[2.122448979591837],"dlDay":[3],"description":["Simple middleware for JSON streaming in Express"],"stars":[0],"name":["express-jsonstream"],"version":["0.0.3"]}},{"_index":"npm","_type":"package","_id":"express-ie-cors","_score":3.7706547,"fields":{"dlWeek":[147],"author":["hsinhsiao"],"keywords":["connect","express","middleware","cors","IE"],"dlScore":[1.225],"dlDay":[30],"description":["express middleware to add cors support to IE 8-9"],"stars":[0],"name":["express-ie-cors"],"version":["0.9.4"]}},{"_index":"npm","_type":"package","_id":"express-treerouter","_score":2.1263077,"fields":{"dlWeek":[14],"author":["whoami"],"keywords":["treeRouter","router","express"],"dlScore":[1.75],"dlDay":[6],"description":["Easy way for using tree routes in Express.js"],"stars":[0],"name":["express-treerouter"],"version":["0.3.0"]}},{"_index":"npm","_type":"package","_id":"csrf-express","_score":1.678339,"fields":{"dlWeek":[14],"author":["alfredwesterveld"],"dlScore":[3.111111111111111],"dlDay":[3],"description":["CSRF protection for express"],"stars":[0],"name":["csrf-express"],"version":["0.0.1"]}},{"_index":"npm","_type":"package","_id":"show-express","_score":1.036386,"fields":{"dlWeek":[14],"author":["brighthas"],"dlScore":[2.8],"dlDay":[2],"description":["Depending on the browser to return to a different view."],"stars":[0],"name":["show-express"],"version":["0.1.1"]}},{"_index":"npm","_type":"package","_id":"express-asset-manager","_score":0.88168526,"fields":{"dlWeek":[22],"author":["tug"],"dlScore":[1.4666666666666666],"dlDay":[9],"description":["Simple asset manager middleware for Express.js"],"stars":[0],"name":["express-asset-manager"],"version":["0.2.2"]}},{"_index":"npm","_type":"package","_id":"express-skanetrafiken","_score":0.8796353,"fields":{"dlWeek":[3],"author":["heni"],"keywords":["skanetrafiken"],"dlScore":[1.3333333333333333],"stars":[0],"description":["Skanetrafikens API for Expressjs."],"version":["0.0.2"],"name":["express-skanetrafiken"]}},{"_index":"npm","_type":"package","_id":"express-session-mongo","_score":0.6880412,"fields":{"dlWeek":[10],"author":["davglass"],"dlScore":[0.7547169811320755],"dlDay":[5],"description":["MongoDB Session Store for ExpressJS"],"stars":[0],"name":["express-session-mongo"],"version":["0.0.4"]}}]}}, { 'content-type': 'application/json; charset=UTF-8',
'content-length': '3283' });
Thats what Im getting from the nock recorder. Im not sure what else I should be doing
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:
var client = require('../../elasticsearch-client');
var stub = require('sinon').stub;
describe('Some Module that uses elasticsearch', function () {
beforeEach(function () {
// stub the search method to return generic results
stub(client, 'search', function (params, cb) {
process.nextTick(function () {
cb(null, {
hits: { total: 121, hits: [ /* ... fake results ... */ ] }
});
});
});
});
afterEach(function () {
client.search.restore();
});
});
Docs for sinon stubs can be found here
Looks good to me! Thanks so much for all your help :D
äh... If I should write integration tests, how can I mock Elastic search?
sinon stubs are only for unit tests
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 through localhost:9200.
Just had to change the elastic search's ip in my JS code directly to docker-machine's ip which you can get using echo $(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 am using the plastic search https://github.com/sleimanx2/plastic However while running I am getting an error like as follow
[2016-08-09 10:00:22] log.WARNING: Curl exception encountered. [] []
[2016-08-09 10:00:22] log.WARNING: Request Failure: {"method":"GET","uri":"http://127.0.0.1:9200/plastic/books/_search","headers":{"host":["127.0.0.1:9200"]},"HTTP code":null,"duration":0.202,"error":"cURL error 7: Failed to connect to 127.0.0.1 port 9200: Connection refused"} []
[2016-08-09 10:00:22] log.WARNING: Response [null] []
[2016-08-09 10:00:22] log.WARNING: Marking node 127.0.0.1:9200 dead. [] []
[2016-08-09 10:00:22] log.WARNING: Retries left? true [] []
[2016-08-09 10:00:22] log.CRITICAL: No alive nodes found in cluster [] []
Please suggest me any way to resolve this....Thanks in advance
@MajidD4t1qbit where did you put the echo $(docker-machine ip)line? in your app?
Please help coming below error during elk setup in docker-compose kibana | {"type":"log","@timestamp":"2019-08-11T23:19:38Z","tags":["status","plugin:[email protected]","info"],"pid":1,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana | {"type":"log","@timestamp":"2019-08-11T23:19:39Z","tags":["error","elasticsearch","admin"],"pid":1,"message":"Request error, retrying\nGET http://elasticsearch:9200/_nodes?filter_path=nodes..version%2Cnodes..http.publish_address%2Cnodes.*.ip => connect ECONNREFUSED 172.20.0.2:9200"}
kibana | {"type":"log","@timestamp":"2019-08-11T23:19:39Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana | {"type":"log","@timestamp":"2019-08-11T23:19:39Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
kibana | {"type":"log","@timestamp":"2019-08-11T23:19:39Z","tags":["status","plugin:[email protected]","error"],"pid":1,"state":"red","message":"Status changed from
Most helpful comment
On OSX with ElasticSearch server running in a docker container, I was getting the
ECONNREFUSEDerror. 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"