Closed frontend-3 closed 10 years ago
Your ES_URI is incorrect. The hosts in it should include only the domain and the port.
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;
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' };
@emanrique is ES_URI an array? You didn't show it in your settings example above.
Yep. Sorry i forgot.
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'
}
}
Oh thanks, thats make sense, so for 1 host i cannt use 'hosts'?
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 .
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.
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') } });