updated to the latest API, which moves the experimental benchmark API (in the unreleased API versions master and 1.x) and includes a new indices.updateAliases example. Closes #83

This commit is contained in:
Spencer Alger
2014-04-22 11:09:51 -07:00
parent 95f5bdb7ea
commit 93648ce8c1
10 changed files with 362 additions and 271 deletions

View File

@ -0,0 +1,14 @@
.Perform an atomic alias swap, for a rotating index
[source,js]
---------
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
---------

View File

@ -3666,7 +3666,20 @@ Update specified aliases.
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-aliases.html[the elasticsearch docs] for more about this method.
// no examples
.Perform an atomic alias swap, for a rotating index
[source,js]
---------
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
---------
==== Params

View File

@ -2915,7 +2915,20 @@ Update specified aliases.
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/indices-aliases.html[the elasticsearch docs] for more about this method.
// no examples
.Perform an atomic alias swap, for a rotating index
[source,js]
---------
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
---------
==== Params

View File

@ -3559,7 +3559,20 @@ Update specified aliases.
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-aliases.html[the elasticsearch docs] for more about this method.
// no examples
.Perform an atomic alias swap, for a rotating index
[source,js]
---------
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
---------
==== Params

View File

@ -5,6 +5,8 @@
NOTE: At this time, you must opt into the 1.x API by setting the `apiVersion` config parameter.
[[js-api-method-index-1-x]]
* <<api-abortbenchmark-1-x,abortBenchmark>>
* <<api-benchmark-1-x,benchmark>>
* <<api-bulk-1-x,bulk>>
* <<api-clearscroll-1-x,clearScroll>>
* <<api-count-1-x,count>>
@ -18,6 +20,7 @@ NOTE: At this time, you must opt into the 1.x API by setting the `apiVersion` co
* <<api-getsource-1-x,getSource>>
* <<api-index-1-x,index>>
* <<api-info-1-x,info>>
* <<api-listbenchmarks-1-x,listBenchmarks>>
* <<api-mget-1-x,mget>>
* <<api-mlt-1-x,mlt>>
* <<api-mpercolate-1-x,mpercolate>>
@ -31,9 +34,6 @@ NOTE: At this time, you must opt into the 1.x API by setting the `apiVersion` co
* <<api-suggest-1-x,suggest>>
* <<api-termvector-1-x,termvector>>
* <<api-update-1-x,update>>
* <<api-benchmark-abort-1-x,benchmark.abort>>
* <<api-benchmark-list-1-x,benchmark.list>>
* <<api-benchmark-submit-1-x,benchmark.submit>>
* <<api-cat-aliases-1-x,cat.aliases>>
* <<api-cat-allocation-1-x,cat.allocation>>
* <<api-cat-count-1-x,cat.count>>
@ -102,6 +102,56 @@ NOTE: At this time, you must opt into the 1.x API by setting the `apiVersion` co
* <<api-snapshot-restore-1-x,snapshot.restore>>
* <<api-snapshot-status-1-x,snapshot.status>>
[[api-abortbenchmark-1-x]]
=== `abortBenchmark`
[source,js]
--------
client.abortBenchmark([params, [callback]])
--------
// no description
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`name`::
`String` -- A benchmark name
link:#[back to top]
[[api-benchmark-1-x]]
=== `benchmark`
[source,js]
--------
client.benchmark([params, [callback]])
--------
// no description
The default method is `PUT` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`verbose`::
`Boolean` -- Specify whether to return verbose statistics about each iteration (default: false)
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-bulk-1-x]]
=== `bulk`
@ -919,6 +969,31 @@ The default method is `GET` and the usual <<api-conventions,params and return va
[[api-listbenchmarks-1-x]]
=== `listBenchmarks`
[source,js]
--------
client.listBenchmarks([params, [callback]])
--------
// no description
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-mget-1-x]]
=== `mget`
@ -1839,81 +1914,6 @@ Options:::
link:#[back to top]
[[api-benchmark-abort-1-x]]
=== `benchmark.abort`
[source,js]
--------
client.benchmark.abort([params, [callback]])
--------
// no description
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`name`::
`String` -- A benchmark name
link:#[back to top]
[[api-benchmark-list-1-x]]
=== `benchmark.list`
[source,js]
--------
client.benchmark.list([params, [callback]])
--------
// no description
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-benchmark-submit-1-x]]
=== `benchmark.submit`
[source,js]
--------
client.benchmark.submit([params, [callback]])
--------
// no description
The default method is `PUT` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`verbose`::
`Boolean` -- Specify whether to return verbose statistics about each iteration (default: false)
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-cat-aliases-1-x]]
=== `cat.aliases`
@ -3736,7 +3736,20 @@ Update specified aliases.
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-aliases.html[the elasticsearch docs] for more about this method.
// no examples
.Perform an atomic alias swap, for a rotating index
[source,js]
---------
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
---------
==== Params

