added 1.3 API and set that as the default apiVersion

This commit is contained in:
Spencer Alger
2014-07-16 08:10:54 -07:00
parent afe53081d7
commit 075c1b7fc2
13 changed files with 10071 additions and 60 deletions

View File

@ -1,5 +1,8 @@
# elasticsearch-js changelog
## 2.4 (Jul ?? 2014)
- Added apiVersion `"1.3"`, which is now the default
## 2.3 (Jul 11 2014)
- Added support for Node 0.11
- Updated `bluebird`, which modified the [promise api](https://github.com/petkaantonov/bluebird/blob/v2.2.1/API.md) somewhat

View File

@ -52,7 +52,7 @@ Check out the [Browser Builds](http://www.elasticsearch.org/guide/en/elasticsear
## Supported Elasticsearch Versions
[![Supporting Elasticsearch Version 0.90 to 1.2](http://img.shields.io/badge/elasticsearch-0.90--1.2-green.svg)](http://build.elasticsearch.com/job/es-js_nightly/)
[![Supporting Elasticsearch Version 0.90 to 1.3](http://img.shields.io/badge/elasticsearch-0.90--1.3-green.svg)](http://build.elasticsearch.com/job/es-js_nightly/)
Elasticsearch.js provides support for, and is regularly tested against, Elasticsearch releases 0.90.12 and greater. We also test against the latest changes in several branches in the Elasticsearch repository. To tell the client which version of Elastisearch you are using, and therefore the API it should provide, set the `apiVersion` config param. [More info](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/configuration.html#_config_options)

View File

@ -1,5 +1,5 @@
[[api-reference]]
== 1.2 API
== 1.3 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.
@ -13,10 +13,14 @@ NOTE: This is currently the default API, but in upcomming versions that will cha
* <<api-create,create>>
* <<api-delete,delete>>
* <<api-deletebyquery,deleteByQuery>>
* <<api-deletescript,deleteScript>>
* <<api-deletetemplate,deleteTemplate>>
* <<api-exists,exists>>
* <<api-explain,explain>>
* <<api-get,get>>
* <<api-getscript,getScript>>
* <<api-getsource,getSource>>
* <<api-gettemplate,getTemplate>>
* <<api-index,index>>
* <<api-info,info>>
* <<api-listbenchmarks,listBenchmarks>>
@ -27,6 +31,8 @@ NOTE: This is currently the default API, but in upcomming versions that will cha
* <<api-mtermvectors,mtermvectors>>
* <<api-percolate,percolate>>
* <<api-ping,ping>>
* <<api-putscript,putScript>>
* <<api-puttemplate,putTemplate>>
* <<api-scroll,scroll>>
* <<api-search,search>>
* <<api-searchshards,searchShards>>
@ -584,6 +590,54 @@ Options:::
link:#[back to top]
[[api-deletescript]]
=== `deleteScript`
[source,js]
--------
client.deleteScript([params, [callback]])
--------
// no description
The default method is `DELETE` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`id`::
`String` -- Script ID
`lang`::
`String` -- Script language
link:#[back to top]
[[api-deletetemplate]]
=== `deleteTemplate`
[source,js]
--------
client.deleteTemplate([params, [callback]])
--------
// no description
The default method is `DELETE` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`id`::
`String` -- Template ID
link:#[back to top]
[[api-exists]]
=== `exists`
@ -792,6 +846,31 @@ Options:::
link:#[back to top]
[[api-getscript]]
=== `getScript`
[source,js]
--------
client.getScript([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-scripting.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`id`::
`String` -- Script ID
`lang`::
`String` -- Script language
link:#[back to top]
[[api-getsource]]
=== `getSource`
@ -845,6 +924,29 @@ Options:::
link:#[back to top]
[[api-gettemplate]]
=== `getTemplate`
[source,js]
--------
client.getTemplate([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-template.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`id`::
`String` -- Template ID
link:#[back to top]
[[api-index]]
=== `index`
@ -1381,6 +1483,54 @@ The default method is `HEAD` and the usual <<api-conventions,params and return v
[[api-putscript]]
=== `putScript`
[source,js]
--------
client.putScript([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/modules-scripting.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`id`::
`String` -- Script ID
`lang`::
`String` -- Script language
link:#[back to top]
[[api-puttemplate]]
=== `putTemplate`
[source,js]
--------
client.putTemplate([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-template.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`id`::
`String` -- Template ID
link:#[back to top]
[[api-scroll]]
=== `scroll`
@ -3542,6 +3692,8 @@ The default method is `PUT` and the usual <<api-conventions,params and return va
[horizontal]
`order`::
`Number` -- The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)
`create`::
`Boolean` -- Whether the index template should only be added if new or can also replace an existing one
`timeout`::
`Date, Number` -- Explicit operation timeout
`masterTimeout`::

File diff suppressed because it is too large Load Diff

View File

@ -51,9 +51,10 @@ Default in Node:::
+
WARNING: This default will track the latest version of Elasticsearch, and is only intended to be used during development. It is highly recommended that you set this parameter in all code that is headed to production.
Default ::: `"1.2"`
Default ::: `"1.3"`
Options in node :::
* `"1.3"`
* `"1.2"`
* `"1.1"`
* `"1.0"`
@ -62,9 +63,9 @@ Options in node :::
* `"1.x"` (unstable)
Options in the browser :::
* `"1.3"`
* `"1.2"`
* `"1.1"`
* `"1.0"`

View File

@ -20,6 +20,7 @@
"pattern": "specified in test/unit/coverage.js"
},
"supported_es_branches": [
"1.3",
"1.2",
"1.1",
"1.0",
@ -29,7 +30,7 @@
"master",
"1.x"
],
"default_api_branch": "1.2"
"default_api_branch": "1.3"
},
"devDependencies": {
"mocha": "^1.18.2",

View File

@ -75,6 +75,7 @@ function manage_es {
if [[ $ES_BRANCH == "master" ]]; then local JDK='JDK7'
elif [[ $ES_BRANCH == "1.x" ]]; then local JDK='JDK7'
elif [[ $ES_BRANCH == "1.2" ]]; then local JDK='JDK7'
elif [[ $ES_BRANCH == "1.3" ]]; then local JDK='JDK7'
else local JDK='JDK6'
fi

5648
src/lib/apis/1_3.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
var ca = require('../client_action');
var api = module.exports = {};
api._namespaces = ['cat', 'cluster', 'indexedScript', 'indexedTemplate', 'indices', 'nodes', 'snapshot'];
api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot'];
/**
* Perform a [abortBenchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
@ -1826,20 +1826,16 @@ api.index = ca({
method: 'POST'
});
api.indexedScript = function IndexedScriptNS(transport) {
this.transport = transport;
};
/**
* Perform a [indexedScript.create](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [putScript](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Script ID
* @param {String} params.lang - Script language
*/
api.indexedScript.prototype.create = ca({
api.putScript = ca({
url: {
fmt: '/_search/script/<%=lang%>/<%=id%>',
fmt: '/_scripts/<%=lang%>/<%=id%>',
req: {
lang: {
type: 'string'
@ -1850,19 +1846,19 @@ api.indexedScript.prototype.create = ca({
}
},
needBody: true,
method: 'POST'
method: 'PUT'
});
/**
* Perform a [indexedScript.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [deleteScript](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Script ID
* @param {String} params.lang - Script language
*/
api.indexedScript.prototype['delete'] = ca({
api.deleteScript = ca({
url: {
fmt: '/_search/script/<%=lang%>/<%=id%>',
fmt: '/_scripts/<%=lang%>/<%=id%>',
req: {
lang: {
type: 'string'
@ -1876,15 +1872,15 @@ api.indexedScript.prototype['delete'] = ca({
});
/**
* Perform a [indexedScript.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [getScript](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Script ID
* @param {String} params.lang - Script language
*/
api.indexedScript.prototype.get = ca({
api.getScript = ca({
url: {
fmt: '/_search/script/<%=lang%>/<%=id%>',
fmt: '/_scripts/<%=lang%>/<%=id%>',
req: {
lang: {
type: 'string'
@ -1896,17 +1892,13 @@ api.indexedScript.prototype.get = ca({
}
});
api.indexedTemplate = function IndexedTemplateNS(transport) {
this.transport = transport;
};
/**
* Perform a [indexedTemplate.create](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [putTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Template ID
*/
api.indexedTemplate.prototype.create = ca({
api.putTemplate = ca({
url: {
fmt: '/_search/template/<%=id%>',
req: {
@ -1916,16 +1908,16 @@ api.indexedTemplate.prototype.create = ca({
}
},
needBody: true,
method: 'POST'
method: 'PUT'
});
/**
* Perform a [indexedTemplate.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [deleteTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Template ID
*/
api.indexedTemplate.prototype['delete'] = ca({
api.deleteTemplate = ca({
url: {
fmt: '/_search/template/<%=id%>',
req: {
@ -1938,12 +1930,12 @@ api.indexedTemplate.prototype['delete'] = ca({
});
/**
* Perform a [indexedTemplate.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [getTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Template ID
*/
api.indexedTemplate.prototype.get = ca({
api.getTemplate = ca({
url: {
fmt: '/_search/template/<%=id%>',
req: {

View File

@ -1,5 +1,5 @@
module.exports = {
'1.3': require('./1_3'),
'1.2': require('./1_2'),
'1.1': require('./1_1'),
'1.0': require('./1_0')
'1.1': require('./1_1')
};

View File

@ -1,6 +1,7 @@
module.exports = {
'master': require('./master'),
'1.x': require('./1_x'),
'1.3': require('./1_3'),
'1.2': require('./1_2'),
'1.1': require('./1_1'),
'1.0': require('./1_0'),

View File

@ -3,7 +3,7 @@
var ca = require('../client_action');
var api = module.exports = {};
api._namespaces = ['cat', 'cluster', 'indexedScript', 'indexedTemplate', 'indices', 'nodes', 'snapshot'];
api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot'];
/**
* Perform a [abortBenchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request
@ -1826,20 +1826,16 @@ api.index = ca({
method: 'POST'
});
api.indexedScript = function IndexedScriptNS(transport) {
this.transport = transport;
};
/**
* Perform a [indexedScript.create](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [putScript](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Script ID
* @param {String} params.lang - Script language
*/
api.indexedScript.prototype.create = ca({
api.putScript = ca({
url: {
fmt: '/_search/script/<%=lang%>/<%=id%>',
fmt: '/_scripts/<%=lang%>/<%=id%>',
req: {
lang: {
type: 'string'
@ -1850,19 +1846,19 @@ api.indexedScript.prototype.create = ca({
}
},
needBody: true,
method: 'POST'
method: 'PUT'
});
/**
* Perform a [indexedScript.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [deleteScript](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Script ID
* @param {String} params.lang - Script language
*/
api.indexedScript.prototype['delete'] = ca({
api.deleteScript = ca({
url: {
fmt: '/_search/script/<%=lang%>/<%=id%>',
fmt: '/_scripts/<%=lang%>/<%=id%>',
req: {
lang: {
type: 'string'
@ -1876,15 +1872,15 @@ api.indexedScript.prototype['delete'] = ca({
});
/**
* Perform a [indexedScript.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [getScript](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-scripting.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Script ID
* @param {String} params.lang - Script language
*/
api.indexedScript.prototype.get = ca({
api.getScript = ca({
url: {
fmt: '/_search/script/<%=lang%>/<%=id%>',
fmt: '/_scripts/<%=lang%>/<%=id%>',
req: {
lang: {
type: 'string'
@ -1896,17 +1892,13 @@ api.indexedScript.prototype.get = ca({
}
});
api.indexedTemplate = function IndexedTemplateNS(transport) {
this.transport = transport;
};
/**
* Perform a [indexedTemplate.create](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [putTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Template ID
*/
api.indexedTemplate.prototype.create = ca({
api.putTemplate = ca({
url: {
fmt: '/_search/template/<%=id%>',
req: {
@ -1916,16 +1908,16 @@ api.indexedTemplate.prototype.create = ca({
}
},
needBody: true,
method: 'POST'
method: 'PUT'
});
/**
* Perform a [indexedTemplate.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [deleteTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Template ID
*/
api.indexedTemplate.prototype['delete'] = ca({
api.deleteTemplate = ca({
url: {
fmt: '/_search/template/<%=id%>',
req: {
@ -1938,12 +1930,12 @@ api.indexedTemplate.prototype['delete'] = ca({
});
/**
* Perform a [indexedTemplate.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.html) request
* Perform a [getTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.id - Template ID
*/
api.indexedTemplate.prototype.get = ca({
api.getTemplate = ca({
url: {
fmt: '/_search/template/<%=id%>',
req: {

View File

@ -63,7 +63,7 @@ function Client(config) {
delete this._namespaces;
}
EsApiClient.prototype = _.funcEnum(config, 'apiVersion', Client.apis, '1.2');
EsApiClient.prototype = _.funcEnum(config, 'apiVersion', Client.apis, '1.3');
if (!config.sniffEndpoint && EsApiClient.prototype === Client.apis['0.90']) {
config.sniffEndpoint = '/_cluster/nodes';
}