From e4c6aab4effa4856f09b3182f8993400986692da Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Fri, 17 Jan 2014 09:02:00 -0700 Subject: [PATCH] updated the API --- docs/api_methods.asciidoc | 619 +++++----- package.json | 2 +- scripts/generate/aliases.js | 12 +- scripts/generate/templates/api_methods.tmpl | 2 +- src/elasticsearch | 2 +- src/lib/api.js | 1144 +++++++++---------- 6 files changed, 874 insertions(+), 907 deletions(-) diff --git a/docs/api_methods.asciidoc b/docs/api_methods.asciidoc index d382589d0..225b97618 100644 --- a/docs/api_methods.asciidoc +++ b/docs/api_methods.asciidoc @@ -409,131 +409,6 @@ The default method is `DELETE` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`timeout`:: -`Date, Number` -- Explicit operation timeout -`repository`:: -`String` -- A repository name - -[[api-cluster-createsnapshot]] -=== `cluster.createSnapshot` - -[source,js] --------- -client.cluster.createSnapshot([params, [callback]]) --------- - -// no description - -The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`waitForCompletion`:: -`Boolean` -- Should this request wait until the operation has completed before returning -`repository`:: -`String` -- A repository name -`snapshot`:: -`String` -- A snapshot name - -[[api-cluster-deleterepository]] -=== `cluster.deleteRepository` - -[source,js] --------- -client.cluster.deleteRepository([params, [callback]]) --------- - -// no description - -The default method is `DELETE` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`timeout`:: -`Date, Number` -- Explicit operation timeout -`repository`:: -`String, String[], Boolean` -- A comma-separated list of repository names - -[[api-cluster-deletesnapshot]] -=== `cluster.deleteSnapshot` - -[source,js] --------- -client.cluster.deleteSnapshot([params, [callback]]) --------- - -// no description - -The default method is `DELETE` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`repository`:: -`String` -- A repository name -`snapshot`:: -`String` -- A snapshot name - -[[api-cluster-getrepository]] -=== `cluster.getRepository` - -[source,js] --------- -client.cluster.getRepository([params, [callback]]) --------- - -// no description - -The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`repository`:: -`String, String[], Boolean` -- A comma-separated list of repository names - [[api-cluster-getsettings]] === `cluster.getSettings` @@ -559,31 +434,6 @@ The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`repository`:: -`String, String[], Boolean` -- A comma-separated list of repository names -`snapshot`:: -`String, String[], Boolean` -- A comma-separated list of snapshot names - [[api-cluster-health]] === `cluster.health` @@ -621,147 +471,6 @@ The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html[the elasticsearch docs] for more about this method. - -.Return 10 hottest threads -[source,js] ---------- -client.cluster.nodeHotThreads({ - threads: 10 - nodeId: 'mymisbehavingnode', - maxRetries: 10 -}, function (error, response) { - console.log(response); -}) ---------- - - -==== Params - -[horizontal] -`interval`:: -`Date, Number` -- The interval for the second sampling of threads -`snapshots`:: -`Number` -- Number of samples of thread stacktrace (default: 10) -`threads`:: -`Number` -- Specify the number of threads to provide information for (default: 3) -`type`:: -`String` -- The type to sample (default: cpu) -`nodeId`:: -`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - -[[api-cluster-nodeinfo]] -=== `cluster.nodeInfo` - -[source,js] --------- -client.cluster.nodeInfo([params, [callback]]) --------- - -Retrieve one or more (or all) of the cluster nodes' information. - -The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html[the elasticsearch docs] for more about this method. - -.Return information about JVM -[source,js] ---------- -client.cluster.nodeInfo({ jvm: true }) - .then(function (response) { - // enjoy your sweet info! - }, function (error) { - // scream! - }) ---------- - - -==== Params - -[horizontal] -`flatSettings`:: -`Boolean` -- Return settings in flat format (default: false) -`human`:: -`Boolean` -- Whether to return time and byte values in human-readable format. -`nodeId`:: -`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes -`metric`:: -`String, String[], Boolean` -- A comma-separated list of metrics you wish returned. Leave empty to return all. - -[[api-cluster-nodeshutdown]] -=== `cluster.nodeShutdown` - -[source,js] --------- -client.cluster.nodeShutdown([params, [callback]]) --------- - -Shutdown one or more (or all) nodes in the cluster. - -The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`delay`:: -`Date, Number` -- Set the delay for the operation (default: 1s) -`exit`:: -`Boolean` -- Exit the JVM as well (default: true) -`nodeId`:: -`String, String[], Boolean` -- A comma-separated list of node IDs or names to perform the operation on; use `_local` to perform the operation on the node you're connected to, leave empty to perform the operation on all nodes - -[[api-cluster-nodestats]] -=== `cluster.nodeStats` - -[source,js] --------- -client.cluster.nodeStats([params, [callback]]) --------- - -Retrieve one or more (or all) of the cluster nodes statistics. - -The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`completionFields`:: -`String, String[], Boolean` -- A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) -`fielddataFields`:: -`String, String[], Boolean` -- A comma-separated list of fields for `fielddata` index metric (supports wildcards) -`fields`:: -`String, String[], Boolean` -- A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) -`groups`:: -`Boolean` -- A comma-separated list of search groups for `search` index metric -`human`:: -`Boolean` -- Whether to return time and byte values in human-readable format. -`[level=node]`:: -`String` -- Return indices stats aggregated at node, index or shard level -`types`:: -`String, String[], Boolean` -- A comma-separated list of document types for the `indexing` index metric -`metric`:: -`String, String[], Boolean` -- Limit the information returned to the specified metrics -`indexMetric`:: -`String, String[], Boolean` -- Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. -`nodeId`:: -`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - [[api-cluster-putsettings]] === `cluster.putSettings` @@ -810,33 +519,6 @@ The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. - -// no examples - - -==== Params - -[horizontal] -`masterTimeout`:: -`Date, Number` -- Explicit operation timeout for connection to master node -`waitForCompletion`:: -`Boolean` -- Should this request wait until the operation has completed before returning -`repository`:: -`String` -- A repository name -`snapshot`:: -`String` -- A snapshot name - [[api-cluster-state]] === `cluster.state` @@ -1374,10 +1056,6 @@ The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`interval`:: +`Date, Number` -- The interval for the second sampling of threads +`snapshots`:: +`Number` -- Number of samples of thread stacktrace (default: 10) +`threads`:: +`Number` -- Specify the number of threads to provide information for (default: 3) +`type`:: +`String` -- The type to sample (default: cpu) +`nodeId`:: +`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + +[[api-nodes-info]] +=== `nodes.info` + +[source,js] +-------- +client.nodes.info([params, [callback]]) +-------- + +// no description + +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`flatSettings`:: +`Boolean` -- Return settings in flat format (default: false) +`human`:: +`Boolean` -- Whether to return time and byte values in human-readable format. +`nodeId`:: +`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +`metric`:: +`String, String[], Boolean` -- A comma-separated list of metrics you wish returned. Leave empty to return all. + +[[api-nodes-shutdown]] +=== `nodes.shutdown` + +[source,js] +-------- +client.nodes.shutdown([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`delay`:: +`Date, Number` -- Set the delay for the operation (default: 1s) +`exit`:: +`Boolean` -- Exit the JVM as well (default: true) +`nodeId`:: +`String, String[], Boolean` -- A comma-separated list of node IDs or names to perform the operation on; use `_local` to perform the operation on the node you're connected to, leave empty to perform the operation on all nodes + +[[api-nodes-stats]] +=== `nodes.stats` + +[source,js] +-------- +client.nodes.stats([params, [callback]]) +-------- + +// no description + +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`completionFields`:: +`String, String[], Boolean` -- A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) +`fielddataFields`:: +`String, String[], Boolean` -- A comma-separated list of fields for `fielddata` index metric (supports wildcards) +`fields`:: +`String, String[], Boolean` -- A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) +`groups`:: +`Boolean` -- A comma-separated list of search groups for `search` index metric +`human`:: +`Boolean` -- Whether to return time and byte values in human-readable format. +`[level=node]`:: +`String` -- Return indices stats aggregated at node, index or shard level +`types`:: +`String, String[], Boolean` -- A comma-separated list of document types for the `indexing` index metric +`metric`:: +`String, String[], Boolean` -- Limit the information returned to the specified metrics +`indexMetric`:: +`String, String[], Boolean` -- Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. +`nodeId`:: +`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + [[api-percolate]] === `percolate` @@ -3001,6 +2799,183 @@ client.search({ `type`:: `String, String[], Boolean` -- A comma-separated list of document types to search; leave empty to perform the operation on all types +[[api-snapshot-create]] +=== `snapshot.create` + +[source,js] +-------- +client.snapshot.create([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`waitForCompletion`:: +`Boolean` -- Should this request wait until the operation has completed before returning +`repository`:: +`String` -- A repository name +`snapshot`:: +`String` -- A snapshot name + +[[api-snapshot-createrepository]] +=== `snapshot.createRepository` + +[source,js] +-------- +client.snapshot.createRepository([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`timeout`:: +`Date, Number` -- Explicit operation timeout +`repository`:: +`String` -- A repository name + +[[api-snapshot-delete]] +=== `snapshot.delete` + +[source,js] +-------- +client.snapshot.delete([params, [callback]]) +-------- + +// no description + +The default method is `DELETE` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`repository`:: +`String` -- A repository name +`snapshot`:: +`String` -- A snapshot name + +[[api-snapshot-deleterepository]] +=== `snapshot.deleteRepository` + +[source,js] +-------- +client.snapshot.deleteRepository([params, [callback]]) +-------- + +// no description + +The default method is `DELETE` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`timeout`:: +`Date, Number` -- Explicit operation timeout +`repository`:: +`String, String[], Boolean` -- A comma-separated list of repository names + +[[api-snapshot-get]] +=== `snapshot.get` + +[source,js] +-------- +client.snapshot.get([params, [callback]]) +-------- + +// no description + +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`repository`:: +`String, String[], Boolean` -- A comma-separated list of repository names +`snapshot`:: +`String, String[], Boolean` -- A comma-separated list of snapshot names + +[[api-snapshot-getrepository]] +=== `snapshot.getRepository` + +[source,js] +-------- +client.snapshot.getRepository([params, [callback]]) +-------- + +// no description + +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`repository`:: +`String, String[], Boolean` -- A comma-separated list of repository names + +[[api-snapshot-restore]] +=== `snapshot.restore` + +[source,js] +-------- +client.snapshot.restore([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`masterTimeout`:: +`Date, Number` -- Explicit operation timeout for connection to master node +`waitForCompletion`:: +`Boolean` -- Should this request wait until the operation has completed before returning +`repository`:: +`String` -- A repository name +`snapshot`:: +`String` -- A snapshot name + [[api-suggest]] === `suggest` diff --git a/package.json b/package.json index 3caddbf20..5fd302ad5 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "grunt-open": "~0.2.2", "glob": "~3.2.7", "expect.js": "~0.2.0", - "aliasify": "1.2.2", + "aliasify": "~1.2.4", "express": "~3.4.7", "grunt-saucelabs": "git://github.com/axemclion/grunt-saucelabs.git#01b68705a6823ff86930f28296ac6467fbea244b" }, diff --git a/scripts/generate/aliases.js b/scripts/generate/aliases.js index 0ed0e7a96..45fb20145 100644 --- a/scripts/generate/aliases.js +++ b/scripts/generate/aliases.js @@ -1,5 +1,5 @@ module.exports = { - 'cluster.nodeHotThreads': [ + 'nodes.hotThreads': [ '/_cluster/nodes/hotthreads', '/_cluster/nodes/hot_threads', '/_nodes/hot_threads', @@ -7,7 +7,7 @@ module.exports = { '/_cluster/nodes/{node_id}/hot_threads', '/_nodes/{node_id}/hot_threads' ], - 'cluster.nodeInfo': [ + 'nodes.info': [ '/_cluster/nodes', '/_nodes/settings', '/_nodes/os', @@ -29,10 +29,10 @@ module.exports = { '/_nodes/{node_id}/http', '/_nodes/{node_id}/plugin' ], - 'cluster.nodeShutdown': [ + 'nodes.shutdown': [ '/_cluster/nodes/_shutdown' ], - 'cluster.nodeStats': [ + 'nodes.stats': [ '/_cluster/nodes/stats', '/_nodes/stats/{metric_family}', '/_nodes/stats/indices/{metric}/{fields}', @@ -94,5 +94,9 @@ module.exports = { ], 'cluster.createSnapshot': [ '/_snapshot/{repository}/{snapshot}/_create' + ], + 'snapshot.create': [ + '/_snapshot/{repository}/{snapshot}', + '/_snapshot/{repository}/{snapshot}/_create' ] }; \ No newline at end of file diff --git a/scripts/generate/templates/api_methods.tmpl b/scripts/generate/templates/api_methods.tmpl index 680d2a7a8..f857b603e 100644 --- a/scripts/generate/templates/api_methods.tmpl +++ b/scripts/generate/templates/api_methods.tmpl @@ -1,5 +1,5 @@ [[api-reference<%= branchSuffix %>]] -== <%= branch === 'master' ? '' : branch + ' ' %>API Method Reference +== <%= branch === 'master' ? '' : branch + ' ' %>API <% _.each(actions, function (action) { %> diff --git a/src/elasticsearch b/src/elasticsearch index 612044b38..3ac2f8c78 160000 --- a/src/elasticsearch +++ b/src/elasticsearch @@ -1 +1 @@ -Subproject commit 612044b3863451421acd8de717d0d083bae65670 +Subproject commit 3ac2f8c789550531fd5ab87b09647631af91b0f1 diff --git a/src/lib/api.js b/src/lib/api.js index c5856cb02..63d981f43 100644 --- a/src/lib/api.js +++ b/src/lib/api.js @@ -3,7 +3,7 @@ var ca = require('./client_action'); var api = module.exports = {}; -api._namespaces = ['cat', 'cluster', 'indices']; +api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot']; /** * Perform a [bulk](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html) request @@ -587,161 +587,6 @@ api.cluster = function ClusterNS(transport) { this.transport = transport; }; -/** - * Perform a [cluster.createRepository](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {Date, Number} params.timeout - Explicit operation timeout - * @param {String} params.repository - A repository name - */ -api.cluster.prototype.createRepository = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - }, - timeout: { - type: 'time' - } - }, - url: { - fmt: '/_snapshot/<%=repository%>', - req: { - repository: { - type: 'string' - } - }, - sortOrder: -1 - }, - method: 'POST' -}); - -/** - * Perform a [cluster.createSnapshot](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {Boolean} params.waitForCompletion - Should this request wait until the operation has completed before returning - * @param {String} params.repository - A repository name - * @param {String} params.snapshot - A snapshot name - */ -api.cluster.prototype.createSnapshot = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - }, - waitForCompletion: { - type: 'boolean', - 'default': false, - name: 'wait_for_completion' - } - }, - url: { - fmt: '/_snapshot/<%=repository%>/<%=snapshot%>', - req: { - repository: { - type: 'string' - }, - snapshot: { - type: 'string' - } - }, - sortOrder: -2 - }, - method: 'POST' -}); - -/** - * Perform a [cluster.deleteRepository](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {Date, Number} params.timeout - Explicit operation timeout - * @param {String, String[], Boolean} params.repository - A comma-separated list of repository names - */ -api.cluster.prototype.deleteRepository = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - }, - timeout: { - type: 'time' - } - }, - url: { - fmt: '/_snapshot/<%=repository%>', - req: { - repository: { - type: 'list' - } - }, - sortOrder: -1 - }, - method: 'DELETE' -}); - -/** - * Perform a [cluster.deleteSnapshot](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {String} params.repository - A repository name - * @param {String} params.snapshot - A snapshot name - */ -api.cluster.prototype.deleteSnapshot = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - } - }, - url: { - fmt: '/_snapshot/<%=repository%>/<%=snapshot%>', - req: { - repository: { - type: 'string' - }, - snapshot: { - type: 'string' - } - }, - sortOrder: -2 - }, - method: 'DELETE' -}); - -/** - * Perform a [cluster.getRepository](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {String, String[], Boolean} params.repository - A comma-separated list of repository names - */ -api.cluster.prototype.getRepository = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - } - }, - urls: [ - { - fmt: '/_snapshot/<%=repository%>', - req: { - repository: { - type: 'list' - } - } - }, - { - fmt: '/_snapshot' - } - ] -}); - /** * Perform a [cluster.getSettings](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-update-settings.html) request * @@ -769,35 +614,6 @@ api.cluster.prototype.getSettings = ca({ } }); -/** - * Perform a [cluster.getSnapshot](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {String, String[], Boolean} params.repository - A comma-separated list of repository names - * @param {String, String[], Boolean} params.snapshot - A comma-separated list of snapshot names - */ -api.cluster.prototype.getSnapshot = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - } - }, - url: { - fmt: '/_snapshot/<%=repository%>/<%=snapshot%>', - req: { - repository: { - type: 'list' - }, - snapshot: { - type: 'list' - } - }, - sortOrder: -2 - } -}); - /** * Perform a [cluster.health](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-health.html) request * @@ -871,355 +687,6 @@ api.cluster.prototype.health = ca({ ] }); -/** - * Perform a [cluster.nodeHotThreads](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.interval - The interval for the second sampling of threads - * @param {Number} params.snapshots - Number of samples of thread stacktrace (default: 10) - * @param {Number} params.threads - Specify the number of threads to provide information for (default: 3) - * @param {String} params.type - The type to sample (default: cpu) - * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - */ -api.cluster.prototype.nodeHotThreads = ca({ - params: { - interval: { - type: 'time' - }, - snapshots: { - type: 'number' - }, - threads: { - type: 'number' - }, - type: { - type: 'enum', - options: [ - 'cpu', - 'wait', - 'block' - ] - } - }, - urls: [ - { - fmt: '/_nodes/<%=nodeId%>/hotthreads', - req: { - nodeId: { - type: 'list' - } - } - }, - { - fmt: '/_nodes/hotthreads' - } - ] -}); - -/** - * Perform a [cluster.nodeInfo](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Boolean} params.flatSettings - Return settings in flat format (default: false) - * @param {Boolean} params.human - Whether to return time and byte values in human-readable format. - * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * @param {String, String[], Boolean} params.metric - A comma-separated list of metrics you wish returned. Leave empty to return all. - */ -api.cluster.prototype.nodeInfo = ca({ - params: { - flatSettings: { - type: 'boolean', - name: 'flat_settings' - }, - human: { - type: 'boolean', - 'default': false - } - }, - urls: [ - { - fmt: '/_nodes/<%=nodeId%>/<%=metric%>', - req: { - nodeId: { - type: 'list' - }, - metric: { - type: 'list', - options: [ - 'settings', - 'os', - 'process', - 'jvm', - 'thread_pool', - 'network', - 'transport', - 'http', - 'plugin' - ] - } - } - }, - { - fmt: '/_nodes/<%=nodeId%>', - req: { - nodeId: { - type: 'list' - } - } - }, - { - fmt: '/_nodes/<%=metric%>', - req: { - metric: { - type: 'list', - options: [ - 'settings', - 'os', - 'process', - 'jvm', - 'thread_pool', - 'network', - 'transport', - 'http', - 'plugin' - ] - } - } - }, - { - fmt: '/_nodes' - } - ] -}); - -/** - * Perform a [cluster.nodeShutdown](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.delay - Set the delay for the operation (default: 1s) - * @param {Boolean} params.exit - Exit the JVM as well (default: true) - * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to perform the operation on; use `_local` to perform the operation on the node you're connected to, leave empty to perform the operation on all nodes - */ -api.cluster.prototype.nodeShutdown = ca({ - params: { - delay: { - type: 'time' - }, - exit: { - type: 'boolean' - } - }, - urls: [ - { - fmt: '/_cluster/nodes/<%=nodeId%>/_shutdown', - req: { - nodeId: { - type: 'list' - } - } - }, - { - fmt: '/_shutdown' - } - ], - method: 'POST' -}); - -/** - * Perform a [cluster.nodeStats](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {String, String[], Boolean} params.completionFields - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) - * @param {String, String[], Boolean} params.fielddataFields - A comma-separated list of fields for `fielddata` index metric (supports wildcards) - * @param {String, String[], Boolean} params.fields - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - * @param {Boolean} params.groups - A comma-separated list of search groups for `search` index metric - * @param {Boolean} params.human - Whether to return time and byte values in human-readable format. - * @param {String} [params.level=node] - Return indices stats aggregated at node, index or shard level - * @param {String, String[], Boolean} params.types - A comma-separated list of document types for the `indexing` index metric - * @param {String, String[], Boolean} params.metric - Limit the information returned to the specified metrics - * @param {String, String[], Boolean} params.indexMetric - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. - * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - */ -api.cluster.prototype.nodeStats = ca({ - params: { - completionFields: { - type: 'list', - name: 'completion_fields' - }, - fielddataFields: { - type: 'list', - name: 'fielddata_fields' - }, - fields: { - type: 'list' - }, - groups: { - type: 'boolean' - }, - human: { - type: 'boolean', - 'default': false - }, - level: { - type: 'enum', - 'default': 'node', - options: [ - 'node', - 'indices', - 'shards' - ] - }, - types: { - type: 'list' - } - }, - urls: [ - { - fmt: '/_nodes/<%=nodeId%>/stats/<%=metric%>/<%=indexMetric%>', - req: { - nodeId: { - type: 'list' - }, - metric: { - type: 'list', - options: [ - '_all', - 'breaker', - 'fs', - 'http', - 'indices', - 'jvm', - 'network', - 'os', - 'process', - 'thread_pool', - 'transport' - ] - }, - indexMetric: { - type: 'list', - options: [ - '_all', - 'completion', - 'docs', - 'fielddata', - 'filter_cache', - 'flush', - 'get', - 'id_cache', - 'indexing', - 'merge', - 'percolate', - 'refresh', - 'search', - 'segments', - 'store', - 'warmer' - ] - } - } - }, - { - fmt: '/_nodes/<%=nodeId%>/stats/<%=metric%>', - req: { - nodeId: { - type: 'list' - }, - metric: { - type: 'list', - options: [ - '_all', - 'breaker', - 'fs', - 'http', - 'indices', - 'jvm', - 'network', - 'os', - 'process', - 'thread_pool', - 'transport' - ] - } - } - }, - { - fmt: '/_nodes/stats/<%=metric%>/<%=indexMetric%>', - req: { - metric: { - type: 'list', - options: [ - '_all', - 'breaker', - 'fs', - 'http', - 'indices', - 'jvm', - 'network', - 'os', - 'process', - 'thread_pool', - 'transport' - ] - }, - indexMetric: { - type: 'list', - options: [ - '_all', - 'completion', - 'docs', - 'fielddata', - 'filter_cache', - 'flush', - 'get', - 'id_cache', - 'indexing', - 'merge', - 'percolate', - 'refresh', - 'search', - 'segments', - 'store', - 'warmer' - ] - } - } - }, - { - fmt: '/_nodes/<%=nodeId%>/stats', - req: { - nodeId: { - type: 'list' - } - } - }, - { - fmt: '/_nodes/stats/<%=metric%>', - req: { - metric: { - type: 'list', - options: [ - '_all', - 'breaker', - 'fs', - 'http', - 'indices', - 'jvm', - 'network', - 'os', - 'process', - 'thread_pool', - 'transport' - ] - } - } - }, - { - fmt: '/_nodes/stats' - } - ] -}); - /** * Perform a [cluster.tasks](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-pending.html) request * @@ -1283,42 +750,6 @@ api.cluster.prototype.reroute = ca({ method: 'POST' }); -/** - * Perform a [cluster.restoreSnapshot](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request - * - * @param {Object} params - An object with parameters used to carry out this action - * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node - * @param {Boolean} params.waitForCompletion - Should this request wait until the operation has completed before returning - * @param {String} params.repository - A repository name - * @param {String} params.snapshot - A snapshot name - */ -api.cluster.prototype.restoreSnapshot = ca({ - params: { - masterTimeout: { - type: 'time', - name: 'master_timeout' - }, - waitForCompletion: { - type: 'boolean', - 'default': false, - name: 'wait_for_completion' - } - }, - url: { - fmt: '/_snapshot/<%=repository%>/<%=snapshot%>/_restore', - req: { - repository: { - type: 'string' - }, - snapshot: { - type: 'string' - } - }, - sortOrder: -2 - }, - method: 'POST' -}); - /** * Perform a [cluster.state](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-state.html) request * @@ -1906,8 +1337,6 @@ api.get = ca({ * Perform a [getSource](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-get.html) request * * @param {Object} params - An object with parameters used to carry out this action - * @param {String, String[], Boolean} params.exclude - A list of fields to exclude from the returned _source field - * @param {String, String[], Boolean} params.include - A list of fields to extract and return from the _source field * @param {String} params.parent - The ID of the parent document * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) * @param {Boolean} params.realtime - Specify whether to perform the operation in realtime or search mode @@ -1924,12 +1353,6 @@ api.get = ca({ */ api.getSource = ca({ params: { - exclude: { - type: 'list' - }, - include: { - type: 'list' - }, parent: { type: 'string' }, @@ -4245,6 +3668,359 @@ api.msearch = ca({ method: 'POST' }); +api.nodes = function NodesNS(transport) { + this.transport = transport; +}; + +/** + * Perform a [nodes.hotThreads](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.interval - The interval for the second sampling of threads + * @param {Number} params.snapshots - Number of samples of thread stacktrace (default: 10) + * @param {Number} params.threads - Specify the number of threads to provide information for (default: 3) + * @param {String} params.type - The type to sample (default: cpu) + * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + */ +api.nodes.prototype.hotThreads = ca({ + params: { + interval: { + type: 'time' + }, + snapshots: { + type: 'number' + }, + threads: { + type: 'number' + }, + type: { + type: 'enum', + options: [ + 'cpu', + 'wait', + 'block' + ] + } + }, + urls: [ + { + fmt: '/_nodes/<%=nodeId%>/hotthreads', + req: { + nodeId: { + type: 'list' + } + } + }, + { + fmt: '/_nodes/hotthreads' + } + ] +}); + +/** + * Perform a [nodes.info](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Boolean} params.flatSettings - Return settings in flat format (default: false) + * @param {Boolean} params.human - Whether to return time and byte values in human-readable format. + * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {String, String[], Boolean} params.metric - A comma-separated list of metrics you wish returned. Leave empty to return all. + */ +api.nodes.prototype.info = ca({ + params: { + flatSettings: { + type: 'boolean', + name: 'flat_settings' + }, + human: { + type: 'boolean', + 'default': false + } + }, + urls: [ + { + fmt: '/_nodes/<%=nodeId%>/<%=metric%>', + req: { + nodeId: { + type: 'list' + }, + metric: { + type: 'list', + options: [ + 'settings', + 'os', + 'process', + 'jvm', + 'thread_pool', + 'network', + 'transport', + 'http', + 'plugin' + ] + } + } + }, + { + fmt: '/_nodes/<%=nodeId%>', + req: { + nodeId: { + type: 'list' + } + } + }, + { + fmt: '/_nodes/<%=metric%>', + req: { + metric: { + type: 'list', + options: [ + 'settings', + 'os', + 'process', + 'jvm', + 'thread_pool', + 'network', + 'transport', + 'http', + 'plugin' + ] + } + } + }, + { + fmt: '/_nodes' + } + ] +}); + +/** + * Perform a [nodes.shutdown](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.delay - Set the delay for the operation (default: 1s) + * @param {Boolean} params.exit - Exit the JVM as well (default: true) + * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to perform the operation on; use `_local` to perform the operation on the node you're connected to, leave empty to perform the operation on all nodes + */ +api.nodes.prototype.shutdown = ca({ + params: { + delay: { + type: 'time' + }, + exit: { + type: 'boolean' + } + }, + urls: [ + { + fmt: '/_cluster/nodes/<%=nodeId%>/_shutdown', + req: { + nodeId: { + type: 'list' + } + } + }, + { + fmt: '/_shutdown' + } + ], + method: 'POST' +}); + +/** + * Perform a [nodes.stats](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String, String[], Boolean} params.completionFields - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + * @param {String, String[], Boolean} params.fielddataFields - A comma-separated list of fields for `fielddata` index metric (supports wildcards) + * @param {String, String[], Boolean} params.fields - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) + * @param {Boolean} params.groups - A comma-separated list of search groups for `search` index metric + * @param {Boolean} params.human - Whether to return time and byte values in human-readable format. + * @param {String} [params.level=node] - Return indices stats aggregated at node, index or shard level + * @param {String, String[], Boolean} params.types - A comma-separated list of document types for the `indexing` index metric + * @param {String, String[], Boolean} params.metric - Limit the information returned to the specified metrics + * @param {String, String[], Boolean} params.indexMetric - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. + * @param {String, String[], Boolean} params.nodeId - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + */ +api.nodes.prototype.stats = ca({ + params: { + completionFields: { + type: 'list', + name: 'completion_fields' + }, + fielddataFields: { + type: 'list', + name: 'fielddata_fields' + }, + fields: { + type: 'list' + }, + groups: { + type: 'boolean' + }, + human: { + type: 'boolean', + 'default': false + }, + level: { + type: 'enum', + 'default': 'node', + options: [ + 'node', + 'indices', + 'shards' + ] + }, + types: { + type: 'list' + } + }, + urls: [ + { + fmt: '/_nodes/<%=nodeId%>/stats/<%=metric%>/<%=indexMetric%>', + req: { + nodeId: { + type: 'list' + }, + metric: { + type: 'list', + options: [ + '_all', + 'breaker', + 'fs', + 'http', + 'indices', + 'jvm', + 'network', + 'os', + 'process', + 'thread_pool', + 'transport' + ] + }, + indexMetric: { + type: 'list', + options: [ + '_all', + 'completion', + 'docs', + 'fielddata', + 'filter_cache', + 'flush', + 'get', + 'id_cache', + 'indexing', + 'merge', + 'percolate', + 'refresh', + 'search', + 'segments', + 'store', + 'warmer' + ] + } + } + }, + { + fmt: '/_nodes/<%=nodeId%>/stats/<%=metric%>', + req: { + nodeId: { + type: 'list' + }, + metric: { + type: 'list', + options: [ + '_all', + 'breaker', + 'fs', + 'http', + 'indices', + 'jvm', + 'network', + 'os', + 'process', + 'thread_pool', + 'transport' + ] + } + } + }, + { + fmt: '/_nodes/stats/<%=metric%>/<%=indexMetric%>', + req: { + metric: { + type: 'list', + options: [ + '_all', + 'breaker', + 'fs', + 'http', + 'indices', + 'jvm', + 'network', + 'os', + 'process', + 'thread_pool', + 'transport' + ] + }, + indexMetric: { + type: 'list', + options: [ + '_all', + 'completion', + 'docs', + 'fielddata', + 'filter_cache', + 'flush', + 'get', + 'id_cache', + 'indexing', + 'merge', + 'percolate', + 'refresh', + 'search', + 'segments', + 'store', + 'warmer' + ] + } + } + }, + { + fmt: '/_nodes/<%=nodeId%>/stats', + req: { + nodeId: { + type: 'list' + } + } + }, + { + fmt: '/_nodes/stats/<%=metric%>', + req: { + metric: { + type: 'list', + options: [ + '_all', + 'breaker', + 'fs', + 'http', + 'indices', + 'jvm', + 'network', + 'os', + 'process', + 'thread_pool', + 'transport' + ] + } + } + }, + { + fmt: '/_nodes/stats' + } + ] +}); + /** * Perform a [percolate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html) request * @@ -4519,6 +4295,218 @@ api.search = ca({ method: 'POST' }); +api.snapshot = function SnapshotNS(transport) { + this.transport = transport; +}; + +/** + * Perform a [snapshot.create](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {Boolean} params.waitForCompletion - Should this request wait until the operation has completed before returning + * @param {String} params.repository - A repository name + * @param {String} params.snapshot - A snapshot name + */ +api.snapshot.prototype.create = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + waitForCompletion: { + type: 'boolean', + 'default': false, + name: 'wait_for_completion' + } + }, + method: 'POST' +}); + +/** + * Perform a [snapshot.createRepository](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {Date, Number} params.timeout - Explicit operation timeout + * @param {String} params.repository - A repository name + */ +api.snapshot.prototype.createRepository = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + timeout: { + type: 'time' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>', + req: { + repository: { + type: 'string' + } + }, + sortOrder: -1 + }, + method: 'POST' +}); + +/** + * Perform a [snapshot.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {String} params.repository - A repository name + * @param {String} params.snapshot - A snapshot name + */ +api.snapshot.prototype['delete'] = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>/<%=snapshot%>', + req: { + repository: { + type: 'string' + }, + snapshot: { + type: 'string' + } + }, + sortOrder: -2 + }, + method: 'DELETE' +}); + +/** + * Perform a [snapshot.deleteRepository](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {Date, Number} params.timeout - Explicit operation timeout + * @param {String, String[], Boolean} params.repository - A comma-separated list of repository names + */ +api.snapshot.prototype.deleteRepository = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + timeout: { + type: 'time' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>', + req: { + repository: { + type: 'list' + } + }, + sortOrder: -1 + }, + method: 'DELETE' +}); + +/** + * Perform a [snapshot.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {String, String[], Boolean} params.repository - A comma-separated list of repository names + * @param {String, String[], Boolean} params.snapshot - A comma-separated list of snapshot names + */ +api.snapshot.prototype.get = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>/<%=snapshot%>', + req: { + repository: { + type: 'list' + }, + snapshot: { + type: 'list' + } + }, + sortOrder: -2 + } +}); + +/** + * Perform a [snapshot.getRepository](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {String, String[], Boolean} params.repository - A comma-separated list of repository names + */ +api.snapshot.prototype.getRepository = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + } + }, + urls: [ + { + fmt: '/_snapshot/<%=repository%>', + req: { + repository: { + type: 'list' + } + } + }, + { + fmt: '/_snapshot' + } + ] +}); + +/** + * Perform a [snapshot.restore](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node + * @param {Boolean} params.waitForCompletion - Should this request wait until the operation has completed before returning + * @param {String} params.repository - A repository name + * @param {String} params.snapshot - A snapshot name + */ +api.snapshot.prototype.restore = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + waitForCompletion: { + type: 'boolean', + 'default': false, + name: 'wait_for_completion' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>/<%=snapshot%>/_restore', + req: { + repository: { + type: 'string' + }, + snapshot: { + type: 'string' + } + }, + sortOrder: -2 + }, + method: 'POST' +}); + /** * Perform a [suggest](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-search.html) request *