From 151124f922bd03166bcda3355fbf1ffd00ef863c Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 13 Aug 2014 10:11:25 -0700 Subject: [PATCH] updated api's to latest --- docs/api_methods.asciidoc | 2 +- docs/api_methods_0_90.asciidoc | 2 +- docs/api_methods_1_0.asciidoc | 2 +- docs/api_methods_1_1.asciidoc | 2 +- docs/api_methods_1_2.asciidoc | 2 +- src/lib/apis/1_x.js | 97 ++++++++++++++++++++++++++++++++++ src/lib/apis/master.js | 97 ++++++++++++++++++++++++++++++++++ 7 files changed, 199 insertions(+), 5 deletions(-) diff --git a/docs/api_methods.asciidoc b/docs/api_methods.asciidoc index 819d571f7..0fc5491c5 100644 --- a/docs/api_methods.asciidoc +++ b/docs/api_methods.asciidoc @@ -1594,7 +1594,7 @@ client.search([params, [callback]]) Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html[simple query strings] in the `q` parameter, or by specifying a http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-body.html[full request definition] using the http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html[Elasticsearch Query DSL] in the `body` parameter. -TIP: https://github.com/fullscale/elastic.js[elastic.js] can be used to make building query bodies easier. +TIP: https://github.com/fullscale/elastic.js[elastic.js] or https://github.com/holidayextras/esq[esq] can be used to make building query bodies easier. diff --git a/docs/api_methods_0_90.asciidoc b/docs/api_methods_0_90.asciidoc index d21bb7852..734a2b4be 100644 --- a/docs/api_methods_0_90.asciidoc +++ b/docs/api_methods_0_90.asciidoc @@ -1175,7 +1175,7 @@ client.search([params, [callback]]) Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html[simple query strings] in the `q` parameter, or by specifying a http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-body.html[full request definition] using the http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html[Elasticsearch Query DSL] in the `body` parameter. -TIP: https://github.com/fullscale/elastic.js[elastic.js] can be used to make building query bodies easier. +TIP: https://github.com/fullscale/elastic.js[elastic.js] or https://github.com/holidayextras/esq[esq] can be used to make building query bodies easier. diff --git a/docs/api_methods_1_0.asciidoc b/docs/api_methods_1_0.asciidoc index a0f9fedeb..c1f1f5045 100644 --- a/docs/api_methods_1_0.asciidoc +++ b/docs/api_methods_1_0.asciidoc @@ -1376,7 +1376,7 @@ client.search([params, [callback]]) Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html[simple query strings] in the `q` parameter, or by specifying a http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-body.html[full request definition] using the http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html[Elasticsearch Query DSL] in the `body` parameter. -TIP: https://github.com/fullscale/elastic.js[elastic.js] can be used to make building query bodies easier. +TIP: https://github.com/fullscale/elastic.js[elastic.js] or https://github.com/holidayextras/esq[esq] can be used to make building query bodies easier. diff --git a/docs/api_methods_1_1.asciidoc b/docs/api_methods_1_1.asciidoc index fd3900892..3d2673b9b 100644 --- a/docs/api_methods_1_1.asciidoc +++ b/docs/api_methods_1_1.asciidoc @@ -1394,7 +1394,7 @@ client.search([params, [callback]]) Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html[simple query strings] in the `q` parameter, or by specifying a http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-body.html[full request definition] using the http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html[Elasticsearch Query DSL] in the `body` parameter. -TIP: https://github.com/fullscale/elastic.js[elastic.js] can be used to make building query bodies easier. +TIP: https://github.com/fullscale/elastic.js[elastic.js] or https://github.com/holidayextras/esq[esq] can be used to make building query bodies easier. diff --git a/docs/api_methods_1_2.asciidoc b/docs/api_methods_1_2.asciidoc index 5d1ff95b2..40fa64c5e 100644 --- a/docs/api_methods_1_2.asciidoc +++ b/docs/api_methods_1_2.asciidoc @@ -1444,7 +1444,7 @@ client.search([params, [callback]]) Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html[simple query strings] in the `q` parameter, or by specifying a http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-body.html[full request definition] using the http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html[Elasticsearch Query DSL] in the `body` parameter. -TIP: https://github.com/fullscale/elastic.js[elastic.js] can be used to make building query bodies easier. +TIP: https://github.com/fullscale/elastic.js[elastic.js] or https://github.com/holidayextras/esq[esq] can be used to make building query bodies easier. diff --git a/src/lib/apis/1_x.js b/src/lib/apis/1_x.js index 931061236..cb12ae729 100644 --- a/src/lib/apis/1_x.js +++ b/src/lib/apis/1_x.js @@ -1992,6 +1992,7 @@ api.indices.prototype.analyze = ca({ * @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 name to limit the operation * @param {Boolean} params.recycler - Clear the recycler cache + * @param {Boolean} params.queryCache - Clear query cache */ api.indices.prototype.clearCache = ca({ params: { @@ -2045,6 +2046,10 @@ api.indices.prototype.clearCache = ca({ }, recycler: { type: 'boolean' + }, + queryCache: { + type: 'boolean', + name: 'query_cache' } }, urls: [ @@ -3627,6 +3632,7 @@ api.indices.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -3654,6 +3660,7 @@ api.indices.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -4520,6 +4527,7 @@ api.nodes.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -4587,6 +4595,7 @@ api.nodes.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -4850,6 +4859,7 @@ api.scroll = ca({ * @param {Date, Number} params.timeout - Explicit operation timeout * @param {Boolean} params.trackScores - Whether to calculate and return scores even if they are not used for sorting * @param {Boolean} params.version - Specify whether to return document version as part of a hit + * @param {Boolean} params.queryCache - Specify if query cache should be used for this request or not, defaults to index level setting * @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 */ @@ -4989,6 +4999,10 @@ api.search = ca({ }, version: { type: 'boolean' + }, + queryCache: { + type: 'boolean', + name: 'query_cache' } }, urls: [ @@ -5018,6 +5032,80 @@ api.search = ca({ method: 'POST' }); +/** + * Perform a [searchExists](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/exists.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 {Number} params.minScore - Include only documents with a specific `_score` value in the result + * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) + * @param {String} params.routing - Specific routing value + * @param {String} params.source - The URL-encoded query definition (instead of using the request body) + * @param {String, String[], Boolean} params.index - A comma-separated list of indices to restrict the results + * @param {String, String[], Boolean} params.type - A comma-separated list of types to restrict the results + */ +api.searchExists = 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' + }, + minScore: { + type: 'number', + name: 'min_score' + }, + preference: { + type: 'string' + }, + routing: { + type: 'string' + }, + source: { + type: 'string' + } + }, + urls: [ + { + fmt: '/<%=index%>/<%=type%>/_search/exists', + req: { + index: { + type: 'list' + }, + type: { + type: 'list' + } + } + }, + { + fmt: '/<%=index%>/_search/exists', + req: { + index: { + type: 'list' + } + } + }, + { + fmt: '/_search/exists' + } + ], + method: 'POST' +}); + /** * Perform a [searchShards](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html) request * @@ -5584,6 +5672,8 @@ api.termvector = ca({ * @param {Number} params.retryOnConflict - Specify how many times should the operation be retried when a conflict occurs (default: 0) * @param {String} params.routing - Specific routing value * @param {Anything} params.script - The URL-encoded script definition (instead of using request body) + * @param {Anything} params.scriptId - The id of a stored script + * @param {Boolean} params.scriptedUpsert - True if the script referenced in script or script_id should be called to perform inserts - defaults to false * @param {Date, Number} params.timeout - Explicit operation timeout * @param {Date, Number} params.timestamp - Explicit timestamp for the document * @param {Duration} params.ttl - Expiration time for the document @@ -5631,6 +5721,13 @@ api.update = ca({ type: 'string' }, script: {}, + scriptId: { + name: 'script_id' + }, + scriptedUpsert: { + type: 'boolean', + name: 'scripted_upsert' + }, timeout: { type: 'time' }, diff --git a/src/lib/apis/master.js b/src/lib/apis/master.js index 62b723790..ed7fae46f 100644 --- a/src/lib/apis/master.js +++ b/src/lib/apis/master.js @@ -1992,6 +1992,7 @@ api.indices.prototype.analyze = ca({ * @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 name to limit the operation * @param {Boolean} params.recycler - Clear the recycler cache + * @param {Boolean} params.queryCache - Clear query cache */ api.indices.prototype.clearCache = ca({ params: { @@ -2045,6 +2046,10 @@ api.indices.prototype.clearCache = ca({ }, recycler: { type: 'boolean' + }, + queryCache: { + type: 'boolean', + name: 'query_cache' } }, urls: [ @@ -3627,6 +3632,7 @@ api.indices.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -3654,6 +3660,7 @@ api.indices.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -4459,6 +4466,7 @@ api.nodes.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -4526,6 +4534,7 @@ api.nodes.prototype.stats = ca({ 'indexing', 'merge', 'percolate', + 'query_cache', 'refresh', 'search', 'segments', @@ -4796,6 +4805,7 @@ api.scroll = ca({ * @param {Date, Number} params.timeout - Explicit operation timeout * @param {Boolean} params.trackScores - Whether to calculate and return scores even if they are not used for sorting * @param {Boolean} params.version - Specify whether to return document version as part of a hit + * @param {Boolean} params.queryCache - Specify if query cache should be used for this request or not, defaults to index level setting * @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 */ @@ -4931,6 +4941,10 @@ api.search = ca({ }, version: { type: 'boolean' + }, + queryCache: { + type: 'boolean', + name: 'query_cache' } }, urls: [ @@ -4960,6 +4974,80 @@ api.search = ca({ method: 'POST' }); +/** + * Perform a [searchExists](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/exists.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 {Number} params.minScore - Include only documents with a specific `_score` value in the result + * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) + * @param {String} params.routing - Specific routing value + * @param {String} params.source - The URL-encoded query definition (instead of using the request body) + * @param {String, String[], Boolean} params.index - A comma-separated list of indices to restrict the results + * @param {String, String[], Boolean} params.type - A comma-separated list of types to restrict the results + */ +api.searchExists = 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' + }, + minScore: { + type: 'number', + name: 'min_score' + }, + preference: { + type: 'string' + }, + routing: { + type: 'string' + }, + source: { + type: 'string' + } + }, + urls: [ + { + fmt: '/<%=index%>/<%=type%>/_search/exists', + req: { + index: { + type: 'list' + }, + type: { + type: 'list' + } + } + }, + { + fmt: '/<%=index%>/_search/exists', + req: { + index: { + type: 'list' + } + } + }, + { + fmt: '/_search/exists' + } + ], + method: 'POST' +}); + /** * Perform a [searchShards](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html) request * @@ -5526,6 +5614,8 @@ api.termvector = ca({ * @param {Number} params.retryOnConflict - Specify how many times should the operation be retried when a conflict occurs (default: 0) * @param {String} params.routing - Specific routing value * @param {Anything} params.script - The URL-encoded script definition (instead of using request body) + * @param {Anything} params.scriptId - The id of a stored script + * @param {Boolean} params.scriptedUpsert - True if the script referenced in script or script_id should be called to perform inserts - defaults to false * @param {Date, Number} params.timeout - Explicit operation timeout * @param {Date, Number} params.timestamp - Explicit timestamp for the document * @param {Duration} params.ttl - Expiration time for the document @@ -5573,6 +5663,13 @@ api.update = ca({ type: 'string' }, script: {}, + scriptId: { + name: 'script_id' + }, + scriptedUpsert: { + type: 'boolean', + name: 'scripted_upsert' + }, timeout: { type: 'time' },