merge lastest changes
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
# elasticsearch-js changelog
|
||||
|
||||
## 2.0 (Mar 27 2014)
|
||||
- The default API version is now `'1.0'`
|
||||
- Promises are now supported using the Bluebird module.
|
||||
|
||||
## 1.5 (Feb 6 2014)
|
||||
- Switched out `keepaliveagent` dependency with `forever-agent`, which is used in the ever popular `request` module, and is much simpler.
|
||||
- The option to use keep-alive is now all or nothing. `maxKeepAliveTime` and `maxKeepAliveRequests` config parameters have been replaced by `keepAlive`, which will keeps at least `minSockets` connections open forever. See: http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/configuration.html#configuration
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
The official low-level Elasticsearch client for Node.js and the browser.
|
||||
|
||||
[](https://travis-ci.org/elasticsearch/elasticsearch-js) [](https://coveralls.io/r/elasticsearch/elasticsearch-js) [](https://david-dm.org/elasticsearch/elasticsearch-js)
|
||||
[](https://travis-ci.org/elasticsearch/elasticsearch-js?branch=2.0) [](https://coveralls.io/r/elasticsearch/elasticsearch-js?branch=2.0) [](https://david-dm.org/elasticsearch/elasticsearch-js)
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[[api-reference]]
|
||||
== 1.0 API
|
||||
== 1.1 API
|
||||
|
||||
|
||||
NOTE: This is currently the default API, but in upcomming versions that will change. We recommend setting the `apiVersion` config param when you instantiate your client to make sure that the API does not change unexpectedly.
|
||||
@ -27,6 +27,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha
|
||||
* <<api-ping,ping>>
|
||||
* <<api-scroll,scroll>>
|
||||
* <<api-search,search>>
|
||||
* <<api-searchtemplate,searchTemplate>>
|
||||
* <<api-suggest,suggest>>
|
||||
* <<api-termvector,termvector>>
|
||||
* <<api-update,update>>
|
||||
@ -39,6 +40,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha
|
||||
* <<api-cat-master,cat.master>>
|
||||
* <<api-cat-nodes,cat.nodes>>
|
||||
* <<api-cat-pendingtasks,cat.pendingTasks>>
|
||||
* <<api-cat-plugins,cat.plugins>>
|
||||
* <<api-cat-recovery,cat.recovery>>
|
||||
* <<api-cat-shards,cat.shards>>
|
||||
* <<api-cat-threadpool,cat.threadPool>>
|
||||
@ -77,6 +79,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha
|
||||
* <<api-indices-putsettings,indices.putSettings>>
|
||||
* <<api-indices-puttemplate,indices.putTemplate>>
|
||||
* <<api-indices-putwarmer,indices.putWarmer>>
|
||||
* <<api-indices-recovery,indices.recovery>>
|
||||
* <<api-indices-refresh,indices.refresh>>
|
||||
* <<api-indices-segments,indices.segments>>
|
||||
* <<api-indices-snapshotindex,indices.snapshotIndex>>
|
||||
@ -95,6 +98,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha
|
||||
* <<api-snapshot-get,snapshot.get>>
|
||||
* <<api-snapshot-getrepository,snapshot.getRepository>>
|
||||
* <<api-snapshot-restore,snapshot.restore>>
|
||||
* <<api-snapshot-status,snapshot.status>>
|
||||
|
||||
[[api-bulk]]
|
||||
=== `bulk`
|
||||
@ -305,6 +309,8 @@ Options:::
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`index`::
|
||||
`String` -- The index of the document being count percolated.
|
||||
@ -382,6 +388,8 @@ Options:::
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`id`::
|
||||
`String` -- Document ID
|
||||
@ -448,6 +456,8 @@ Options:::
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`id`::
|
||||
`String` -- The document ID
|
||||
@ -744,6 +754,8 @@ client.get({
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`id`::
|
||||
`String` -- The document ID
|
||||
@ -795,6 +807,8 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`id`::
|
||||
`String` -- The document ID
|
||||
@ -875,6 +889,8 @@ Options:::
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`id`::
|
||||
`String` -- Document ID
|
||||
@ -1286,6 +1302,8 @@ Options:::
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`index`::
|
||||
`String` -- The index of the document being percolated.
|
||||
@ -1510,6 +1528,31 @@ Options:::
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-searchtemplate]]
|
||||
=== `searchTemplate`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
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.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`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`::
|
||||
`String, String[], Boolean` -- A comma-separated list of document types to search; leave empty to perform the operation on all types
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-suggest]]
|
||||
=== `suggest`
|
||||
|
||||
@ -1756,6 +1799,8 @@ Options:::
|
||||
Options:::
|
||||
* `"internal"`
|
||||
* `"external"`
|
||||
* `"external_gte"`
|
||||
* `"force"`
|
||||
|
||||
`id`::
|
||||
`String` -- Document ID
|
||||
@ -2049,6 +2094,37 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cat-plugins]]
|
||||
=== `cat.plugins`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.cat.plugins([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/cat-plugins.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
@ -2091,8 +2167,6 @@ Options:::
|
||||
* `"m"`
|
||||
* `"g"`
|
||||
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
@ -2316,6 +2390,8 @@ The default method is `POST` and the usual <<api-conventions,params and return v
|
||||
[horizontal]
|
||||
`dryRun`::
|
||||
`Boolean` -- Simulate the operation only and return the resulting state
|
||||
`explain`::
|
||||
`Boolean` -- Return an explanation of why the commands can or cannot be executed
|
||||
`filterMetadata`::
|
||||
`Boolean` -- Don't return cluster state metadata (default: false)
|
||||
`masterTimeout`::
|
||||
@ -3173,6 +3249,8 @@ Options:::
|
||||
`Anything` -- TODO: ?
|
||||
`waitForMerge`::
|
||||
`Boolean` -- Specify whether the request should block until the merge process is finished (default: true)
|
||||
`force`::
|
||||
`Boolean` -- Force a merge operation to run, even if there is a single segment in the index (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
|
||||
|
||||
@ -3355,6 +3433,35 @@ Options:::
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-indices-recovery]]
|
||||
=== `indices.recovery`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.indices.recovery([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/indices-recovery.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`detailed`::
|
||||
`Boolean` -- Whether to display detailed information about shard recovery
|
||||
`activeOnly`::
|
||||
`Boolean` -- Display only those recoveries that are currently on-going
|
||||
`human`::
|
||||
`Boolean` -- Whether to return time and byte values in human-readable format.
|
||||
`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-refresh]]
|
||||
=== `indices.refresh`
|
||||
|
||||
@ -3439,7 +3546,7 @@ client.indices.snapshotIndex([params, [callback]])
|
||||
|
||||
Initiate a snapshot through the gateway of one or more indices.
|
||||
|
||||
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-gateway-snapshot/.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/0.90/indices-gateway-snapshot.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
@ -3945,3 +4052,30 @@ The default method is `POST` and the usual <<api-conventions,params and return v
|
||||
`String` -- A snapshot name
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-snapshot-status]]
|
||||
=== `snapshot.status`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.snapshot.status([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/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, String[], Boolean` -- A comma-separated list of snapshot names
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
@ -2759,7 +2759,7 @@ client.indices.snapshotIndex([params, [callback]])
|
||||
|
||||
Initiate a snapshot through the gateway of one or more indices.
|
||||
|
||||
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-gateway-snapshot/.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/0.90/indices-gateway-snapshot.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion`
|
||||
* <<api-ping-master,ping>>
|
||||
* <<api-scroll-master,scroll>>
|
||||
* <<api-search-master,search>>
|
||||
* <<api-searchtemplate-master,searchTemplate>>
|
||||
* <<api-suggest-master,suggest>>
|
||||
* <<api-termvector-master,termvector>>
|
||||
* <<api-update-master,update>>
|
||||
@ -78,9 +79,9 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion`
|
||||
* <<api-indices-putsettings-master,indices.putSettings>>
|
||||
* <<api-indices-puttemplate-master,indices.putTemplate>>
|
||||
* <<api-indices-putwarmer-master,indices.putWarmer>>
|
||||
* <<api-indices-recovery-master,indices.recovery>>
|
||||
* <<api-indices-refresh-master,indices.refresh>>
|
||||
* <<api-indices-segments-master,indices.segments>>
|
||||
* <<api-indices-snapshotindex-master,indices.snapshotIndex>>
|
||||
* <<api-indices-stats-master,indices.stats>>
|
||||
* <<api-indices-status-master,indices.status>>
|
||||
* <<api-indices-updatealiases-master,indices.updateAliases>>
|
||||
@ -1526,6 +1527,31 @@ Options:::
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-searchtemplate-master]]
|
||||
=== `searchTemplate`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
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.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`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`::
|
||||
`String, String[], Boolean` -- A comma-separated list of document types to search; leave empty to perform the operation on all types
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-suggest-master]]
|
||||
=== `suggest`
|
||||
|
||||
@ -2140,8 +2166,6 @@ Options:::
|
||||
* `"m"`
|
||||
* `"g"`
|
||||
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
@ -3408,6 +3432,35 @@ Options:::
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-indices-recovery-master]]
|
||||
=== `indices.recovery`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.indices.recovery([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/indices-recovery.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`detailed`::
|
||||
`Boolean` -- Whether to display detailed information about shard recovery
|
||||
`activeOnly`::
|
||||
`Boolean` -- Display only those recoveries that are currently on-going
|
||||
`human`::
|
||||
`Boolean` -- Whether to return time and byte values in human-readable format.
|
||||
`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-refresh-master]]
|
||||
=== `indices.refresh`
|
||||
|
||||
@ -3482,39 +3535,6 @@ Options:::
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-indices-snapshotindex-master]]
|
||||
=== `indices.snapshotIndex`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.indices.snapshotIndex([params, [callback]])
|
||||
--------
|
||||
|
||||
Initiate a snapshot through the gateway of one or more indices.
|
||||
|
||||
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-gateway-snapshot/.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"`
|
||||
|
||||
`index`::
|
||||
`String, String[], Boolean` -- A comma-separated list of index names; use `_all` or empty string for all indices
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-indices-stats-master]]
|
||||
=== `indices.stats`
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ module.exports = {
|
||||
ignore: [
|
||||
'src/lib/connectors/jquery.js',
|
||||
'src/lib/connectors/xhr.js',
|
||||
'when'
|
||||
'bluebird'
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -45,7 +45,7 @@ module.exports = {
|
||||
ignore: [
|
||||
'src/lib/connectors/angular.js',
|
||||
'src/lib/connectors/xhr.js',
|
||||
'when'
|
||||
'bluebird'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ module.exports = {
|
||||
'http://127.0.0.1:8000/builds.html'
|
||||
],
|
||||
testname: 'es.js client tests',
|
||||
build: process.env.CI_BUILD_NUMBER,
|
||||
build: process.env.TRAVIS_BUILD_ID,
|
||||
concurrency: 10,
|
||||
username: slk.user,
|
||||
key: slk.key,
|
||||
|
||||
10
package.json
10
package.json
@ -21,11 +21,11 @@
|
||||
},
|
||||
"supported_es_branches": [
|
||||
"master",
|
||||
"1.x",
|
||||
"1.1",
|
||||
"1.0",
|
||||
"0.90"
|
||||
],
|
||||
"default_api_branch": "1.0"
|
||||
"default_api_branch": "1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~1.14.0",
|
||||
@ -60,16 +60,16 @@
|
||||
"expect.js": "~0.2.0",
|
||||
"aliasify": "~1.2.4",
|
||||
"express": "~3.4.7",
|
||||
"grunt-saucelabs": "git://github.com/spenceralger/grunt-saucelabs.git",
|
||||
"find-root": "~0.1.1",
|
||||
"event-stream": "~3.1.0"
|
||||
"event-stream": "~3.1.0",
|
||||
"grunt-saucelabs": "^5.1.0"
|
||||
},
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
"chalk": "~0.4",
|
||||
"forever-agent": "0.5.2",
|
||||
"lodash-node": "~2.4",
|
||||
"when": "~2.8"
|
||||
"bluebird": "^1.1.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@ -54,6 +54,12 @@ var eventElementsPerBulk = eventsPerBulk * 2; // events are stored next to their
|
||||
function createIndex(indexName, done) {
|
||||
console.log('made index', indexName);
|
||||
var indexBody = {
|
||||
settings: {
|
||||
index: {
|
||||
number_of_shards: 1,
|
||||
number_of_replicas: 0
|
||||
}
|
||||
},
|
||||
mappings: {
|
||||
_default_: {
|
||||
properties: {
|
||||
|
||||
@ -3258,7 +3258,7 @@ api.indices.prototype.segments = ca({
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.snapshotIndex](http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/indices-gateway-snapshot.html) request
|
||||
* Perform a [indices.snapshotIndex](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-gateway-snapshot.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)
|
||||
|
||||
@ -502,7 +502,6 @@ api.cat.prototype.plugins = ca({
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {String} params.bytes - The unit in which to display byte values
|
||||
* @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node
|
||||
* @param {String, String[], Boolean} params.h - Comma-separated list of column names to display
|
||||
* @param {Boolean} params.help - Return help information
|
||||
@ -520,9 +519,6 @@ api.cat.prototype.recovery = ca({
|
||||
'g'
|
||||
]
|
||||
},
|
||||
local: {
|
||||
type: 'boolean'
|
||||
},
|
||||
masterTimeout: {
|
||||
type: 'time',
|
||||
name: 'master_timeout'
|
||||
@ -3204,6 +3200,46 @@ api.indices.prototype.putWarmer = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.recovery](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-recovery.html) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {Boolean} params.detailed - Whether to display detailed information about shard recovery
|
||||
* @param {Boolean} params.activeOnly - Display only those recoveries that are currently on-going
|
||||
* @param {Boolean} params.human - Whether to return time and byte values in human-readable format.
|
||||
* @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.recovery = ca({
|
||||
params: {
|
||||
detailed: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
activeOnly: {
|
||||
type: 'boolean',
|
||||
'default': false,
|
||||
name: 'active_only'
|
||||
},
|
||||
human: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/_recovery',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_recovery'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.refresh](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-refresh.html) request
|
||||
*
|
||||
@ -4730,6 +4766,41 @@ api.search = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-search.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 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({
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/<%=type%>/_search/template',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
},
|
||||
type: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/<%=index%>/_search/template',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_search/template'
|
||||
}
|
||||
],
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
api.snapshot = function SnapshotNS(transport) {
|
||||
this.transport = transport;
|
||||
};
|
||||
@ -502,7 +502,6 @@ api.cat.prototype.plugins = ca({
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {String} params.bytes - The unit in which to display byte values
|
||||
* @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node
|
||||
* @param {String, String[], Boolean} params.h - Comma-separated list of column names to display
|
||||
* @param {Boolean} params.help - Return help information
|
||||
@ -520,9 +519,6 @@ api.cat.prototype.recovery = ca({
|
||||
'g'
|
||||
]
|
||||
},
|
||||
local: {
|
||||
type: 'boolean'
|
||||
},
|
||||
masterTimeout: {
|
||||
type: 'time',
|
||||
name: 'master_timeout'
|
||||
@ -3204,6 +3200,46 @@ api.indices.prototype.putWarmer = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.recovery](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-recovery.html) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {Boolean} params.detailed - Whether to display detailed information about shard recovery
|
||||
* @param {Boolean} params.activeOnly - Display only those recoveries that are currently on-going
|
||||
* @param {Boolean} params.human - Whether to return time and byte values in human-readable format.
|
||||
* @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.recovery = ca({
|
||||
params: {
|
||||
detailed: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
activeOnly: {
|
||||
type: 'boolean',
|
||||
'default': false,
|
||||
name: 'active_only'
|
||||
},
|
||||
human: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/_recovery',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_recovery'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.refresh](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-refresh.html) request
|
||||
*
|
||||
@ -3311,51 +3347,6 @@ api.indices.prototype.segments = ca({
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.snapshotIndex](http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/indices-gateway-snapshot.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, String[], Boolean} params.index - A comma-separated list of index names; use `_all` or empty string for all indices
|
||||
*/
|
||||
api.indices.prototype.snapshotIndex = 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'
|
||||
}
|
||||
},
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/_gateway/snapshot',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_gateway/snapshot'
|
||||
}
|
||||
],
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [indices.stats](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-stats.html) request
|
||||
*
|
||||
@ -4730,6 +4721,41 @@ api.search = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-search.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 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({
|
||||
urls: [
|
||||
{
|
||||
fmt: '/<%=index%>/<%=type%>/_search/template',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
},
|
||||
type: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/<%=index%>/_search/template',
|
||||
req: {
|
||||
index: {
|
||||
type: 'list'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fmt: '/_search/template'
|
||||
}
|
||||
],
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
api.snapshot = function SnapshotNS(transport) {
|
||||
this.transport = transport;
|
||||
};
|
||||
|
||||
@ -7,7 +7,7 @@ module.exports = Transport;
|
||||
var _ = require('./utils');
|
||||
var errors = require('./errors');
|
||||
var Host = require('./host');
|
||||
var when = require('when');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
function Transport(config) {
|
||||
var self = this;
|
||||
@ -96,7 +96,7 @@ Transport.nodesToHostCallbacks = {
|
||||
};
|
||||
|
||||
Transport.prototype.defer = function () {
|
||||
return when.defer();
|
||||
return Promise.defer();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
55
test/fixtures/keepalive.js
vendored
55
test/fixtures/keepalive.js
vendored
@ -1,38 +1,41 @@
|
||||
var clock = require('sinon').useFakeTimers();
|
||||
var elasticsearch = require('../../src/elasticsearch');
|
||||
var _ = require('lodash-node');
|
||||
var clock = require('sinon').useFakeTimers();
|
||||
var times = require('async').times;
|
||||
|
||||
var es = elasticsearch.Client({
|
||||
host: 'localhost:5555',
|
||||
host: 'no-a-real-host-for-sure.bike:5555',
|
||||
log: false
|
||||
});
|
||||
|
||||
es.search({
|
||||
index: '_all',
|
||||
type: '_all',
|
||||
body: {
|
||||
query: {
|
||||
match_all: {}
|
||||
times(100, function (i, done) {
|
||||
es.search({
|
||||
index: '_all',
|
||||
type: '_all',
|
||||
body: {
|
||||
query: {
|
||||
match_all: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, function (err, resp) {
|
||||
var conn = _.union(es.transport.connectionPool._conns.dead, es.transport.connectionPool._conns.alive).pop();
|
||||
}, _.partial(done, null)); // ignore errors
|
||||
clock.tick(10);
|
||||
}, function () {
|
||||
var sockets = _(es.transport.connectionPool._conns.dead)
|
||||
.concat(es.transport.connectionPool._conns.alive)
|
||||
.transform(function (sockets, conn) {
|
||||
[].push.apply(sockets, _.values(conn.agent.sockets));
|
||||
[].push.apply(sockets, _.values(conn.agent.freeSockets));
|
||||
}, [])
|
||||
.flatten()
|
||||
.value();
|
||||
|
||||
es.close();
|
||||
|
||||
if (_.size(clock.timeouts)) {
|
||||
console.log('Timeouts were left behind');
|
||||
console.log(clock);
|
||||
}
|
||||
|
||||
clock.restore();
|
||||
|
||||
var destroyedSockets = 0;
|
||||
function countDestroyed(sockets) {
|
||||
destroyedSockets += _.where(sockets, { destroyed: true}).length;
|
||||
}
|
||||
_.each(conn.agent.sockets, countDestroyed);
|
||||
_.each(conn.agent.freeSockets, countDestroyed);
|
||||
console.log(destroyedSockets);
|
||||
var out = {
|
||||
socketCount: sockets.length,
|
||||
remaining: _.where(sockets, { destroyed: true }).length - sockets.length,
|
||||
timeouts: _.size(clock.timeouts)
|
||||
};
|
||||
process.connected ? process.send(out) : console.log(out);
|
||||
});
|
||||
|
||||
clock.tick(1);
|
||||
@ -11,6 +11,8 @@ var _ = require('../../../src/lib/utils');
|
||||
var expect = require('expect.js');
|
||||
var clientManager = require('./client_manager');
|
||||
|
||||
var implementedFeatures = ['gtelte', 'regex'];
|
||||
|
||||
/**
|
||||
* The version that ES is running, in comparable string form XXX-XXX-XXX, fetched when needed
|
||||
* @type {String}
|
||||
@ -114,7 +116,7 @@ function YamlDoc(doc, file) {
|
||||
var method = self['do_' + action.name];
|
||||
|
||||
// check that it's a function
|
||||
expect(method).to.be.a('function');
|
||||
expect(method || 'YamlDoc#' + action.name).to.be.a('function');
|
||||
|
||||
if (_.isPlainObject(action.args)) {
|
||||
action.name += '(' + JSON.stringify(action.args) + ')';
|
||||
@ -260,24 +262,39 @@ YamlDoc.prototype = {
|
||||
* @param done
|
||||
*/
|
||||
do_skip: function (args, done) {
|
||||
if (!args.version) {
|
||||
return done();
|
||||
if (args.version) {
|
||||
return rangeMatchesCurrentVersion(args.version, _.bind(function (match) {
|
||||
if (match) {
|
||||
if (this.description === 'setup') {
|
||||
this.file.skipping = true;
|
||||
// console.log('skipping this file' + (args.reason ? ' because ' + args.reason : ''));
|
||||
} else {
|
||||
this.skipping = true;
|
||||
// console.log('skipping the rest of this doc' + (args.reason ? ' because ' + args.reason : ''));
|
||||
}
|
||||
} else {
|
||||
this.skipping = false;
|
||||
this.file.skipping = false;
|
||||
}
|
||||
done();
|
||||
}, this));
|
||||
}
|
||||
rangeMatchesCurrentVersion(args.version, _.bind(function (match) {
|
||||
if (match) {
|
||||
|
||||
if (args.features) {
|
||||
var features = Array.isArray(args.features) ? args.features : [args.features];
|
||||
var notImplemented = _.difference(features, implementedFeatures);
|
||||
|
||||
if (notImplemented.length) {
|
||||
if (this.description === 'setup') {
|
||||
this.file.skipping = true;
|
||||
// console.log('skipping this file' + (args.reason ? ' because ' + args.reason : ''));
|
||||
console.log('skipping this file because ' + notImplemented.join(' & ') + ' are not implemented');
|
||||
} else {
|
||||
this.skipping = true;
|
||||
// console.log('skipping the rest of this doc' + (args.reason ? ' because ' + args.reason : ''));
|
||||
console.log('skipping the rest of this doc because ' + notImplemented.join(' & ') + ' are not implemented');
|
||||
}
|
||||
} else {
|
||||
this.skipping = false;
|
||||
this.file.skipping = false;
|
||||
}
|
||||
done();
|
||||
}, this));
|
||||
return done();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -469,6 +486,18 @@ YamlDoc.prototype = {
|
||||
}, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Test that the response field (arg key) is less than the value specified
|
||||
*
|
||||
* @param {Object} args - Hash of fields->values that need to be checked
|
||||
* @return {undefined}
|
||||
*/
|
||||
do_lte: function (args) {
|
||||
_.forOwn(args, function (num, path) {
|
||||
expect(this.get(path) <= num).to.be.ok('path: ' + path);
|
||||
}, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Test that the response field (arg key) is greater than the value specified
|
||||
*
|
||||
@ -481,6 +510,18 @@ YamlDoc.prototype = {
|
||||
}, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Test that the response field (arg key) is greater than the value specified
|
||||
*
|
||||
* @param {Object} args - Hash of fields->values that need to be checked
|
||||
* @return {undefined}
|
||||
*/
|
||||
do_gte: function (args) {
|
||||
_.forOwn(args, function (num, path) {
|
||||
expect(this.get(path) >= num).to.be.ok('path: ' + path);
|
||||
}, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Test that the response field (arg key) has a length equal to that specified.
|
||||
* For object values, checks the length of the keys.
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
var specDir = __dirname + '/specs';
|
||||
require('bluebird').longStackTraces();
|
||||
|
||||
var specDir = __dirname + '/specs';
|
||||
require('fs').readdirSync(specDir).forEach(function (file) {
|
||||
require(specDir + '/' + file);
|
||||
});
|
||||
@ -21,20 +21,20 @@ describe('Client instances creation', function () {
|
||||
}).to.throwError(/previous "elasticsearch" module/);
|
||||
});
|
||||
|
||||
it('inherits the 0.90 API by default', function () {
|
||||
expect(client.bulk).to.eql(apis['0.90'].bulk);
|
||||
expect(client.cluster.nodeStats).to.eql(apis['0.90'].cluster.prototype.nodeStats);
|
||||
});
|
||||
|
||||
it('inherits the 1.0 API when specified', function () {
|
||||
client.close();
|
||||
client = es.Client({
|
||||
apiVersion: '1.0'
|
||||
});
|
||||
it('inherits the 1.0 API by default', function () {
|
||||
expect(client.bulk).to.eql(apis['1.0'].bulk);
|
||||
expect(client.nodes.stats).to.eql(apis['1.0'].nodes.prototype.stats);
|
||||
});
|
||||
|
||||
it('inherits the 0.90 API when specified', function () {
|
||||
client.close();
|
||||
client = es.Client({
|
||||
apiVersion: '0.90'
|
||||
});
|
||||
expect(client.bulk).to.eql(apis['0.90'].bulk);
|
||||
expect(client.cluster.nodeStats).to.eql(apis['0.90'].cluster.prototype.nodeStats);
|
||||
});
|
||||
|
||||
it('closing the client causes it\'s transport to be closed', function () {
|
||||
var called = false;
|
||||
client.transport.close = function () {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
var ca = require('../../../src/lib/client_action');
|
||||
var expect = require('expect.js');
|
||||
var _ = require('lodash-node');
|
||||
var when = require('when');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
/**
|
||||
* Creates a simple mock of the client, whose "transport" has a request
|
||||
@ -18,11 +18,11 @@ function mockClient() {
|
||||
cb(void 0, params);
|
||||
});
|
||||
} else {
|
||||
return when.resolve(params);
|
||||
return Promise.resolve(params);
|
||||
}
|
||||
},
|
||||
defer: function () {
|
||||
return when.defer();
|
||||
return Promise.defer();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -371,23 +371,21 @@ describe('Http Connector', function () {
|
||||
|
||||
describe('Connection cleanup', function () {
|
||||
it('destroys any connections created', function (done) {
|
||||
this.timeout(4000);
|
||||
this.timeout(10000);
|
||||
var cp = require('child_process');
|
||||
var path = require('path');
|
||||
var es = require('event-stream');
|
||||
|
||||
var proc = cp.spawn('node', [path.join(__dirname, '../../fixtures/keepalive.js')], {
|
||||
silent: true
|
||||
});
|
||||
var proc = cp.fork(path.join(__dirname, '../../fixtures/keepalive.js'));
|
||||
|
||||
proc.on('message', function (output) {
|
||||
proc.kill();
|
||||
|
||||
expect(output).to.have.property('remaining', 0);
|
||||
expect(output).to.have.property('timeouts', 0);
|
||||
|
||||
es.merge(
|
||||
proc.stdout,
|
||||
proc.stderr
|
||||
).pipe(es.wait(function (err, output) {
|
||||
expect(err).to.eql(null);
|
||||
expect(parseInt(output.trim(), 10) <= 1).to.be.ok();
|
||||
done();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
it('properly removes all elements from the socket', function () {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
var Transport = require('../../../src/lib/transport');
|
||||
var Host = require('../../../src/lib/host');
|
||||
var errors = require('../../../src/lib/errors');
|
||||
var when = require('when');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
var sinon = require('sinon');
|
||||
var expect = require('expect.js');
|
||||
@ -213,7 +213,7 @@ describe('Transport Class', function () {
|
||||
|
||||
describe('#defer', function () {
|
||||
it('returns a when.js promise by default', function () {
|
||||
expect(Transport.prototype.defer().constructor).to.be(when.defer().constructor);
|
||||
expect(Transport.prototype.defer().constructor).to.be(Promise.defer().constructor);
|
||||
});
|
||||
});
|
||||
|
||||
@ -513,8 +513,9 @@ describe('Transport Class', function () {
|
||||
var tran = new Transport();
|
||||
shortCircuitRequest(tran);
|
||||
var ret = tran.request({});
|
||||
expect(when.isPromise(ret)).to.be(true);
|
||||
expect(Promise.is(ret)).to.be(true);
|
||||
expect(ret.abort).to.be.a('function');
|
||||
ret.then(_.noop, _.noop); // prevent complaining from bluebird
|
||||
});
|
||||
it('promise is always pulled from the defer created by this.defer()', function () {
|
||||
var fakePromise = {};
|
||||
@ -591,7 +592,9 @@ describe('Transport Class', function () {
|
||||
var tran = new Transport({});
|
||||
var err;
|
||||
|
||||
tran.request({});
|
||||
var prom = tran.request({});
|
||||
// disregard promise, prevent bluebird's warnings
|
||||
prom.then(_.noop, _.noop);
|
||||
|
||||
expect(_.size(clock.timeouts)).to.eql(1);
|
||||
_.each(clock.timeouts, function (timer, id) {
|
||||
@ -607,7 +610,9 @@ describe('Transport Class', function () {
|
||||
});
|
||||
var err;
|
||||
|
||||
tran.request({});
|
||||
var prom = tran.request({});
|
||||
// disregard promise, prevent bluebird's warnings
|
||||
prom.then(_.noop, _.noop);
|
||||
|
||||
expect(_.size(clock.timeouts)).to.eql(1);
|
||||
_.each(clock.timeouts, function (timer, id) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
var Transport = require('../../../src/lib/transport');
|
||||
var Host = require('../../../src/lib/host');
|
||||
var errors = require('../../../src/lib/errors');
|
||||
var when = require('when');
|
||||
var expect = require('expect.js');
|
||||
|
||||
var sinon = require('sinon');
|
||||
@ -254,7 +253,7 @@ describe('Transport + Mock server', function () {
|
||||
good: 'day'
|
||||
});
|
||||
done();
|
||||
});
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user