ncb000gt / node-es

NodeJS module for ElasticSearch.
103 stars 81 forks source link

getaddrinfo ENOTFOUND #41

Closed frontend-3 closed 10 years ago

frontend-3 commented 10 years ago

I cant create a new index .. show this error getaddrinfo ENOTFOUND

var options = { server: { hosts:settings.ES_URI } };

var conn; conn = elasticsearch(options);

conn.indices.createIndex({_index:settings.ES_INDEX},{},function (err, data){ if(err){ console.log('Cannot create index') console.log(err.stack); console.log(data); } else { console.log('Created index') } });

gsf commented 10 years ago

Your ES_URI is incorrect. The hosts in it should include only the domain and the port.

frontend-3 commented 10 years ago

I dont think so , check this

var settings = { STATIC_URL: '/static/', DATABASE_CON: { host : '127.0.0.1', username : 'root', protocol : 'mysql', port : '3306', logging : false, password : '', database : 'search_movie' }, ITEMS_PER_PAGE : 5, MOVIE_DOCUMENT_TYPE : 'movie', ES_INDEX : 'search_movie', ES_PORT : 9200, ES_HOST : '127.0.0.1' } module.exports = settings;

frontend-3 commented 10 years ago

When i was test with 'host' and 'port' can connect.

var options = { server: { host: settings.ES_HOST, port: settings.ES_PORT }, _index:settings.ES_INDEX, _type:'movie' };

ncb000gt commented 10 years ago

@emanrique is ES_URI an array? You didn't show it in your settings example above.

frontend-3 commented 10 years ago

Yep. Sorry i forgot.

brozeph commented 10 years ago

Hi @emanrique, when you are using a cluster of ElasticSearch machines, you can use the hosts property in the server object within the options:

var options = {
  server : {
    hosts : ['host1.com:9200', 'host2.com:9200', 'host3.com:9200']
  }
}

If you have 1 ES server, use the host (not plural) property of the server object within the options:

var options = {
  server : {
    host : '127.0.0.1:9200'
  }
}
frontend-3 commented 10 years ago

Oh thanks, thats make sense, so for 1 host i cannt use 'hosts'?

ncb000gt commented 10 years ago

You can so long as its in an array iirc. On Dec 10, 2013 3:30 PM, "Elizabeth Manrique" notifications@github.com wrote:

Oh thanks, thats make sense, so for 1 host i cannt use 'hosts'?

— Reply to this email directly or view it on GitHubhttps://github.com/ncb000gt/node-es/issues/41#issuecomment-30264775 .

ncb000gt commented 10 years ago

I'm assuming this is resolved now so I'm going to close the task. If it isn't then please update with the current status.