Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,58 @@ Client.prototype = {
});
},

/**
Close index.

[ElasticSearch docs](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html)

@method close
@param {String} [names] Index name to close. If
not specified, all indices will be closed.
@param {Function} [callback] Callback function.
@param {Error|null} callback.err Error, or `null` on success.
@param {Object} callback.res ElasticSearch response data.
**/
close: function (name, callback) {
name = name || '_all';
var url = '/' + name;
url += '/_close/'
this._request(url, {
method: 'POST'
}, function (err, res) {
if (err) {
return callback(err, null, res), undefined;
}
callback(null, res);
});
},

/**
Open index.

[ElasticSearch docs](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html)

@method open
@param {String} [names] Index name to open. If
not specified, all indices will be opened.
@param {Function} [callback] Callback function.
@param {Error|null} callback.err Error, or `null` on success.
@param {Object} callback.res ElasticSearch response data.
**/
open: function (name, callback) {
name = name || '_all';
var url = '/' + name;
url += '/_open/'
this._request(url, {
method: 'POST'
}, function (err, res) {
if (err) {
return callback(err, null, res), undefined;
}
callback(null, res);
});
},

// TODO: percolate, delete by query, more like this
/**
Registers a percolator for the given index or modifies the existing percolator
Expand Down