Skip to content

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

Description

@calvinalvin

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);
}

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions