Skip to content

elasticsearch hotfix

MikeKlemarewski edited this page Jul 19, 2012 · 1 revision

Essentially, the indexes aren't getting refreshed fast enough, so each test runs too quickly after the database gets created. Here's the quick fix until Izaak updates his module:

In com.izaakschroeder.elasticsearch/elasticsearch.js Change the moethod on line 382 to:

Document.prototype.set = function(data, callback) {
	var self = this;
	if (this.id) {
		this.connection.put(this.path()+"?refresh=true", data, callback);
	}
	else {
		this.connection.post(this.path(true)+"?refresh=true", data, function(err, response, result) {
			if (err)
				return callback(err)
			self.id = result._id;
			callback(result);
		});
	}
	return this;	
}
Clone this wiki locally