From afe53081d7011cd44c18ebcf429ed96dd74db4bf Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 14 Jul 2014 15:26:39 -0700 Subject: [PATCH] updated the 1.x and master APIs --- src/lib/apis/1_x.js | 130 ++++++++++++++++++++++++++++++++++++++++- src/lib/apis/master.js | 130 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 258 insertions(+), 2 deletions(-) diff --git a/src/lib/apis/1_x.js b/src/lib/apis/1_x.js index 09c19d85e..703208a99 100644 --- a/src/lib/apis/1_x.js +++ b/src/lib/apis/1_x.js @@ -3,7 +3,7 @@ var ca = require('../client_action'); var api = module.exports = {}; -api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot']; +api._namespaces = ['cat', 'cluster', 'indexedScript', 'indexedTemplate', 'indices', 'nodes', 'snapshot']; /** * Perform a [abortBenchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request @@ -1826,6 +1826,134 @@ 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 + * + * @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({ + url: { + fmt: '/_search/script/<%=lang%>/<%=id%>', + req: { + lang: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + needBody: true, + method: 'POST' +}); + +/** + * Perform a [indexedScript.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/script/<%=lang%>/<%=id%>', + req: { + lang: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + method: 'DELETE' +}); + +/** + * Perform a [indexedScript.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/script/<%=lang%>/<%=id%>', + req: { + lang: { + type: 'string' + }, + id: { + type: 'string' + } + } + } +}); + +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 + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String} params.id - Template ID + */ +api.indexedTemplate.prototype.create = ca({ + url: { + fmt: '/_search/template/<%=id%>', + req: { + id: { + type: 'string' + } + } + }, + needBody: true, + method: 'POST' +}); + +/** + * Perform a [indexedTemplate.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/template/<%=id%>', + req: { + id: { + type: 'string' + } + } + }, + method: 'DELETE' +}); + +/** + * Perform a [indexedTemplate.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/template/<%=id%>', + req: { + id: { + type: 'string' + } + } + } +}); + api.indices = function IndicesNS(transport) { this.transport = transport; }; diff --git a/src/lib/apis/master.js b/src/lib/apis/master.js index cf83cf8ac..d31980b76 100644 --- a/src/lib/apis/master.js +++ b/src/lib/apis/master.js @@ -3,7 +3,7 @@ var ca = require('../client_action'); var api = module.exports = {}; -api._namespaces = ['cat', 'cluster', 'indices', 'nodes', 'snapshot']; +api._namespaces = ['cat', 'cluster', 'indexedScript', 'indexedTemplate', 'indices', 'nodes', 'snapshot']; /** * Perform a [abortBenchmark](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-benchmark.html) request @@ -1826,6 +1826,134 @@ 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 + * + * @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({ + url: { + fmt: '/_search/script/<%=lang%>/<%=id%>', + req: { + lang: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + needBody: true, + method: 'POST' +}); + +/** + * Perform a [indexedScript.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/script/<%=lang%>/<%=id%>', + req: { + lang: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + method: 'DELETE' +}); + +/** + * Perform a [indexedScript.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/script/<%=lang%>/<%=id%>', + req: { + lang: { + type: 'string' + }, + id: { + type: 'string' + } + } + } +}); + +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 + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String} params.id - Template ID + */ +api.indexedTemplate.prototype.create = ca({ + url: { + fmt: '/_search/template/<%=id%>', + req: { + id: { + type: 'string' + } + } + }, + needBody: true, + method: 'POST' +}); + +/** + * Perform a [indexedTemplate.delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/template/<%=id%>', + req: { + id: { + type: 'string' + } + } + }, + method: 'DELETE' +}); + +/** + * Perform a [indexedTemplate.get](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indexed-scripts.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({ + url: { + fmt: '/_search/template/<%=id%>', + req: { + id: { + type: 'string' + } + } + } +}); + api.indices = function IndicesNS(transport) { this.transport = transport; };