Updated the API to the latest version and fixed an issue with the test runner,
which was confused by parameters that were in the URL, but not in the params list.
This commit is contained in:
@ -31,6 +31,9 @@ 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>>
|
||||
@ -1537,7 +1540,7 @@ client.searchTemplate([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-search.html[the elasticsearch docs] for more about this method.
|
||||
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
@ -1545,6 +1548,32 @@ The default method is `POST` and the usual <<api-conventions,params and return v
|
||||
==== 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"`
|
||||
|
||||
`preference`::
|
||||
`String` -- Specify the node or shard the operation should be performed on (default: random)
|
||||
`routing`::
|
||||
`String, String[], Boolean` -- A comma-separated list of specific routing values
|
||||
`scroll`::
|
||||
`Duration` -- Specify how long a consistent view of the index should be maintained for scrolled search
|
||||
`searchType`::
|
||||
`String` -- Search operation type
|
||||
Options:::
|
||||
* `"query_then_fetch"`
|
||||
* `"query_and_fetch"`
|
||||
* `"dfs_query_then_fetch"`
|
||||
* `"dfs_query_and_fetch"`
|
||||
* `"count"`
|
||||
* `"scan"`
|
||||
|
||||
`index`::
|
||||
`String, String[], Boolean` -- A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|
||||
`type`::
|
||||
@ -1810,6 +1839,81 @@ 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`
|
||||
|
||||
|
||||
@ -31,6 +31,9 @@ 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>>
|
||||
@ -1537,7 +1540,7 @@ client.searchTemplate([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-search.html[the elasticsearch docs] for more about this method.
|
||||
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
@ -1545,6 +1548,32 @@ The default method is `POST` and the usual <<api-conventions,params and return v
|
||||
==== 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"`
|
||||
|
||||
`preference`::
|
||||
`String` -- Specify the node or shard the operation should be performed on (default: random)
|
||||
`routing`::
|
||||
`String, String[], Boolean` -- A comma-separated list of specific routing values
|
||||
`scroll`::
|
||||
`Duration` -- Specify how long a consistent view of the index should be maintained for scrolled search
|
||||
`searchType`::
|
||||
`String` -- Search operation type
|
||||
Options:::
|
||||
* `"query_then_fetch"`
|
||||
* `"query_and_fetch"`
|
||||
* `"dfs_query_then_fetch"`
|
||||
* `"dfs_query_and_fetch"`
|
||||
* `"count"`
|
||||
* `"scan"`
|
||||
|
||||
`index`::
|
||||
`String, String[], Boolean` -- A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|
||||
`type`::
|
||||
@ -1810,6 +1839,81 @@ 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`
|
||||
|
||||
|
||||
@ -3,7 +3,104 @@
|
||||
var ca = require('../client_action');
|
||||
var api = module.exports = {};
|
||||
|
||||
api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot'];
|
||||
api._namespaces = ['benchmark', 'cat', 'cluster', 'indices', 'nodes', 'snapshot'];
|
||||
|
||||
api.benchmark = function BenchmarkNS(transport) {
|
||||
this.transport = transport;
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform a [benchmark.abort](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({
|
||||
url: {
|
||||
fmt: '/_bench/abort/<%=name%>',
|
||||
req: {
|
||||
name: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
},
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @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({
|
||||
params: {
|
||||
verbose: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/<%=type%>/_bench',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
},
|
||||
type: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/<%=index%>/_bench',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_bench'
|
||||
}
|
||||
],
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [bulk](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/docs-bulk.html) request
|
||||
@ -4726,13 +4823,60 @@ api.search = ca({
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-search.html) request
|
||||
* Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.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 {String} params.preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {String, String[], Boolean} params.routing - A comma-separated list of specific routing values
|
||||
* @param {Duration} params.scroll - Specify how long a consistent view of the index should be maintained for scrolled search
|
||||
* @param {String} params.searchType - Search operation type
|
||||
* @param {String, String[], Boolean} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|
||||
* @param {String, String[], Boolean} params.type - A comma-separated list of document types to search; leave empty to perform the operation on all types
|
||||
*/
|
||||
api.searchTemplate = 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'
|
||||
},
|
||||
preference: {
|
||||
type: 'string'
|
||||
},
|
||||
routing: {
|
||||
type: 'list'
|
||||
},
|
||||
scroll: {
|
||||
type: 'duration'
|
||||
},
|
||||
searchType: {
|
||||
type: 'enum',
|
||||
options: [
|
||||
'query_then_fetch',
|
||||
'query_and_fetch',
|
||||
'dfs_query_then_fetch',
|
||||
'dfs_query_and_fetch',
|
||||
'count',
|
||||
'scan'
|
||||
],
|
||||
name: 'search_type'
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/<%=type%>/_search/template',
|
||||
|
||||
@ -3,7 +3,104 @@
|
||||
var ca = require('../client_action');
|
||||
var api = module.exports = {};
|
||||
|
||||
api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot'];
|
||||
api._namespaces = ['benchmark', 'cat', 'cluster', 'indices', 'nodes', 'snapshot'];
|
||||
|
||||
api.benchmark = function BenchmarkNS(transport) {
|
||||
this.transport = transport;
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform a [benchmark.abort](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({
|
||||
url: {
|
||||
fmt: '/_bench/abort/<%=name%>',
|
||||
req: {
|
||||
name: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
},
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @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({
|
||||
params: {
|
||||
verbose: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/<%=type%>/_bench',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
},
|
||||
type: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/<%=index%>/_bench',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_bench'
|
||||
}
|
||||
],
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [bulk](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/docs-bulk.html) request
|
||||
@ -4726,13 +4823,60 @@ api.search = ca({
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-search.html) request
|
||||
* Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.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 {String} params.preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {String, String[], Boolean} params.routing - A comma-separated list of specific routing values
|
||||
* @param {Duration} params.scroll - Specify how long a consistent view of the index should be maintained for scrolled search
|
||||
* @param {String} params.searchType - Search operation type
|
||||
* @param {String, String[], Boolean} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|
||||
* @param {String, String[], Boolean} params.type - A comma-separated list of document types to search; leave empty to perform the operation on all types
|
||||
*/
|
||||
api.searchTemplate = 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'
|
||||
},
|
||||
preference: {
|
||||
type: 'string'
|
||||
},
|
||||
routing: {
|
||||
type: 'list'
|
||||
},
|
||||
scroll: {
|
||||
type: 'duration'
|
||||
},
|
||||
searchType: {
|
||||
type: 'enum',
|
||||
options: [
|
||||
'query_then_fetch',
|
||||
'query_and_fetch',
|
||||
'dfs_query_then_fetch',
|
||||
'dfs_query_and_fetch',
|
||||
'count',
|
||||
'scan'
|
||||
],
|
||||
name: 'search_type'
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/<%=type%>/_search/template',
|
||||
|
||||
@ -341,9 +341,19 @@ YamlDoc.prototype = {
|
||||
var clientAction = this.get(clientActionName, client);
|
||||
var params = _.transform(args[action], function (params, val, name) {
|
||||
var camelName = _.camelCase(name);
|
||||
// undocumented params should be passed through as-is
|
||||
|
||||
// search through the params and url peices to find this param name
|
||||
var paramName = name;
|
||||
if (clientAction && clientAction.spec && clientAction.spec.params && clientAction.spec.params[camelName]) {
|
||||
var spec = clientAction && clientAction.spec;
|
||||
var knownParam = spec && spec.params && spec.params[camelName];
|
||||
var knownUrlParam = spec && !knownParam && !!_.find(spec.url ? [spec.url] : spec.urls, function (url) {
|
||||
if ((url.opt && url.opt[camelName]) || (url.req && url.req[camelName])) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// if we do know this param name, use the camelCase verison
|
||||
if (knownParam || knownUrlParam) {
|
||||
paramName = camelName;
|
||||
}
|
||||
|
||||
@ -375,41 +385,36 @@ YamlDoc.prototype = {
|
||||
|
||||
expect(clientAction || clientActionName).to.be.a('function');
|
||||
|
||||
if (typeof clientAction === 'function') {
|
||||
if (_.isNumeric(catcher)) {
|
||||
params.ignore = _.union(params.ignore || [], [catcher]);
|
||||
catcher = null;
|
||||
}
|
||||
|
||||
var cb = _.bind(function (error, body, status) {
|
||||
this._last_requests_response = body;
|
||||
|
||||
if (error) {
|
||||
if (catcher) {
|
||||
if (catcher instanceof RegExp) {
|
||||
// error message should match the regexp
|
||||
expect(error.message).to.match(catcher);
|
||||
error = null;
|
||||
} else if (typeof catcher === 'function') {
|
||||
// error should be an instance of
|
||||
expect(error).to.be.a(catcher);
|
||||
error = null;
|
||||
} else {
|
||||
return done(new Error('Invalid catcher ' + catcher));
|
||||
}
|
||||
} else {
|
||||
return done(error);
|
||||
}
|
||||
}
|
||||
|
||||
done(error);
|
||||
}, this);
|
||||
|
||||
clientAction.call(client, params, cb);
|
||||
} else {
|
||||
done(new Error('stepped in do_do, did not find a function'));
|
||||
if (_.isNumeric(catcher)) {
|
||||
params.ignore = _.union(params.ignore || [], [catcher]);
|
||||
catcher = null;
|
||||
}
|
||||
|
||||
var cb = _.bind(function (error, body, status) {
|
||||
this._last_requests_response = body;
|
||||
|
||||
if (error) {
|
||||
if (catcher) {
|
||||
if (catcher instanceof RegExp) {
|
||||
// error message should match the regexp
|
||||
expect(error.message).to.match(catcher);
|
||||
error = null;
|
||||
} else if (typeof catcher === 'function') {
|
||||
// error should be an instance of
|
||||
expect(error).to.be.a(catcher);
|
||||
error = null;
|
||||
} else {
|
||||
return done(new Error('Invalid catcher ' + catcher));
|
||||
}
|
||||
} else {
|
||||
return done(error);
|
||||
}
|
||||
}
|
||||
|
||||
done(error);
|
||||
}, this);
|
||||
|
||||
clientAction.call(client, params, cb);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user