From 923a36e29d2f46ccdb51808ea1cb179c4e39db6c Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Tue, 7 Oct 2014 08:47:14 -0700 Subject: [PATCH] updated APIs --- docs/api_methods.asciidoc | 68 +++++++++++++++++++++++- docs/api_methods_0_90.asciidoc | 2 +- docs/api_methods_1_0.asciidoc | 2 +- docs/api_methods_1_1.asciidoc | 2 +- docs/api_methods_1_2.asciidoc | 2 +- docs/api_methods_1_3.asciidoc | 2 +- src/lib/apis/1_4.js | 83 +++++++++++++++++++++++++++++ src/lib/apis/1_x.js | 93 ++++++++++++++++++++++++++++++++ src/lib/apis/master.js | 97 ++++++++++++++++++++++++++++++++-- 9 files changed, 341 insertions(+), 10 deletions(-) diff --git a/docs/api_methods.asciidoc b/docs/api_methods.asciidoc index 7bde52456..e28fcccde 100644 --- a/docs/api_methods.asciidoc +++ b/docs/api_methods.asciidoc @@ -95,6 +95,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha * <> * <> * <> +* <> * <> * <> * <> @@ -108,6 +109,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha * <> * <> * <> +* <> [[api-bulk]] === `bulk` @@ -1553,7 +1555,7 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hists.forEach(function (hit) { + response.hits.hits.forEach(function (hit) { allTitles.push(hit.fields.title); }); @@ -4048,6 +4050,41 @@ client.indices.updateAliases({ link:#[back to top] +[[api-indices-upgrade]] +=== `indices.upgrade` + +[source,js] +-------- +client.indices.upgrade([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-upgrade.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`ignoreUnavailable`:: +`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed) +`allowNoIndices`:: +`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) +`[expandWildcards=open]`:: +`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both. +Options::: + * `"open"` + * `"closed"` + +`waitForCompletion`:: +`Boolean` -- Specify whether the request should block until the all segments are upgraded (default: true) +`index`:: +`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + +link:#[back to top] + [[api-indices-validatequery]] === `indices.validateQuery` @@ -4280,6 +4317,8 @@ 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 + +link:#[back to top] diff --git a/docs/api_methods_0_90.asciidoc b/docs/api_methods_0_90.asciidoc index 734a2b4be..9a4568303 100644 --- a/docs/api_methods_0_90.asciidoc +++ b/docs/api_methods_0_90.asciidoc @@ -1138,7 +1138,7 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hists.forEach(function (hit) { + response.hits.hits.forEach(function (hit) { allTitles.push(hit.fields.title); }); diff --git a/docs/api_methods_1_0.asciidoc b/docs/api_methods_1_0.asciidoc index c1f1f5045..dd689067b 100644 --- a/docs/api_methods_1_0.asciidoc +++ b/docs/api_methods_1_0.asciidoc @@ -1339,7 +1339,7 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hists.forEach(function (hit) { + response.hits.hits.forEach(function (hit) { allTitles.push(hit.fields.title); }); diff --git a/docs/api_methods_1_1.asciidoc b/docs/api_methods_1_1.asciidoc index 3d2673b9b..e4da88aa1 100644 --- a/docs/api_methods_1_1.asciidoc +++ b/docs/api_methods_1_1.asciidoc @@ -1357,7 +1357,7 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hists.forEach(function (hit) { + response.hits.hits.forEach(function (hit) { allTitles.push(hit.fields.title); }); diff --git a/docs/api_methods_1_2.asciidoc b/docs/api_methods_1_2.asciidoc index 40fa64c5e..cdd4b2f18 100644 --- a/docs/api_methods_1_2.asciidoc +++ b/docs/api_methods_1_2.asciidoc @@ -1407,7 +1407,7 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hists.forEach(function (hit) { + response.hits.hits.forEach(function (hit) { allTitles.push(hit.fields.title); }); diff --git a/docs/api_methods_1_3.asciidoc b/docs/api_methods_1_3.asciidoc index 8790235b7..c8d8b1065 100644 --- a/docs/api_methods_1_3.asciidoc +++ b/docs/api_methods_1_3.asciidoc @@ -1557,7 +1557,7 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hists.forEach(function (hit) { + response.hits.hits.forEach(function (hit) { allTitles.push(hit.fields.title); }); diff --git a/src/lib/apis/1_4.js b/src/lib/apis/1_4.js index 5f73093f0..7f7901c50 100644 --- a/src/lib/apis/1_4.js +++ b/src/lib/apis/1_4.js @@ -3822,6 +3822,56 @@ api.indices.prototype.updateAliases = ca({ method: 'POST' }); +/** + * Perform a [indices.upgrade](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-upgrade.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {Boolean} params.waitForCompletion - Specify whether the request should block until the all segments are upgraded (default: true) + * @param {String, String[], Boolean} params.index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + */ +api.indices.prototype.upgrade = ca({ + params: { + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + }, + waitForCompletion: { + type: 'boolean', + name: 'wait_for_completion' + } + }, + urls: [ + { + fmt: '/<%=index%>/_upgrade', + req: { + index: { + type: 'list' + } + } + }, + { + fmt: '/_upgrade' + } + ], + method: 'POST' +}); + /** * Perform a [indices.validateQuery](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-validate.html) request * @@ -5342,6 +5392,7 @@ api.snapshot.prototype.create = ca({ * @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 {Boolean} params.verify - Whether to verify the repository after creation * @param {String} params.repository - A repository name */ api.snapshot.prototype.createRepository = ca({ @@ -5352,6 +5403,9 @@ api.snapshot.prototype.createRepository = ca({ }, timeout: { type: 'time' + }, + verify: { + type: 'boolean' } }, url: { @@ -5561,6 +5615,35 @@ api.snapshot.prototype.status = ca({ ] }); +/** + * Perform a [snapshot.verifyRepository](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.verifyRepository = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + timeout: { + type: 'time' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>/_verify', + req: { + repository: { + type: 'string' + } + } + }, + method: 'POST' +}); + /** * Perform a [suggest](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-search.html) request * diff --git a/src/lib/apis/1_x.js b/src/lib/apis/1_x.js index 6ed461017..b319df08f 100644 --- a/src/lib/apis/1_x.js +++ b/src/lib/apis/1_x.js @@ -3881,6 +3881,56 @@ api.indices.prototype.updateAliases = ca({ method: 'POST' }); +/** + * Perform a [indices.upgrade](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-upgrade.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {Boolean} params.waitForCompletion - Specify whether the request should block until the all segments are upgraded (default: true) + * @param {String, String[], Boolean} params.index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + */ +api.indices.prototype.upgrade = ca({ + params: { + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + }, + waitForCompletion: { + type: 'boolean', + name: 'wait_for_completion' + } + }, + urls: [ + { + fmt: '/<%=index%>/_upgrade', + req: { + index: { + type: 'list' + } + } + }, + { + fmt: '/_upgrade' + } + ], + method: 'POST' +}); + /** * Perform a [indices.validateQuery](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-validate.html) request * @@ -4309,6 +4359,7 @@ api.msearch = ca({ * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {String} params.routing - Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {String} params.parent - Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * @param {Boolean} params.realtime - Specifies if requests are real-time as opposed to near-real-time (default: true). * @param {String} params.index - The index in which the document resides. * @param {String} params.type - The type of the document. * @param {String} params.id - The id of the document. @@ -4361,6 +4412,10 @@ api.mtermvectors = ca({ parent: { type: 'string', required: false + }, + realtime: { + type: 'boolean', + required: false } }, urls: [ @@ -5435,6 +5490,7 @@ api.snapshot.prototype.create = ca({ * @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 {Boolean} params.verify - Whether to verify the repository after creation * @param {String} params.repository - A repository name */ api.snapshot.prototype.createRepository = ca({ @@ -5445,6 +5501,9 @@ api.snapshot.prototype.createRepository = ca({ }, timeout: { type: 'time' + }, + verify: { + type: 'boolean' } }, url: { @@ -5654,6 +5713,35 @@ api.snapshot.prototype.status = ca({ ] }); +/** + * Perform a [snapshot.verifyRepository](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.verifyRepository = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + timeout: { + type: 'time' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>/_verify', + req: { + repository: { + type: 'string' + } + } + }, + method: 'POST' +}); + /** * Perform a [suggest](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-search.html) request * @@ -5725,6 +5813,7 @@ api.suggest = ca({ * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random). * @param {String} params.routing - Specific routing value. * @param {String} params.parent - Parent id of documents. + * @param {Boolean} params.realtime - Specifies if request is real-time as opposed to near-real-time (default: true). * @param {String} params.index - The index in which the document resides. * @param {String} params.type - The type of the document. * @param {String} params.id - The id of the document. @@ -5773,6 +5862,10 @@ api.termvector = ca({ parent: { type: 'string', required: false + }, + realtime: { + type: 'boolean', + required: false } }, url: { diff --git a/src/lib/apis/master.js b/src/lib/apis/master.js index c2468ea1b..33a6a4bb5 100644 --- a/src/lib/apis/master.js +++ b/src/lib/apis/master.js @@ -3181,7 +3181,6 @@ api.indices.prototype.open = ca({ * @param {Boolean} params.onlyExpungeDeletes - Specify whether the operation should only expunge deleted documents * @param {Anything} params.operationThreading - TODO: ? * @param {Boolean} params.waitForMerge - Specify whether the request should block until the merge process is finished (default: true) - * @param {Boolean} params.force - Force a merge operation to run, even if there is a single segment in the index (default: false) * @param {String, String[], Boolean} params.index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices */ api.indices.prototype.optimize = ca({ @@ -3220,9 +3219,6 @@ api.indices.prototype.optimize = ca({ waitForMerge: { type: 'boolean', name: 'wait_for_merge' - }, - force: { - type: 'boolean' } }, urls: [ @@ -3820,6 +3816,56 @@ api.indices.prototype.updateAliases = ca({ method: 'POST' }); +/** + * Perform a [indices.upgrade](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-upgrade.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {Boolean} params.waitForCompletion - Specify whether the request should block until the all segments are upgraded (default: true) + * @param {String, String[], Boolean} params.index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + */ +api.indices.prototype.upgrade = ca({ + params: { + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + }, + waitForCompletion: { + type: 'boolean', + name: 'wait_for_completion' + } + }, + urls: [ + { + fmt: '/<%=index%>/_upgrade', + req: { + index: { + type: 'list' + } + } + }, + { + fmt: '/_upgrade' + } + ], + method: 'POST' +}); + /** * Perform a [indices.validateQuery](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-validate.html) request * @@ -4248,6 +4294,7 @@ api.msearch = ca({ * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {String} params.routing - Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {String} params.parent - Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * @param {Boolean} params.realtime - Specifies if requests are real-time as opposed to near-real-time (default: true). * @param {String} params.index - The index in which the document resides. * @param {String} params.type - The type of the document. * @param {String} params.id - The id of the document. @@ -4300,6 +4347,10 @@ api.mtermvectors = ca({ parent: { type: 'string', required: false + }, + realtime: { + type: 'boolean', + required: false } }, urls: [ @@ -5377,6 +5428,7 @@ api.snapshot.prototype.create = ca({ * @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 {Boolean} params.verify - Whether to verify the repository after creation * @param {String} params.repository - A repository name */ api.snapshot.prototype.createRepository = ca({ @@ -5387,6 +5439,9 @@ api.snapshot.prototype.createRepository = ca({ }, timeout: { type: 'time' + }, + verify: { + type: 'boolean' } }, url: { @@ -5596,6 +5651,35 @@ api.snapshot.prototype.status = ca({ ] }); +/** + * Perform a [snapshot.verifyRepository](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.verifyRepository = ca({ + params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, + timeout: { + type: 'time' + } + }, + url: { + fmt: '/_snapshot/<%=repository%>/_verify', + req: { + repository: { + type: 'string' + } + } + }, + method: 'POST' +}); + /** * Perform a [suggest](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-search.html) request * @@ -5667,6 +5751,7 @@ api.suggest = ca({ * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random). * @param {String} params.routing - Specific routing value. * @param {String} params.parent - Parent id of documents. + * @param {Boolean} params.realtime - Specifies if request is real-time as opposed to near-real-time (default: true). * @param {String} params.index - The index in which the document resides. * @param {String} params.type - The type of the document. * @param {String} params.id - The id of the document. @@ -5715,6 +5800,10 @@ api.termvector = ca({ parent: { type: 'string', required: false + }, + realtime: { + type: 'boolean', + required: false } }, url: {