View File

@ -5,6 +5,8 @@
NOTE: At this time, you must opt into the master API by setting the `apiVersion` config parameter.
[[js-api-method-index-master]]
* <<api-abortbenchmark-master,abortBenchmark>>
* <<api-benchmark-master,benchmark>>
* <<api-bulk-master,bulk>>
* <<api-clearscroll-master,clearScroll>>
* <<api-count-master,count>>
@ -18,6 +20,7 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion`
* <<api-getsource-master,getSource>>
* <<api-index-master,index>>
* <<api-info-master,info>>
* <<api-listbenchmarks-master,listBenchmarks>>
* <<api-mget-master,mget>>
* <<api-mlt-master,mlt>>
* <<api-mpercolate-master,mpercolate>>
@ -31,9 +34,6 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion`
* <<api-suggest-master,suggest>>
* <<api-termvector-master,termvector>>
* <<api-update-master,update>>
* <<api-benchmark-abort-master,benchmark.abort>>
* <<api-benchmark-list-master,benchmark.list>>
* <<api-benchmark-submit-master,benchmark.submit>>
* <<api-cat-aliases-master,cat.aliases>>
* <<api-cat-allocation-master,cat.allocation>>
* <<api-cat-count-master,cat.count>>
@ -102,6 +102,56 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion`
* <<api-snapshot-restore-master,snapshot.restore>>
* <<api-snapshot-status-master,snapshot.status>>
[[api-abortbenchmark-master]]
=== `abortBenchmark`
[source,js]
--------
client.abortBenchmark([params, [callback]])
--------
// no description
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`name`::
`String` -- A benchmark name
link:#[back to top]
[[api-benchmark-master]]
=== `benchmark`
[source,js]
--------
client.benchmark([params, [callback]])
--------
// no description
The default method is `PUT` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`verbose`::
`Boolean` -- Specify whether to return verbose statistics about each iteration (default: false)
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-bulk-master]]
=== `bulk`
@ -919,6 +969,31 @@ The default method is `GET` and the usual <<api-conventions,params and return va
[[api-listbenchmarks-master]]
=== `listBenchmarks`
[source,js]
--------
client.listBenchmarks([params, [callback]])
--------
// no description
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-mget-master]]
=== `mget`
@ -1839,81 +1914,6 @@ Options:::
link:#[back to top]
[[api-benchmark-abort-master]]
=== `benchmark.abort`
[source,js]
--------
client.benchmark.abort([params, [callback]])
--------
// no description
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`name`::
`String` -- A benchmark name
link:#[back to top]
[[api-benchmark-list-master]]
=== `benchmark.list`
[source,js]
--------
client.benchmark.list([params, [callback]])
--------
// no description
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-benchmark-submit-master]]
=== `benchmark.submit`
[source,js]
--------
client.benchmark.submit([params, [callback]])
--------
// no description
The default method is `PUT` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`verbose`::
`Boolean` -- Specify whether to return verbose statistics about each iteration (default: false)
`index`::
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
`type`::
`String` -- The name of the document type
link:#[back to top]
[[api-cat-aliases-master]]
=== `cat.aliases`
@ -3736,7 +3736,20 @@ Update specified aliases.
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-aliases.html[the elasticsearch docs] for more about this method.
// no examples
.Perform an atomic alias swap, for a rotating index
[source,js]
---------
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
---------
==== Params

View File

@ -614,14 +614,19 @@ api.cat.prototype.threadPool = ca({
* @param {String, String[], Boolean} params.scrollId - A comma-separated list of scroll IDs to clear
*/
api.clearScroll = ca({
url: {
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
urls: [
{
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
}
}
},
{
fmt: '/_search/scroll'
}
},
],
method: 'DELETE'
});

View File

@ -646,14 +646,19 @@ api.cat.prototype.threadPool = ca({
* @param {String, String[], Boolean} params.scrollId - A comma-separated list of scroll IDs to clear
*/
api.clearScroll = ca({
url: {
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
urls: [
{
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
}
}
},
{
fmt: '/_search/scroll'
}
},
],
method: 'DELETE'
});

View File

@ -3,19 +3,15 @@
var ca = require('../client_action');
var api = module.exports = {};
api._namespaces = ['benchmark', 'cat', 'cluster', 'indices', 'nodes', 'snapshot'];
api.benchmark = function BenchmarkNS(transport) {
this.transport = transport;
};
api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot'];
/**
* Perform a [benchmark.abort](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
* Perform a [abortBenchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.name - A benchmark name
*/
api.benchmark.prototype.abort = ca({
api.abortBenchmark = ca({
url: {
fmt: '/_bench/abort/<%=name%>',
req: {
@ -28,48 +24,14 @@ api.benchmark.prototype.abort = ca({
});
/**
* Perform a [benchmark.list](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @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
* @param {String} params.type - The name of the document type
*/
api.benchmark.prototype.list = ca({
urls: [
{
fmt: '/<%=index%>/<%=type%>/_bench',
req: {
index: {
type: 'list'
},
type: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/_bench',
req: {
index: {
type: 'list'
}
}
},
{
fmt: '/_bench'
}
]
});
/**
* Perform a [benchmark.submit](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
* Perform a [benchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {Boolean} params.verbose - Specify whether to return verbose statistics about each iteration (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
* @param {String} params.type - The name of the document type
*/
api.benchmark.prototype.submit = ca({
api.benchmark = ca({
params: {
verbose: {
type: 'boolean'
@ -743,14 +705,19 @@ api.cat.prototype.threadPool = ca({
* @param {String, String[], Boolean} params.scrollId - A comma-separated list of scroll IDs to clear
*/
api.clearScroll = ca({
url: {
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
urls: [
{
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
}
}
},
{
fmt: '/_search/scroll'
}
},
],
method: 'DELETE'
});
@ -3732,6 +3699,40 @@ api.info = ca({
}
});
/**
* Perform a [listBenchmarks](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @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
* @param {String} params.type - The name of the document type
*/
api.listBenchmarks = ca({
urls: [
{
fmt: '/<%=index%>/<%=type%>/_bench',
req: {
index: {
type: 'list'
},
type: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/_bench',
req: {
index: {
type: 'list'
}
}
},
{
fmt: '/_bench'
}
]
});
/**
* Perform a [mget](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/docs-multi-get.html) request
*

View File

@ -3,19 +3,15 @@
var ca = require('../client_action');
var api = module.exports = {};
api._namespaces = ['benchmark', 'cat', 'cluster', 'indices', 'nodes', 'snapshot'];
api.benchmark = function BenchmarkNS(transport) {
this.transport = transport;
};
api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot'];
/**
* Perform a [benchmark.abort](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
* Perform a [abortBenchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.name - A benchmark name
*/
api.benchmark.prototype.abort = ca({
api.abortBenchmark = ca({
url: {
fmt: '/_bench/abort/<%=name%>',
req: {
@ -28,48 +24,14 @@ api.benchmark.prototype.abort = ca({
});
/**
* Perform a [benchmark.list](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @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
* @param {String} params.type - The name of the document type
*/
api.benchmark.prototype.list = ca({
urls: [
{
fmt: '/<%=index%>/<%=type%>/_bench',
req: {
index: {
type: 'list'
},
type: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/_bench',
req: {
index: {
type: 'list'
}
}
},
{
fmt: '/_bench'
}
]
});
/**
* Perform a [benchmark.submit](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
* Perform a [benchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {Boolean} params.verbose - Specify whether to return verbose statistics about each iteration (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
* @param {String} params.type - The name of the document type
*/
api.benchmark.prototype.submit = ca({
api.benchmark = ca({
params: {
verbose: {
type: 'boolean'
@ -743,14 +705,19 @@ api.cat.prototype.threadPool = ca({
* @param {String, String[], Boolean} params.scrollId - A comma-separated list of scroll IDs to clear
*/
api.clearScroll = ca({
url: {
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
urls: [
{
fmt: '/_search/scroll/<%=scrollId%>',
req: {
scrollId: {
type: 'list'
}
}
},
{
fmt: '/_search/scroll'
}
},
],
method: 'DELETE'
});
@ -3732,6 +3699,40 @@ api.info = ca({
}
});
/**
* Perform a [listBenchmarks](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @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
* @param {String} params.type - The name of the document type
*/
api.listBenchmarks = ca({
urls: [
{
fmt: '/<%=index%>/<%=type%>/_bench',
req: {
index: {
type: 'list'
},
type: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/_bench',
req: {
index: {
type: 'list'
}
}
},
{
fmt: '/_bench'
}
]
});
/**
* Perform a [mget](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/docs-multi-get.html) request
*