Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the event that an array of hosts is passed in, the other options get over-written in ElasticSearch.prototype.createCall #111

Open
calvinalvin opened this issue Oct 3, 2013 · 0 comments

Comments

@calvinalvin
Copy link

The block of code that round-robins the hosts will cause other properties that are part of the options argument to get over-written. (For instance, auth, and secure settings)

The line:
if (options.hosts) {
var nextHost = options.hosts.shift();
options.hosts.push(nextHost);
}

assumes that the options object only contains a hosts property.

ElasticSearchClient.prototype.createCall = function(params, options, cb) {
//If options.hosts round robin the hosts
if (options.hosts) {
var nextHost = options.hosts.shift();
options.hosts.push(nextHost);
}else{
nextHost=options;
}
if(typeof cb=='function'){
var call = new ElasticSearchCall(params, nextHost, cb);
call.exec();
}else{
return new ElasticSearchCall(params, nextHost);
}

}

brianstarke added a commit that referenced this issue Dec 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant