From ad6f56c3f1e5d763a8e5f4531e67575ddb92fc9f Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 27 Mar 2019 07:44:19 +0100 Subject: [PATCH 01/84] Doc updates (#791) Updates for better displaying the documentation in the website. --- docs/authentication.asciidoc | 8 +- docs/breaking-changes.asciidoc | 2 +- docs/child.asciidoc | 2 +- docs/configuration.asciidoc | 8 +- docs/examples/asStream.asciidoc | 1 + docs/examples/bulk.asciidoc | 3 +- docs/examples/exists.asciidoc | 3 +- docs/examples/get.asciidoc | 3 +- docs/examples/ignore.asciidoc | 1 + docs/examples/index.asciidoc | 28 ++ docs/examples/msearch.asciidoc | 3 +- docs/examples/scroll.asciidoc | 3 +- docs/examples/search.asciidoc | 3 +- docs/examples/suggest.asciidoc | 3 +- docs/examples/transport.request.asciidoc | 3 +- docs/examples/typescript.asciidoc | 3 +- docs/extend.asciidoc | 2 +- docs/index.asciidoc | 59 +-- docs/introduction.asciidoc | 52 +++ docs/reference.asciidoc | 499 ++++++++++++++++------- docs/typescript.asciidoc | 4 +- docs/usage.asciidoc | 2 +- scripts/utils/generateDocs.js | 52 ++- 23 files changed, 516 insertions(+), 231 deletions(-) create mode 100644 docs/examples/index.asciidoc create mode 100644 docs/introduction.asciidoc diff --git a/docs/authentication.asciidoc b/docs/authentication.asciidoc index 8a69cb404..bf75e5644 100644 --- a/docs/authentication.asciidoc +++ b/docs/authentication.asciidoc @@ -1,8 +1,8 @@ -= Authentication +== Authentication This document contains code snippets to show you how to connect to various Elasticsearch providers. -== Basic Auth +=== Basic Auth You can provide your credentials in the node(s) URL. @@ -29,7 +29,7 @@ const client = new Client({ }) ---- -== SSL configuration +=== SSL configuration Without any additional configuration you can specify `https://` node urls, but the certificates used to sign these requests will not verified (`rejectUnauthorized: false`). To turn on certificate verification you must specify an `ssl` object either in the top level config or in each host config object and set `rejectUnauthorized: true`. The ssl config object can contain many of the same configuration options that https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[tls.connect()] accepts. @@ -45,7 +45,7 @@ const client = new Client({ }) ---- -== Elastic Cloud +=== Elastic Cloud If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers a easy way to connect to it via the `cloud` option. + You must pass the Cloud ID that you can find in the cloud console, then your username and password. diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc index 3170fd922..724f6ed56 100644 --- a/docs/breaking-changes.asciidoc +++ b/docs/breaking-changes.asciidoc @@ -1,4 +1,4 @@ -= Breaking changes coming from the old client +== Breaking changes coming from the old client If you were already using the previous version of this client --i.e. the one you used to install with `npm install elasticsearch`-- you will encounter some breaking changes. diff --git a/docs/child.asciidoc b/docs/child.asciidoc index 74ba23185..2c58b013f 100644 --- a/docs/child.asciidoc +++ b/docs/child.asciidoc @@ -1,4 +1,4 @@ -= Creating a child client +== Creating a child client There are some use cases where you may need multiple instances of the client. You can easily do that by calling `new Client()` as many times as you need, but you will lose all the benefits of using one single client, such as the long living connections and the connection pool handling. + To avoid this problem the client offers a `child` API, which returns a new client instance that shares the connection pool with the parent client. + diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 5392cec24..60bca53cd 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -1,4 +1,4 @@ -= Client configuration +== Client configuration The client is designed to be easily configured as you see fit for your needs, following you can see all the possible basic options that you can use to configure it. @@ -14,7 +14,7 @@ const client = new Client({ }) ---- -== Basic options +=== Basic options [cols=2*] |=== |`node` or `nodes` @@ -72,7 +72,7 @@ _Default:_ `false` |`resurrectStrategy` |`string` - Configure the node resurrection strategy. + -_Options:_ `'ping'`, `'optimistic'`, `'none'` + +_Options:_ `'ping'`, `'optimistic'`, `'none'` + _Default:_ `'ping'` |`suggestCompression` @@ -122,7 +122,7 @@ function nodeSelector (connections) { ---- |=== -== Advanced configuration +=== Advanced configuration If you need to customize the client behavior heavily, you are in the right place! + The client allows you to customize the following internals: diff --git a/docs/examples/asStream.asciidoc b/docs/examples/asStream.asciidoc index 00929bab0..648f2cd06 100644 --- a/docs/examples/asStream.asciidoc +++ b/docs/examples/asStream.asciidoc @@ -1,3 +1,4 @@ +[[as_stream_examples]] == asStream Instead of getting the parsed body back, you will get the raw Node.js stream of data. diff --git a/docs/examples/bulk.asciidoc b/docs/examples/bulk.asciidoc index 93c5397c1..b7de4d37f 100644 --- a/docs/examples/bulk.asciidoc +++ b/docs/examples/bulk.asciidoc @@ -1,4 +1,5 @@ -= Bulk +[[bulk_examples]] +== Bulk The `bulk` API makes it possible to perform many index/delete operations in a single API call. + This can greatly increase the indexing speed. diff --git a/docs/examples/exists.asciidoc b/docs/examples/exists.asciidoc index 4c64287a3..dc8b42871 100644 --- a/docs/examples/exists.asciidoc +++ b/docs/examples/exists.asciidoc @@ -1,4 +1,5 @@ -= Exists +[[exists_examples]] +== Exists Check that the document `/game-of-thrones/1` exists. diff --git a/docs/examples/get.asciidoc b/docs/examples/get.asciidoc index b978bc8ce..c2fd5a61d 100644 --- a/docs/examples/get.asciidoc +++ b/docs/examples/get.asciidoc @@ -1,4 +1,5 @@ -= Get +[[get_examples]] +== Get The get API allows to get a typed JSON document from the index based on its id. + The following example gets a JSON document from an index called `game-of-thrones`, under a type called `_doc`, with id valued `'1'`. diff --git a/docs/examples/ignore.asciidoc b/docs/examples/ignore.asciidoc index d4b5a9af1..d747daae7 100644 --- a/docs/examples/ignore.asciidoc +++ b/docs/examples/ignore.asciidoc @@ -1,3 +1,4 @@ +[[ignore_examples]] == Ignore HTTP status codes which should not be considered errors for this request. diff --git a/docs/examples/index.asciidoc b/docs/examples/index.asciidoc new file mode 100644 index 000000000..747a068c6 --- /dev/null +++ b/docs/examples/index.asciidoc @@ -0,0 +1,28 @@ +[[examples]] += Examples + +Following you can find some examples on how to use the client. + +* Use of the <> parameter; +* Executing a <> request; +* Executing a <> request; +* Executing a <> request; +* Use of the <> parameter; +* Executing a <> request; +* How do I <>? +* Executing a <> request; +* I need <>; +* How to use the <> method; +* How to use <>; + +include::asStream.asciidoc[] +include::bulk.asciidoc[] +include::exists.asciidoc[] +include::get.asciidoc[] +include::ignore.asciidoc[] +include::msearch.asciidoc[] +include::scroll.asciidoc[] +include::search.asciidoc[] +include::suggest.asciidoc[] +include::transport.request.asciidoc[] +include::typescript.asciidoc[] diff --git a/docs/examples/msearch.asciidoc b/docs/examples/msearch.asciidoc index 5915dc77d..9dbdec1ff 100644 --- a/docs/examples/msearch.asciidoc +++ b/docs/examples/msearch.asciidoc @@ -1,4 +1,5 @@ -= MSearch +[[msearch_examples]] +== MSearch The multi search API allows to execute several search requests within the same API. diff --git a/docs/examples/scroll.asciidoc b/docs/examples/scroll.asciidoc index 90ade2fb6..d07b7449f 100644 --- a/docs/examples/scroll.asciidoc +++ b/docs/examples/scroll.asciidoc @@ -1,4 +1,5 @@ -= Scroll +[[scroll_examples]] +== Scroll While a search request returns a single “page” of results, the scroll API can be used to retrieve large numbers of results (or even all results) from a single search request, in much the same way as you would use a cursor on a traditional database. diff --git a/docs/examples/search.asciidoc b/docs/examples/search.asciidoc index 794efc1e5..62420024a 100644 --- a/docs/examples/search.asciidoc +++ b/docs/examples/search.asciidoc @@ -1,4 +1,5 @@ -= Search +[[search_examples]] +== Search The `search` API allows you to execute a search query and get back search hits that match the query. + The query can either be provided using a simple https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-uri-request.html[query string as a parameter], or using a https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-request-body.html[request body]. diff --git a/docs/examples/suggest.asciidoc b/docs/examples/suggest.asciidoc index d691d8344..d252f6803 100644 --- a/docs/examples/suggest.asciidoc +++ b/docs/examples/suggest.asciidoc @@ -1,4 +1,5 @@ -= Suggest +[[suggest_examples]] +== Suggest The suggest feature suggests similar looking terms based on a provided text by using a suggester. _Parts of the suggest feature are still under development._ diff --git a/docs/examples/transport.request.asciidoc b/docs/examples/transport.request.asciidoc index f89514b50..8689a7363 100644 --- a/docs/examples/transport.request.asciidoc +++ b/docs/examples/transport.request.asciidoc @@ -1,4 +1,5 @@ -= transport.request +[[transport_request_examples]] +== transport.request It can happen that you need to communicate with Elasticsearch by using an API that is not supported by the client, to mitigate this issue you can directly call `client.transport.request`, which is the internal utility that the client uses to communicate with Elasticsearch when you use an API method. diff --git a/docs/examples/typescript.asciidoc b/docs/examples/typescript.asciidoc index b3df28b74..40e211f4b 100644 --- a/docs/examples/typescript.asciidoc +++ b/docs/examples/typescript.asciidoc @@ -1,4 +1,5 @@ -= Typescript +[[typescript_examples]] +== Typescript The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API. diff --git a/docs/extend.asciidoc b/docs/extend.asciidoc index c80c8bd3f..0c246e53a 100644 --- a/docs/extend.asciidoc +++ b/docs/extend.asciidoc @@ -1,4 +1,4 @@ -= Extend the client +== Extend the client Sometimes you need to reuse the same logic, or you want to build a custom API to allow you simplify your code. + The easiest way to achieve that is by extending the client. diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 2c4d7fb87..9995ab490 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -1,51 +1,12 @@ = @elastic/elasticsearch -The official Node.js client for Elasticsearch. - -== Features -* One-to-one mapping with REST API. -* Generalized, pluggable architecture. -* Configurable, automatic discovery of cluster nodes. -* Persistent, Keep-Alive connections. -* Load balancing (with pluggable selection strategy) across all available nodes. -* TypeScript support out of the box. - -== Install -[source,sh] ----- -npm install @elastic/elasticsearch ----- -By default the latest version of the module will be installed, which is the same version of the current release of Elasticsearch. + -If you need to work with older versions of Elasticsearch, you should install the same version of the client as well. + -For example, if you are using Elasticsearch `v6.5.4`, you will need the client `v6`, and you can easily do that with `npm install @elastic/elasticsearch@6`. - -== Usage -[source,js] ----- -const { Client } = require('@elastic/elasticsearch') -const client = new Client({ node: 'http://localhost:9200' }) - -// promise API -const result = await client.search({ - index: 'my-index', - body: { foo: 'bar' } -}) - -// callback API -client.search({ - index: 'my-index', - body: { foo: 'bar' } -}, (err, result) => { - if (err) console.log(err) -}) ----- - -== Reference -* Client configuration -* Client usage -* API methods -* TypeScript support -* Extend the client -* Breaking changes from old client -* Authentication -* Child client +include::introduction.asciidoc[] +include::usage.asciidoc[] +include::configuration.asciidoc[] +include::reference.asciidoc[] +include::breaking-changes.asciidoc[] +include::authentication.asciidoc[] +include::child.asciidoc[] +include::extend.asciidoc[] +include::typescript.asciidoc[] +include::examples/index.asciidoc[] diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc new file mode 100644 index 000000000..5f0a2e73a --- /dev/null +++ b/docs/introduction.asciidoc @@ -0,0 +1,52 @@ +== Introduction + +The official Node.js client for Elasticsearch. + +=== Features +* One-to-one mapping with REST API. +* Generalized, pluggable architecture. +* Configurable, automatic discovery of cluster nodes. +* Persistent, Keep-Alive connections. +* Load balancing (with pluggable selection strategy) across all available nodes. +* TypeScript support out of the box. + +=== Install +[source,sh] +---- +npm install @elastic/elasticsearch +---- + +=== Compatibility + +The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using. +---- +# Elasticsearch 7.x +@elastic/elasticsearch@7 + +# Elasticsearch 6.x +@elastic/elasticsearch@6 + +# Elasticsearch 5.x +@elastic/elasticsearch@5 +---- + +=== Usage +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) + +// promise API +const result = await client.search({ + index: 'my-index', + body: { foo: 'bar' } +}) + +// callback API +client.search({ + index: 'my-index', + body: { foo: 'bar' } +}, (err, result) => { + if (err) console.log(err) +}) +---- \ No newline at end of file diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 856b5885e..82257cb39 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1,4 +1,11 @@ -= API Reference +== API Reference + +//////// + +This documentation is generated by running: +node scripts/run.js --tag v7.0.0-beta + +//////// === Common parameters Parameters that are accepted by all API endpoints. @@ -67,6 +74,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html |`object` - The operation definition and data (action-data pairs), separated by newlines |=== + === cat.aliases [source,js] ---- @@ -100,6 +108,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html |`boolean` - Verbose mode. Display column headers |=== + === cat.allocation [source,js] ---- @@ -136,6 +145,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.htm |`boolean` - Verbose mode. Display column headers |=== + === cat.count [source,js] ---- @@ -169,6 +179,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html |`boolean` - Verbose mode. Display column headers |=== + === cat.fielddata [source,js] ---- @@ -208,6 +219,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html |`string, string[]` - A comma-separated list of fields to return in the output |=== + === cat.health [source,js] ---- @@ -236,12 +248,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html |`ts` |`boolean` - Set to false to disable timestamping + - _Default:_ `true` +_Default:_ `true` |`v` |`boolean` - Verbose mode. Display column headers |=== + === cat.help [source,js] ---- @@ -257,6 +270,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html |`string, string[]` - Comma-separated list of column names or column aliases to sort by |=== + === cat.indices [source,js] ---- @@ -299,6 +313,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html |`boolean` - Verbose mode. Display column headers |=== + === cat.master [source,js] ---- @@ -329,6 +344,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html |`boolean` - Verbose mode. Display column headers |=== + === cat.nodeattrs [source,js] ---- @@ -359,6 +375,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html |`boolean` - Verbose mode. Display column headers |=== + === cat.nodes [source,js] ---- @@ -392,6 +409,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html |`boolean` - Verbose mode. Display column headers |=== + === cat.pendingTasks [source,js] ---- @@ -422,6 +440,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks. |`boolean` - Verbose mode. Display column headers |=== + === cat.plugins [source,js] ---- @@ -452,6 +471,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html |`boolean` - Verbose mode. Display column headers |=== + === cat.recovery [source,js] ---- @@ -485,6 +505,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html |`boolean` - Verbose mode. Display column headers |=== + === cat.repositories [source,js] ---- @@ -515,6 +536,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.h |`boolean` - Verbose mode. Display column headers |=== + === cat.segments [source,js] ---- @@ -545,6 +567,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html |`boolean` - Verbose mode. Display column headers |=== + === cat.shards [source,js] ---- @@ -581,6 +604,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html |`boolean` - Verbose mode. Display column headers |=== + === cat.snapshots [source,js] ---- @@ -614,6 +638,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html |`boolean` - Verbose mode. Display column headers |=== + === cat.tasks [source,js] ---- @@ -650,6 +675,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |`boolean` - Verbose mode. Display column headers |=== + === cat.templates [source,js] ---- @@ -683,6 +709,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html |`boolean` - Verbose mode. Display column headers |=== + === cat.threadPool [source,js] ---- @@ -719,6 +746,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.ht |`boolean` - Verbose mode. Display column headers |=== + === clearScroll [source,js] ---- @@ -734,6 +762,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scr |`object` - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter |=== + === cluster.allocationExplain [source,js] ---- @@ -752,6 +781,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation |`object` - The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' |=== + === cluster.getSettings [source,js] ---- @@ -773,6 +803,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-set |`boolean` - Whether to return all default clusters setting. |=== + === cluster.health [source,js] ---- @@ -786,7 +817,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.htm |`level` |`'cluster', 'indices', 'shards'` - Specify the level of detail for returned information + - _Default:_ `cluster` +_Default:_ `cluster` |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -816,6 +847,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.htm |`'green', 'yellow', 'red'` - Wait until cluster is in a specific state |=== + === cluster.pendingTasks [source,js] ---- @@ -831,6 +863,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.ht |`string` - Specify timeout for connection to master |=== + === cluster.putSettings [source,js] ---- @@ -852,15 +885,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-set |`object` - The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). |=== + === cluster.remoteInfo [source,js] ---- client.cluster.remoteInfo([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html -[cols=2*] -|=== -|=== + + === cluster.reroute [source,js] ---- @@ -891,6 +924,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.ht |`object` - The definition of `commands` to perform (`move`, `cancel`, `allocate`) |=== + === cluster.state [source,js] ---- @@ -928,9 +962,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === cluster.stats [source,js] ---- @@ -949,6 +984,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html |`string` - Explicit operation timeout |=== + === count [source,js] ---- @@ -974,7 +1010,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`min_score` or `minScore` |`number` - Include only documents with a specific `_score` value in the result @@ -996,7 +1032,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html |`default_operator` or `defaultOperator` |`'AND', 'OR'` - The default operator for query string query (AND or OR) + - _Default:_ `OR` +_Default:_ `OR` |`df` |`string` - The field to use as default where no field prefix is given in the query string @@ -1011,6 +1047,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html |`object` - A query to restrict the results specified with the Query DSL (optional) |=== + === create [source,js] ---- @@ -1056,6 +1093,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |`object` - The document |=== + === delete [source,js] ---- @@ -1101,6 +1139,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html |`'internal', 'external', 'external_gte', 'force'` - Specific version type |=== + === deleteByQuery [source,js] ---- @@ -1123,7 +1162,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-qu |`default_operator` or `defaultOperator` |`'AND', 'OR'` - The default operator for query string query (AND or OR) + - _Default:_ `OR` +_Default:_ `OR` |`df` |`string` - The field to use as default where no field prefix is given in the query string @@ -1139,11 +1178,11 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-qu |`conflicts` |`'abort', 'proceed'` - What to do when the delete by query hits version conflicts? + - _Default:_ `abort` +_Default:_ `abort` |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`lenient` |`boolean` - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored @@ -1198,7 +1237,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-qu |`timeout` |`string` - Time each individual bulk request should wait for shards that are unavailable. + - _Default:_ `1m` +_Default:_ `1m` |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) @@ -1208,19 +1247,20 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-qu |`wait_for_completion` or `waitForCompletion` |`boolean` - Should the request should block until the delete by query is complete. + - _Default:_ `true` +_Default:_ `true` |`requests_per_second` or `requestsPerSecond` |`number` - The throttle for this request in sub-requests per second. -1 means no throttle. |`slices` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + - _Default:_ `1` +_Default:_ `1` |`body` |`object` - The search definition using the Query DSL |=== + === deleteByQueryRethrottle [source,js] ---- @@ -1236,6 +1276,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-q |`number` - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |=== + === deleteScript [source,js] ---- @@ -1254,6 +1295,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting. |`string` - Specify timeout for connection to master |=== + === exists [source,js] ---- @@ -1305,6 +1347,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |`'internal', 'external', 'external_gte', 'force'` - Specific version type |=== + === existsSource [source,js] ---- @@ -1353,6 +1396,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |`'internal', 'external', 'external_gte', 'force'` - Specific version type |=== + === explain [source,js] ---- @@ -1378,7 +1422,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.htm |`default_operator` or `defaultOperator` |`'AND', 'OR'` - The default operator for query string query (AND or OR) + - _Default:_ `OR` +_Default:_ `OR` |`df` |`string` - The default field for query string query (default: _all) @@ -1414,6 +1458,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.htm |`object` - The query definition using the Query DSL |=== + === fieldCaps [source,js] ---- @@ -1436,9 +1481,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps. |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === get [source,js] ---- @@ -1496,6 +1542,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |`'internal', 'external', 'external_gte', 'force'` - Specific version type |=== + === getScript [source,js] ---- @@ -1511,6 +1558,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting. |`string` - Specify timeout for connection to master |=== + === getSource [source,js] ---- @@ -1559,6 +1607,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |`'internal', 'external', 'external_gte', 'force'` - Specific version type |=== + === index [source,js] ---- @@ -1581,7 +1630,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |`op_type` or `opType` |`'index', 'create'` - Explicit operation type + - _Default:_ `index` +_Default:_ `index` |`parent` |`string` - ID of the parent document @@ -1614,6 +1663,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |`object` - The document |=== + === indices.analyze [source,js] ---- @@ -1632,6 +1682,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.ht |`object` - Define analyzer/tokenizer parameters and the text on which the analysis should be performed |=== + === indices.clearCache [source,js] ---- @@ -1660,7 +1711,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`index` |`string, string[]` - A comma-separated list of index name to limit the operation @@ -1669,6 +1720,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache |`boolean` - Clear request cache |=== + === indices.close [source,js] ---- @@ -1694,9 +1746,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === indices.create [source,js] ---- @@ -1724,6 +1777,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-ind |`object` - The configuration for the index (`settings` and `mappings`) |=== + === indices.delete [source,js] ---- @@ -1749,9 +1803,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-ind |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + - _Default:_ `open` +_Default:_ `open` |=== + === indices.deleteAlias [source,js] ---- @@ -1773,6 +1828,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht |`string` - Specify timeout for connection to master |=== + === indices.deleteTemplate [source,js] ---- @@ -1791,6 +1847,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. |`string` - Specify timeout for connection to master |=== + === indices.exists [source,js] ---- @@ -1813,7 +1870,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.htm |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + - _Default:_ `open` +_Default:_ `open` |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -1822,6 +1879,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.htm |`boolean` - Whether to return all default setting for each of the indices. |=== + === indices.existsAlias [source,js] ---- @@ -1844,12 +1902,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `all` +_Default:_ `all` |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.existsTemplate [source,js] ---- @@ -1871,6 +1930,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.existsType [source,js] ---- @@ -1893,12 +1953,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exis |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.flush [source,js] ---- @@ -1924,9 +1985,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === indices.flushSynced [source,js] ---- @@ -1946,9 +2008,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flu |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === indices.forcemerge [source,js] ---- @@ -1971,7 +2034,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`max_num_segments` or `maxNumSegments` |`number` - The number of segments the index should be merged into (default: dynamic) @@ -1980,6 +2043,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge |`boolean` - Specify whether the operation should only expunge deleted documents |=== + === indices.get [source,js] ---- @@ -2005,7 +2069,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index. |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + - _Default:_ `open` +_Default:_ `open` |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -2017,6 +2081,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index. |`string` - Specify timeout for connection to master |=== + === indices.getAlias [source,js] ---- @@ -2039,12 +2104,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `all` +_Default:_ `all` |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.getFieldMapping [source,js] ---- @@ -2076,12 +2142,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field- |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.getMapping [source,js] ---- @@ -2107,7 +2174,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mappin |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`master_timeout` or `masterTimeout` |`string` - Specify timeout for connection to master @@ -2116,6 +2183,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mappin |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.getSettings [source,js] ---- @@ -2141,7 +2209,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settin |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open,closed` +_Default:_ `open,closed` |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -2153,6 +2221,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settin |`boolean` - Whether to return all default setting for each of the indices. |=== + === indices.getTemplate [source,js] ---- @@ -2177,6 +2246,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === indices.getUpgrade [source,js] ---- @@ -2196,9 +2266,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.ht |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === indices.open [source,js] ---- @@ -2224,12 +2295,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `closed` +_Default:_ `closed` |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of active shards to wait for before the operation returns. |=== + === indices.putAlias [source,js] ---- @@ -2254,6 +2326,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht |`object` - The settings for the alias, such as `routing` or `filter` |=== + === indices.putMapping [source,js] ---- @@ -2285,12 +2358,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mappin |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`body` |`object` - The mapping definition |=== + === indices.putSettings [source,js] ---- @@ -2319,7 +2393,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-set |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -2328,6 +2402,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-set |`object` - The index settings to be updated |=== + === indices.putTemplate [source,js] ---- @@ -2361,6 +2436,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. |`object` - The template definition |=== + === indices.recovery [source,js] ---- @@ -2379,6 +2455,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.h |`boolean` - Display only those recoveries that are currently on-going |=== + === indices.refresh [source,js] ---- @@ -2398,9 +2475,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.ht |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === indices.rollover [source,js] ---- @@ -2434,6 +2512,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-i |`object` - The conditions that needs to be met for executing rollover |=== + === indices.segments [source,js] ---- @@ -2453,12 +2532,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.h |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`verbose` |`boolean` - Includes detailed memory usage by Lucene. |=== + === indices.shardStores [source,js] ---- @@ -2481,9 +2561,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-sto |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === indices.shrink [source,js] ---- @@ -2514,6 +2595,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-ind |`object` - The configuration for the target index (`settings` and `aliases`) |=== + === indices.split [source,js] ---- @@ -2544,6 +2626,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-inde |`object` - The configuration for the target index (`settings` and `aliases`) |=== + === indices.stats [source,js] ---- @@ -2572,7 +2655,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html |`level` |`'cluster', 'indices', 'shards'` - Return stats aggregated at cluster, index or shard level + - _Default:_ `indices` +_Default:_ `indices` |`types` |`string, string[]` - A comma-separated list of document types for the `indexing` index metric @@ -2581,6 +2664,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html |`boolean` - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) |=== + === indices.updateAliases [source,js] ---- @@ -2599,6 +2683,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht |`object` - The definition of `actions` to perform |=== + === indices.upgrade [source,js] ---- @@ -2615,7 +2700,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.ht |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -2627,6 +2712,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.ht |`boolean` - If true, only ancient (an older Lucene major release) segments will be upgraded |=== + === indices.validateQuery [source,js] ---- @@ -2652,7 +2738,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.ht |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`q` |`string` - Query in the Lucene query string syntax @@ -2665,7 +2751,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.ht |`default_operator` or `defaultOperator` |`'AND', 'OR'` - The default operator for query string query (AND or OR) + - _Default:_ `OR` +_Default:_ `OR` |`df` |`string` - The field to use as default where no field prefix is given in the query string @@ -2683,15 +2769,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.ht |`object` - The query definition specified with the Query DSL |=== + === info [source,js] ---- client.info([params] [, options] [, callback]) ---- http://www.elastic.co/guide/ -[cols=2*] -|=== -|=== + + === ingest.deletePipeline [source,js] ---- @@ -2710,6 +2796,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html |`string` - Explicit operation timeout |=== + === ingest.getPipeline [source,js] ---- @@ -2725,15 +2812,15 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html |`string` - Explicit operation timeout for connection to master node |=== + === ingest.processorGrok [source,js] ---- client.ingest.processorGrok([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html -[cols=2*] -|=== -|=== + + === ingest.putPipeline [source,js] ---- @@ -2755,6 +2842,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html |`object` - The ingest definition |=== + === ingest.simulate [source,js] ---- @@ -2773,6 +2861,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html |`object` - The simulate definition |=== + === mget [source,js] ---- @@ -2815,6 +2904,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.htm |`object` - Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. |=== + === msearch [source,js] ---- @@ -2840,23 +2930,24 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-searc |`pre_filter_shard_size` or `preFilterShardSize` |`number` - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. + - _Default:_ `128` +_Default:_ `128` |`max_concurrent_shard_requests` or `maxConcurrentShardRequests` |`number` - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + - _Default:_ `The default grows with the number of nodes in the cluster but is at most 256.` +_Default:_ `The default grows with the number of nodes in the cluster but is at most 256.` |`rest_total_hits_as_int` or `restTotalHitsAsInt` |`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response |`ccs_minimize_roundtrips` or `ccsMinimizeRoundtrips` |`boolean` - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + - _Default:_ `true` +_Default:_ `true` |`body` |`object` - The request definitions (metadata-search request definition pairs), separated by newlines |=== + === msearchTemplate [source,js] ---- @@ -2885,12 +2976,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-sear |`ccs_minimize_roundtrips` or `ccsMinimizeRoundtrips` |`boolean` - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + - _Default:_ `true` +_Default:_ `true` |`body` |`object` - The request definitions (metadata-search request definition pairs), separated by newlines |=== + === mtermvectors [source,js] ---- @@ -2913,22 +3005,22 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvec |`field_statistics` or `fieldStatistics` |`boolean` - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + - _Default:_ `true` +_Default:_ `true` |`fields` |`string, string[]` - A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". |`offsets` |`boolean` - Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + - _Default:_ `true` +_Default:_ `true` |`positions` |`boolean` - Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + - _Default:_ `true` +_Default:_ `true` |`payloads` |`boolean` - Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + - _Default:_ `true` +_Default:_ `true` |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". @@ -2952,6 +3044,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvec |`object` - Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. |=== + === nodes.hotThreads [source,js] ---- @@ -2982,6 +3075,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot- |`string` - Explicit operation timeout |=== + === nodes.info [source,js] ---- @@ -3003,6 +3097,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info |`string` - Explicit operation timeout |=== + === nodes.reloadSecureSettings [source,js] ---- @@ -3018,6 +3113,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.h |`string` - Explicit operation timeout |=== + === nodes.stats [source,js] ---- @@ -3049,7 +3145,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stat |`level` |`'indices', 'node', 'shards'` - Return indices stats aggregated at index, node or shard level + - _Default:_ `node` +_Default:_ `node` |`types` |`string, string[]` - A comma-separated list of document types for the `indexing` index metric @@ -3061,6 +3157,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stat |`boolean` - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) |=== + === nodes.usage [source,js] ---- @@ -3079,15 +3176,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usag |`string` - Explicit operation timeout |=== + === ping [source,js] ---- client.ping([params] [, options] [, callback]) ---- http://www.elastic.co/guide/ -[cols=2*] -|=== -|=== + + === putScript [source,js] ---- @@ -3115,6 +3212,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting. |`object` - The document |=== + === rankEval [source,js] ---- @@ -3134,12 +3232,13 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval. |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`body` |`object` - The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. |=== + === reindex [source,js] ---- @@ -3153,26 +3252,27 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html |`timeout` |`string` - Time each individual bulk request should wait for shards that are unavailable. + - _Default:_ `1m` +_Default:_ `1m` |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |`wait_for_completion` or `waitForCompletion` |`boolean` - Should the request should block until the reindex is complete. + - _Default:_ `true` +_Default:_ `true` |`requests_per_second` or `requestsPerSecond` |`number` - The throttle to set on this request in sub-requests per second. -1 means no throttle. |`slices` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + - _Default:_ `1` +_Default:_ `1` |`body` |`object` - The search definition using the Query DSL and the prototype for the index request. |=== + === reindexRethrottle [source,js] ---- @@ -3188,6 +3288,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html |`number` - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |=== + === renderSearchTemplate [source,js] ---- @@ -3203,6 +3304,7 @@ http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-temp |`object` - The search definition template and its params |=== + === scriptsPainlessExecute [source,js] ---- @@ -3215,6 +3317,7 @@ https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-a |`object` - The script to execute |=== + === scroll [source,js] ---- @@ -3239,6 +3342,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scr |`object` - The scroll ID if not passed by URL or query parameter. |=== + === search [source,js] ---- @@ -3261,11 +3365,11 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |`ccs_minimize_roundtrips` or `ccsMinimizeRoundtrips` |`boolean` - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + - _Default:_ `true` +_Default:_ `true` |`default_operator` or `defaultOperator` |`'AND', 'OR'` - The default operator for query string query (AND or OR) + - _Default:_ `OR` +_Default:_ `OR` |`df` |`string` - The field to use as default where no field prefix is given in the query string @@ -3293,7 +3397,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`lenient` |`boolean` - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored @@ -3339,7 +3443,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |`suggest_mode` or `suggestMode` |`'missing', 'popular', 'always'` - Specify suggest mode + - _Default:_ `missing` +_Default:_ `missing` |`suggest_size` or `suggestSize` |`number` - How many suggestions to return in response @@ -3358,7 +3462,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |`allow_partial_search_results` or `allowPartialSearchResults` |`boolean` - Indicate if an error should be returned if there is a partial search failure or timeout + - _Default:_ `true` +_Default:_ `true` |`typed_keys` or `typedKeys` |`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response @@ -3374,15 +3478,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |`batched_reduce_size` or `batchedReduceSize` |`number` - The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. + - _Default:_ `512` +_Default:_ `512` |`max_concurrent_shard_requests` or `maxConcurrentShardRequests` |`number` - The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + - _Default:_ `The default is 5.` +_Default:_ `The default is 5.` |`pre_filter_shard_size` or `preFilterShardSize` |`number` - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. + - _Default:_ `128` +_Default:_ `128` |`rest_total_hits_as_int` or `restTotalHitsAsInt` |`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response @@ -3391,6 +3495,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |`object` - The search definition using the Query DSL |=== + === searchShards [source,js] ---- @@ -3419,9 +3524,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |=== + === searchTemplate [source,js] ---- @@ -3447,7 +3553,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.h |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -3475,12 +3581,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.h |`ccs_minimize_roundtrips` or `ccsMinimizeRoundtrips` |`boolean` - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + - _Default:_ `true` +_Default:_ `true` |`body` |`object` - The search definition template and its params |=== + === snapshot.create [source,js] ---- @@ -3505,6 +3612,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`object` - The snapshot definition |=== + === snapshot.createRepository [source,js] ---- @@ -3529,6 +3637,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`object` - The repository definition |=== + === snapshot.delete [source,js] ---- @@ -3547,6 +3656,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`string` - Explicit operation timeout for connection to master node |=== + === snapshot.deleteRepository [source,js] ---- @@ -3565,6 +3675,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`string` - Explicit operation timeout |=== + === snapshot.get [source,js] ---- @@ -3589,6 +3700,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`boolean` - Whether to show verbose snapshot info or only show the basic info found in the repository index blob |=== + === snapshot.getRepository [source,js] ---- @@ -3607,6 +3719,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === snapshot.restore [source,js] ---- @@ -3631,6 +3744,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`object` - Details of what to restore |=== + === snapshot.status [source,js] ---- @@ -3652,6 +3766,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`boolean` - Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown |=== + === snapshot.verifyRepository [source,js] ---- @@ -3670,6 +3785,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. |`string` - Explicit operation timeout |=== + === tasks.cancel [source,js] ---- @@ -3691,6 +3807,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |`string` - Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. |=== + === tasks.get [source,js] ---- @@ -3709,6 +3826,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |`string` - Explicit operation timeout |=== + === tasks.list [source,js] ---- @@ -3734,12 +3852,13 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |`group_by` or `groupBy` |`'nodes', 'parents', 'none'` - Group tasks by nodes or parent/child relationships + - _Default:_ `nodes` +_Default:_ `nodes` |`timeout` |`string` - Explicit operation timeout |=== + === termvectors [source,js] ---- @@ -3762,22 +3881,22 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.h |`field_statistics` or `fieldStatistics` |`boolean` - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. + - _Default:_ `true` +_Default:_ `true` |`fields` |`string, string[]` - A comma-separated list of fields to return. |`offsets` |`boolean` - Specifies if term offsets should be returned. + - _Default:_ `true` +_Default:_ `true` |`positions` |`boolean` - Specifies if term positions should be returned. + - _Default:_ `true` +_Default:_ `true` |`payloads` |`boolean` - Specifies if term payloads should be returned. + - _Default:_ `true` +_Default:_ `true` |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random). @@ -3801,6 +3920,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.h |`object` - Define parameters and or supply a document to get termvectors for. See documentation. |=== + === update [source,js] ---- @@ -3858,6 +3978,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html |`object` - The request definition requires either `script` or partial `doc` |=== + === updateByQuery [source,js] ---- @@ -3880,7 +4001,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-qu |`default_operator` or `defaultOperator` |`'AND', 'OR'` - The default operator for query string query (AND or OR) + - _Default:_ `OR` +_Default:_ `OR` |`df` |`string` - The field to use as default where no field prefix is given in the query string @@ -3896,11 +4017,11 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-qu |`conflicts` |`'abort', 'proceed'` - What to do when the update by query hits version conflicts? + - _Default:_ `abort` +_Default:_ `abort` |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`lenient` |`boolean` - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored @@ -3961,7 +4082,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-qu |`timeout` |`string` - Time each individual bulk request should wait for shards that are unavailable. + - _Default:_ `1m` +_Default:_ `1m` |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) @@ -3971,19 +4092,20 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-qu |`wait_for_completion` or `waitForCompletion` |`boolean` - Should the request should block until the update by query operation is complete. + - _Default:_ `true` +_Default:_ `true` |`requests_per_second` or `requestsPerSecond` |`number` - The throttle to set on this request in sub-requests per second. -1 means no throttle. |`slices` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + - _Default:_ `1` +_Default:_ `1` |`body` |`object` - The search definition using the Query DSL |=== + === updateByQueryRethrottle [source,js] ---- @@ -3999,6 +4121,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-q |`number` - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |=== + === ccr.deleteAutoFollowPattern [source,js] ---- @@ -4011,6 +4134,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto- |`string` - The name of the auto follow pattern. |=== + === ccr.follow [source,js] ---- @@ -4024,12 +4148,13 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.h |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + - _Default:_ `0` +_Default:_ `0` |`body` |`object` - The name of the leader index and other optional ccr related parameters |=== + === ccr.followInfo [source,js] ---- @@ -4042,6 +4167,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-i |`string, string[]` - A comma-separated list of index patterns; use `_all` to perform the operation on all indices |=== + === ccr.followStats [source,js] ---- @@ -4054,6 +4180,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-s |`string, string[]` - A comma-separated list of index patterns; use `_all` to perform the operation on all indices |=== + === ccr.getAutoFollowPattern [source,js] ---- @@ -4066,6 +4193,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-fol |`string` - The name of the auto follow pattern. |=== + === ccr.pauseFollow [source,js] ---- @@ -4078,6 +4206,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-f |`string` - The name of the follower index that should pause following its leader index. |=== + === ccr.putAutoFollowPattern [source,js] ---- @@ -4093,6 +4222,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-fol |`object` - The specification of the auto follow pattern |=== + === ccr.resumeFollow [source,js] ---- @@ -4108,15 +4238,15 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume- |`object` - The name of the leader index and other optional ccr related parameters |=== + === ccr.stats [source,js] ---- client.ccr.stats([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html -[cols=2*] -|=== -|=== + + === ccr.unfollow [source,js] ---- @@ -4129,6 +4259,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current |`string` - The name of the follower index that should be turned into a regular index. |=== + === ilm.deleteLifecycle [source,js] ---- @@ -4141,6 +4272,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifec |`string` - The name of the index lifecycle policy |=== + === ilm.explainLifecycle [source,js] ---- @@ -4154,9 +4286,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-life |`human` |`boolean` - Return data such as dates in a human readable format + - _Default:_ `false` +_Default:_ `false` |=== + === ilm.getLifecycle [source,js] ---- @@ -4169,15 +4302,15 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycl |`string` - The name of the index lifecycle policy |=== + === ilm.getStatus [source,js] ---- client.ilm.getStatus([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html -[cols=2*] -|=== -|=== + + === ilm.moveToStep [source,js] ---- @@ -4193,6 +4326,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step |`object` - The new lifecycle step to move to |=== + === ilm.putLifecycle [source,js] ---- @@ -4208,6 +4342,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycl |`object` - The lifecycle policy definition to register |=== + === ilm.removePolicy [source,js] ---- @@ -4220,6 +4355,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-polic |`string` - The name of the index to remove policy on |=== + === ilm.retry [source,js] ---- @@ -4232,24 +4368,23 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy |`string` - The name of the indices (comma-separated) whose failed lifecycle step is to be retry |=== + === ilm.start [source,js] ---- client.ilm.start([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html -[cols=2*] -|=== -|=== + + === ilm.stop [source,js] ---- client.ilm.stop([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html -[cols=2*] -|=== -|=== + + === indices.freeze [source,js] ---- @@ -4275,12 +4410,13 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `closed` +_Default:_ `closed` |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of active shards to wait for before the operation returns. |=== + === indices.unfreeze [source,js] ---- @@ -4306,12 +4442,13 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `closed` +_Default:_ `closed` |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of active shards to wait for before the operation returns. |=== + === ml.closeJob [source,js] ---- @@ -4336,6 +4473,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html |`object` - The URL params optionally sent in the body |=== + === ml.deleteCalendar [source,js] ---- @@ -4348,6 +4486,7 @@ client.ml.deleteCalendar([params] [, options] [, callback]) |`string` - The ID of the calendar to delete |=== + === ml.deleteCalendarEvent [source,js] ---- @@ -4363,6 +4502,7 @@ client.ml.deleteCalendarEvent([params] [, options] [, callback]) |`string` - The ID of the event to remove from the calendar |=== + === ml.deleteCalendarJob [source,js] ---- @@ -4378,6 +4518,7 @@ client.ml.deleteCalendarJob([params] [, options] [, callback]) |`string` - The ID of the job to remove from the calendar |=== + === ml.deleteDatafeed [source,js] ---- @@ -4393,15 +4534,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafee |`boolean` - True if the datafeed should be forcefully deleted |=== + === ml.deleteExpiredData [source,js] ---- client.ml.deleteExpiredData([params] [, options] [, callback]) ---- -[cols=2*] -|=== -|=== + + === ml.deleteFilter [source,js] ---- @@ -4414,6 +4555,7 @@ client.ml.deleteFilter([params] [, options] [, callback]) |`string` - The ID of the filter to delete |=== + === ml.deleteForecast [source,js] ---- @@ -4435,6 +4577,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecas |`string` - Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds |=== + === ml.deleteJob [source,js] ---- @@ -4451,9 +4594,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.htm |`wait_for_completion` or `waitForCompletion` |`boolean` - Should this request wait until the operation has completed before returning + - _Default:_ `true` +_Default:_ `true` |=== + === ml.deleteModelSnapshot [source,js] ---- @@ -4469,6 +4613,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapsho |`string` - The ID of the snapshot to delete |=== + === ml.findFileStructure [source,js] ---- @@ -4479,11 +4624,11 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure |=== |`lines_to_sample` or `linesToSample` |`number` - How many lines of the file should be included in the analysis + - _Default:_ `1000` +_Default:_ `1000` |`timeout` |`string` - Timeout after which the analysis will be aborted + - _Default:_ `25s` +_Default:_ `25s` |`charset` |`string` - Optional parameter to specify the character set of the file @@ -4522,6 +4667,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure |`object` - The contents of the file to be analyzed |=== + === ml.flushJob [source,js] ---- @@ -4552,6 +4698,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html |`object` - Flush parameters |=== + === ml.forecast [source,js] ---- @@ -4570,6 +4717,7 @@ client.ml.forecast([params] [, options] [, callback]) |`string` - The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity. |=== + === ml.getBuckets [source,js] ---- @@ -4615,6 +4763,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.htm |`object` - Bucket selection details if not provided in URI |=== + === ml.getCalendarEvents [source,js] ---- @@ -4642,6 +4791,7 @@ client.ml.getCalendarEvents([params] [, options] [, callback]) |`number` - Specifies a max number of events to get |=== + === ml.getCalendars [source,js] ---- @@ -4660,6 +4810,7 @@ client.ml.getCalendars([params] [, options] [, callback]) |`number` - specifies a max number of calendars to get |=== + === ml.getCategories [source,js] ---- @@ -4684,6 +4835,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.h |`object` - Category selection details if not provided in URI |=== + === ml.getDatafeedStats [source,js] ---- @@ -4699,6 +4851,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-s |`boolean` - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) |=== + === ml.getDatafeeds [source,js] ---- @@ -4714,6 +4867,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.h |`boolean` - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) |=== + === ml.getFilters [source,js] ---- @@ -4732,6 +4886,7 @@ client.ml.getFilters([params] [, options] [, callback]) |`number` - specifies a max number of filters to get |=== + === ml.getInfluencers [source,js] ---- @@ -4771,6 +4926,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer |`object` - Influencer selection criteria |=== + === ml.getJobStats [source,js] ---- @@ -4786,6 +4942,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats. |`boolean` - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) |=== + === ml.getJobs [source,js] ---- @@ -4801,6 +4958,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html |`boolean` - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) |=== + === ml.getModelSnapshots [source,js] ---- @@ -4837,6 +4995,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.h |`object` - Model snapshot selection criteria |=== + === ml.getOverallBuckets [source,js] ---- @@ -4873,6 +5032,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-bu |`object` - Overall bucket selection details if not provided in URI |=== + === ml.getRecords [source,js] ---- @@ -4912,15 +5072,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.htm |`object` - Record selection criteria |=== + === ml.info [source,js] ---- client.ml.info([params] [, options] [, callback]) ---- -[cols=2*] -|=== -|=== + + === ml.openJob [source,js] ---- @@ -4939,6 +5099,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html |`string` - Controls the time to wait until a job has opened. Default to 30 minutes |=== + === ml.postCalendarEvents [source,js] ---- @@ -4954,6 +5115,7 @@ client.ml.postCalendarEvents([params] [, options] [, callback]) |`object` - A list of events |=== + === ml.postData [source,js] ---- @@ -4975,6 +5137,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html |`object` - The data to process |=== + === ml.previewDatafeed [source,js] ---- @@ -4987,6 +5150,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafe |`string` - The ID of the datafeed to preview |=== + === ml.putCalendar [source,js] ---- @@ -5002,6 +5166,7 @@ client.ml.putCalendar([params] [, options] [, callback]) |`object` - The calendar details |=== + === ml.putCalendarJob [source,js] ---- @@ -5017,6 +5182,7 @@ client.ml.putCalendarJob([params] [, options] [, callback]) |`string` - The ID of the job to add to the calendar |=== + === ml.putDatafeed [source,js] ---- @@ -5032,6 +5198,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.h |`object` - The datafeed config |=== + === ml.putFilter [source,js] ---- @@ -5047,6 +5214,7 @@ client.ml.putFilter([params] [, options] [, callback]) |`object` - The filter details |=== + === ml.putJob [source,js] ---- @@ -5062,6 +5230,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html |`object` - The job |=== + === ml.revertModelSnapshot [source,js] ---- @@ -5083,6 +5252,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapsho |`object` - Reversion options |=== + === ml.setUpgradeMode [source,js] ---- @@ -5098,6 +5268,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mo |`string` - Controls the time to wait before action times out. Defaults to 30 seconds |=== + === ml.startDatafeed [source,js] ---- @@ -5122,6 +5293,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed |`object` - The start datafeed parameters |=== + === ml.stopDatafeed [source,js] ---- @@ -5143,6 +5315,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed. |`string` - Controls the time to wait until a datafeed has stopped. Default to 20 seconds |=== + === ml.updateDatafeed [source,js] ---- @@ -5158,6 +5331,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafee |`object` - The datafeed update settings |=== + === ml.updateFilter [source,js] ---- @@ -5173,6 +5347,7 @@ client.ml.updateFilter([params] [, options] [, callback]) |`object` - The filter update |=== + === ml.updateJob [source,js] ---- @@ -5188,6 +5363,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.htm |`object` - The job update settings |=== + === ml.updateModelSnapshot [source,js] ---- @@ -5206,6 +5382,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapsho |`object` - The model snapshot properties to update |=== + === ml.validate [source,js] ---- @@ -5218,6 +5395,7 @@ client.ml.validate([params] [, options] [, callback]) |`object` - The job config |=== + === ml.validateDetector [source,js] ---- @@ -5230,6 +5408,7 @@ client.ml.validateDetector([params] [, options] [, callback]) |`object` - The detector |=== + === monitoring.bulk [source,js] ---- @@ -5254,15 +5433,15 @@ http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html |`object` - The operation definition and data (action-data pairs), separated by newlines |=== + === security.authenticate [source,js] ---- client.security.authenticate([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html -[cols=2*] -|=== -|=== + + === security.changePassword [source,js] ---- @@ -5281,6 +5460,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cha |`object` - the new password for the user |=== + === security.clearCachedRealms [source,js] ---- @@ -5296,6 +5476,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cle |`string, string[]` - Comma-separated list of usernames to clear from the cache |=== + === security.clearCachedRoles [source,js] ---- @@ -5308,6 +5489,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cle |`string, string[]` - Role name |=== + === security.createApiKey [source,js] ---- @@ -5323,6 +5505,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cre |`object` - The api key request to create an API key |=== + === security.deletePrivileges [source,js] ---- @@ -5341,6 +5524,7 @@ TODO |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== + === security.deleteRole [source,js] ---- @@ -5356,6 +5540,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-del |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== + === security.deleteRoleMapping [source,js] ---- @@ -5371,6 +5556,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-del |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== + === security.deleteUser [source,js] ---- @@ -5386,6 +5572,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-del |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== + === security.disableUser [source,js] ---- @@ -5401,6 +5588,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-dis |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== + === security.enableUser [source,js] ---- @@ -5416,6 +5604,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ena |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== + === security.getApiKey [source,js] ---- @@ -5437,6 +5626,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get |`string` - realm name of the user who created this API key to be retrieved |=== + === security.getPrivileges [source,js] ---- @@ -5452,6 +5642,7 @@ TODO |`string` - Privilege name |=== + === security.getRole [source,js] ---- @@ -5464,6 +5655,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get |`string` - Role name |=== + === security.getRoleMapping [source,js] ---- @@ -5476,6 +5668,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get |`string` - Role-Mapping name |=== + === security.getToken [source,js] ---- @@ -5488,6 +5681,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get |`object` - The token request to get |=== + === security.getUser [source,js] ---- @@ -5500,15 +5694,15 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get |`string, string[]` - A comma-separated list of usernames |=== + === security.getUserPrivileges [source,js] ---- client.security.getUserPrivileges([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html -[cols=2*] -|=== -|=== + + === security.hasPrivileges [source,js] ---- @@ -5524,6 +5718,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has |`object` - The privileges to test |=== + === security.invalidateApiKey [source,js] ---- @@ -5536,6 +5731,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-inv |`object` - The api key request to invalidate API key(s) |=== + === security.invalidateToken [source,js] ---- @@ -5548,6 +5744,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-inv |`object` - The token to invalidate |=== + === security.putPrivileges [source,js] ---- @@ -5563,6 +5760,7 @@ TODO |`object` - The privilege(s) to add |=== + === security.putRole [source,js] ---- @@ -5581,6 +5779,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |`object` - The role to add |=== + === security.putRoleMapping [source,js] ---- @@ -5599,6 +5798,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |`object` - The role to add |=== + === security.putUser [source,js] ---- @@ -5617,15 +5817,15 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |`object` - The user to add |=== + === ssl.certificates [source,js] ---- client.ssl.certificates([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html -[cols=2*] -|=== -|=== + + === xpack.graph.explore [source,js] ---- @@ -5650,6 +5850,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-ap |`object` - Graph Query DSL |=== + === xpack.info [source,js] ---- @@ -5662,15 +5863,15 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html |`string, string[]` - Comma-separated list of info categories. Can be any of: build, license, features |=== + === xpack.license.delete [source,js] ---- client.xpack.license.delete([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|=== + + === xpack.license.get [source,js] ---- @@ -5683,24 +5884,23 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html |`boolean` - Return local information, do not retrieve the state from master node (default: false) |=== + === xpack.license.getBasicStatus [source,js] ---- client.xpack.license.getBasicStatus([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|=== + + === xpack.license.getTrialStatus [source,js] ---- client.xpack.license.getTrialStatus([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|=== + + === xpack.license.post [source,js] ---- @@ -5716,6 +5916,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html |`object` - licenses to be installed |=== + === xpack.license.postStartBasic [source,js] ---- @@ -5728,6 +5929,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html |`boolean` - whether the user has acknowledged acknowledge messages (default: false) |=== + === xpack.license.postStartTrial [source,js] ---- @@ -5743,6 +5945,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html |`boolean` - whether the user has acknowledged acknowledge messages (default: false) |=== + === xpack.migration.deprecations [source,js] ---- @@ -5755,6 +5958,7 @@ http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html |`string` - Index pattern |=== + === xpack.migration.getAssistance [source,js] ---- @@ -5771,12 +5975,13 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-as |`expand_wildcards` or `expandWildcards` |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + - _Default:_ `open` +_Default:_ `open` |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) |=== + === xpack.migration.upgrade [source,js] ---- @@ -5790,9 +5995,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-up |`wait_for_completion` or `waitForCompletion` |`boolean` - Should the request block until the upgrade operation is completed + - _Default:_ `true` +_Default:_ `true` |=== + === xpack.rollup.deleteJob [source,js] ---- @@ -5805,6 +6011,7 @@ client.xpack.rollup.deleteJob([params] [, options] [, callback]) |`string` - The ID of the job to delete |=== + === xpack.rollup.getJobs [source,js] ---- @@ -5817,6 +6024,7 @@ client.xpack.rollup.getJobs([params] [, options] [, callback]) |`string` - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs |=== + === xpack.rollup.getRollupCaps [source,js] ---- @@ -5829,6 +6037,7 @@ client.xpack.rollup.getRollupCaps([params] [, options] [, callback]) |`string` - The ID of the index to check rollup capabilities on, or left blank for all jobs |=== + === xpack.rollup.getRollupIndexCaps [source,js] ---- @@ -5841,6 +6050,7 @@ client.xpack.rollup.getRollupIndexCaps([params] [, options] [, callback]) |`string` - The rollup index or index pattern to obtain rollup capabilities from. |=== + === xpack.rollup.putJob [source,js] ---- @@ -5856,6 +6066,7 @@ client.xpack.rollup.putJob([params] [, options] [, callback]) |`object` - The job configuration |=== + === xpack.rollup.rollupSearch [source,js] ---- @@ -5880,6 +6091,7 @@ client.xpack.rollup.rollupSearch([params] [, options] [, callback]) |`object` - The search request body |=== + === xpack.rollup.startJob [source,js] ---- @@ -5892,6 +6104,7 @@ client.xpack.rollup.startJob([params] [, options] [, callback]) |`string` - The ID of the job to start |=== + === xpack.rollup.stopJob [source,js] ---- @@ -5910,6 +6123,7 @@ client.xpack.rollup.stopJob([params] [, options] [, callback]) |`string` - Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. |=== + === xpack.sql.clearCursor [source,js] ---- @@ -5922,6 +6136,7 @@ Clear SQL cursor |`object` - Specify the cursor value in the `cursor` element to clean the cursor. |=== + === xpack.sql.query [source,js] ---- @@ -5937,6 +6152,7 @@ Execute SQL |`object` - Use the `query` element to start a query. Use the `cursor` element to continue a query. |=== + === xpack.sql.translate [source,js] ---- @@ -5949,6 +6165,7 @@ Translate SQL into Elasticsearch queries |`object` - Specify the query in the `query` element. |=== + === xpack.usage [source,js] ---- @@ -5961,6 +6178,7 @@ Retrieve information about xpack features usage |`string` - Specify timeout for watch write operation |=== + === xpack.watcher.ackWatch [source,js] ---- @@ -5976,6 +6194,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-w |`string, string[]` - A comma-separated list of the action ids to be acked |=== + === xpack.watcher.activateWatch [source,js] ---- @@ -5988,6 +6207,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-acti |`string` - Watch ID |=== + === xpack.watcher.deactivateWatch [source,js] ---- @@ -6000,6 +6220,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deac |`string` - Watch ID |=== + === xpack.watcher.deleteWatch [source,js] ---- @@ -6012,6 +6233,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delet |`string` - Watch ID |=== + === xpack.watcher.executeWatch [source,js] ---- @@ -6030,6 +6252,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execu |`object` - Execution control |=== + === xpack.watcher.getWatch [source,js] ---- @@ -6042,6 +6265,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-w |`string` - Watch ID |=== + === xpack.watcher.putWatch [source,js] ---- @@ -6069,15 +6293,15 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-w |`object` - The watch |=== + === xpack.watcher.start [source,js] ---- client.xpack.watcher.start([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html -[cols=2*] -|=== -|=== + + === xpack.watcher.stats [source,js] ---- @@ -6096,12 +6320,11 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats |`boolean` - Emits stack traces of currently running watches |=== + === xpack.watcher.stop [source,js] ---- client.xpack.watcher.stop([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html -[cols=2*] -|=== -|=== \ No newline at end of file + diff --git a/docs/typescript.asciidoc b/docs/typescript.asciidoc index 94148a5cd..85f06d5b6 100644 --- a/docs/typescript.asciidoc +++ b/docs/typescript.asciidoc @@ -1,4 +1,4 @@ -= TypeScript support +== TypeScript support The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API. @@ -6,7 +6,7 @@ While the client offers type definitions for Request parameters, Request bodies NOTE: If you are using TypeScript you will be required to use _snake_case_ style to define the API parameters instead of _camelCase_. -== How to extend the provided typings? +=== How to extend the provided typings? Extend the provided typings is very straightforward, you should declare a custom `.d.ts` file and then write inside your type extensions, following there is an example of how do it. [source,ts] ---- diff --git a/docs/usage.asciidoc b/docs/usage.asciidoc index 07441e78d..ea0c39649 100644 --- a/docs/usage.asciidoc +++ b/docs/usage.asciidoc @@ -1,4 +1,4 @@ -= Usage +== Usage Use the client is pretty straightforward, it supports all the public APIs of Elasticsearch, and every method exposes the same signature. diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index b0f34f3f5..49519ad9e 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -22,7 +22,15 @@ const dedent = require('dedent') function generateDocs (common, spec) { - var doc = '= API Reference\n\n' + var doc = dedent` + == API Reference + + //////// + + This documentation is generated by running: + node scripts/run.js --tag v7.0.0-beta + + ////////\n\n` doc += commonParameters(common) spec.forEach(s => { doc += '\n' + generateApiDoc(s) @@ -105,27 +113,29 @@ function generateApiDoc (spec) { ---- client.${camelify(name)}([params] [, options] [, callback]) ---- - ${documentationUrl || ''} - [cols=2*] - |===` + ${documentationUrl || ''}\n` + + if (params.length !== 0) { + doc += dedent`[cols=2*] + |===\n` + doc += params.reduce((acc, val) => { + const name = isSnakeCased(val.name) && val.name !== camelify(val.name) + ? '`' + val.name + '` or `' + camelify(val.name) + '`' + : '`' + val.name + '`' + acc += dedent` + |${name} + |${'`' + val.type + '`'} - ${val.description}` + if (val.default) { + acc += ` +\n_Default:_ ${'`' + val.default + '`'}` + } + return acc + '\n\n' + }, '') - doc += '\n' + params.reduce((acc, val) => { - const name = isSnakeCased(val.name) && val.name !== camelify(val.name) - ? '`' + val.name + '` or `' + camelify(val.name) + '`' - : '`' + val.name + '`' - acc += dedent` - |${name} - |${'`' + val.type + '`'} - ${val.description}` - if (val.default) { - acc += ` + - _Default:_ ${'`' + val.default + '`'}` - } - return acc + '\n\n' - }, '') - - doc += dedent` - |=== - ` + doc += dedent` + |=== + ` + } + doc += '\n' return doc } From 5bc57b03bfd9c8fa0ee33f1d30871cc3b9f3ed3f Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 27 Mar 2019 14:59:55 +0100 Subject: [PATCH 02/84] Improved integration test runner --- test/integration/index.js | 43 +++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/test/integration/index.js b/test/integration/index.js index b217675ee..e68b5bcf5 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -43,28 +43,28 @@ const customSkips = [ ] const platinumBlackList = { // file path: test name - 'cat.aliases/10_basic.yml': 'Empty cluster', - 'index/10_with_id.yml': 'Index with ID', - 'indices.get_alias/10_basic.yml': 'Get alias against closed indices', - 'indices.get_alias/20_empty.yml': 'Check empty aliases when getting all aliases via /_alias', + 'cat.aliases/10_basic.yml': ['Empty cluster'], + 'index/10_with_id.yml': ['Index with ID'], + 'indices.get_alias/10_basic.yml': ['Get alias against closed indices'], + 'indices.get_alias/20_empty.yml': ['Check empty aliases when getting all aliases via /_alias'], // https://github.com/elastic/elasticsearch/pull/39400 - 'ml/jobs_crud.yml': 'Test put job with id that is already taken', + 'ml/jobs_crud.yml': ['Test put job with id that is already taken'], // TODO: investigate why this is failing - 'monitoring/bulk/10_basic.yml': '*', - 'monitoring/bulk/20_privileges.yml': '*', - 'license/20_put_license.yml': '*', - 'snapshot/10_basic.yml': '*', + 'monitoring/bulk/10_basic.yml': ['*'], + 'monitoring/bulk/20_privileges.yml': ['*'], + 'license/20_put_license.yml': ['*'], + 'snapshot/10_basic.yml': ['*'], // the body is correct, but the regex is failing - 'sql/sql.yml': 'Getting textual representation', + 'sql/sql.yml': ['Getting textual representation'], // we are setting two certificates in the docker config - 'ssl/10_basic.yml': '*', + 'ssl/10_basic.yml': ['*'], // docker issue? - 'watcher/execute_watch/60_http_input.yml': '*', + 'watcher/execute_watch/60_http_input.yml': ['*'], // the checks are correct, but for some reason the test is failing on js side // I bet is because the backslashes in the rg - 'watcher/execute_watch/70_invalid.yml': '*', - 'watcher/put_watch/10_basic.yml': '*', - 'xpack/15_basic.yml': '*' + 'watcher/execute_watch/70_invalid.yml': ['*'], + 'watcher/put_watch/10_basic.yml': ['*'], + 'xpack/15_basic.yml': ['*'] } function Runner (opts) { @@ -93,7 +93,7 @@ Runner.prototype.waitCluster = function (callback, times = 0) { this.client.cluster.health( { waitForStatus: 'green', timeout: '50s' }, (err, res) => { - if (++times < 10) { + if (err && ++times < 10) { setTimeout(() => { this.waitCluster(callback, times) }, 5000) @@ -184,10 +184,13 @@ Runner.prototype.start = function (opts) { if (opts.isPlatinum) { const list = Object.keys(platinumBlackList) for (i = 0; i < list.length; i++) { - if (file.endsWith(list[i]) && (name === platinumBlackList[list[i]] || platinumBlackList[list[i]] === '*')) { - const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name - tap.skip(`Skipping test ${testName} because is blacklisted in the platinum test`) - return + const platTest = platinumBlackList[list[i]] + for (var j = 0; j < platTest.length; j++) { + if (file.endsWith(list[i]) && (name === platTest[j] || platTest[j] === '*')) { + const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name + tap.skip(`Skipping test ${testName} because is blacklisted in the platinum test`) + return + } } } } From f260549a4fcd7ce460f2f2688d57666a8d891e61 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 27 Mar 2019 16:46:25 +0100 Subject: [PATCH 03/84] Added CONTRIBUTING.md and CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 3 ++ CONTRIBUTING.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..c286a3152 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +303 See Other + +Location: https://www.elastic.co/community/codeofconduct diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..5341aaa61 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,71 @@ +# Contributing to the Elasticsearch Node.js client + +The Elasticsearch Node.js client is open source and we love to receive contributions from our community — you! + +There are many ways to contribute, +from writing tutorials or blog posts, +improving the documentation, +submitting bug reports and feature requests or writing code. + +## Repository structure +The `master` branch is considered unstable, and it's compatible with Elasticsearch master. Unless you are patching an issue, new features should always be sent to the `master` branch, in case of a bugfix, it depends if the bug affects all the release lines.
+There is a branch for every supported release line, such as `7.x` or `6.x`. We release bugfixes as soon as possible, while minor and major releases are published at the same time of the Elastic Stack. + +Usually for every release line there will be a *published* version and a *next* version. Eg: the `7.x` branch contains the version published on npm, and bugfixes should be sent there, while `7.2` *(assuming that 7.1.x is released)* contains the next version, and new features should be sent there. + +## Code contributions + +If you have a bugfix or new feature that you would like to contribute, +please find or open an issue about it first. +Talk about what you would like to do. +It may be that somebody is already working on it, +or that there are particular issues that you should know about before implementing the change. + +Note that we strictly follow the [Elastic EOL schedule](https://www.elastic.co/support/eol). + +### Submitting your changes + +Generally, we require that you test any code you are adding or modifying. +Once your changes are ready to submit for review: + +1. Test your changes + + Run the test suite to make sure that nothing is broken. + Usually run `npm test` is enough, our CI will take care of running the integration test. + If you want to run them on your own, you should spin up and Elasticsearch instance via the scripts that you + can find inside the `scripts` folder, and then run `npm run test:integration`.
+ If you want to run the integration test for the Elastic licensed APIs, you should run the `platinum` script, and + then run `TEST_ES_SERVER=https://elastic:changeme@localhost:9200 npm run test:integration`. + +2. Submit a pull request + + Push your local changes to your forked copy of the repository and [submit a pull request](https://help.github.com/articles/using-pull-requests). + In the pull request, + choose a title which sums up the changes that you have made, + and in the body provide more details about what your changes do. + Also mention the number of the issue where discussion has taken place, + eg "Closes #123". + +3. Sign the Contributor License Agreement + + Please make sure you have signed our [Contributor License Agreement](https://www.elastic.co/contributor-agreement/). + We are not asking you to assign copyright to us, + but to give us the right to distribute your code without restriction. + We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. + You only need to sign the CLA once. + +4. Be patient + + We might not be able to review your code as fast as we would like to, + but we'll do our best to dedicate it the attention it deserves. + Your effort is much appreciated! + +### Releasing + +If you have access to make releases, the process is as follows: + +1. Update the version in `package.json` according to the scale of the change. (major, minor or patch) +1. Commit changes with message `Bumped vx.y.z` where `x.y.z` is the version in `package.json` +1. Create a release via the GitHub UI. +1. Wait for CI to finish running the test. +1. Publish to npm with `npm publish` *(see [publish](https://docs.npmjs.com/cli/publish) and [dist-tag](https://docs.npmjs.com/cli/dist-tag) docs)* From fb73b4b08d35103474465808307129ebd75d49c7 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 28 Mar 2019 09:05:00 +0100 Subject: [PATCH 04/84] Master should use the latest version of ES (#780) The `master` branch should work with the latest snapshot of Elasticsearch. - Use `8.0.0-SNAPSHOT` - Code generation - Updated scripts and CI conf --- .ci/docker-compose.yml | 4 +- .ci/test-matrix.yml | 2 +- .travis.yml | 4 +- api/api/cat.indices.js | 3 + api/api/ccr.follow_stats.js | 6 + ...tion.upgrade.js => ccr.forget_follower.js} | 22 +- api/api/cluster.health.js | 3 + .../data_frame.delete_data_frame_transform.js | 126 +++ .../data_frame.get_data_frame_transform.js | 129 +++ ...ta_frame.get_data_frame_transform_stats.js | 122 +++ ...data_frame.preview_data_frame_transform.js | 122 +++ .../data_frame.put_data_frame_transform.js | 127 +++ .../data_frame.start_data_frame_transform.js | 127 +++ .../data_frame.stop_data_frame_transform.js | 130 +++ ...pack.graph.explore.js => graph.explore.js} | 8 +- api/api/ilm.explain_lifecycle.js | 3 +- api/api/indices.close.js | 3 + api/api/indices.shrink.js | 3 - api/api/indices.split.js | 3 - api/api/indices.stats.js | 9 + ...ck.license.delete.js => license.delete.js} | 8 +- .../{xpack.license.get.js => license.get.js} | 8 +- ..._status.js => license.get_basic_status.js} | 8 +- ..._status.js => license.get_trial_status.js} | 8 +- ...{xpack.license.post.js => license.post.js} | 8 +- ...t_basic.js => license.post_start_basic.js} | 8 +- ...t_trial.js => license.post_start_trial.js} | 8 +- ...recations.js => migration.deprecations.js} | 8 +- api/api/ml.get_calendars.js | 9 +- api/api/reindex.js | 2 + ...lup.delete_job.js => rollup.delete_job.js} | 8 +- ....rollup.get_jobs.js => rollup.get_jobs.js} | 8 +- ...llup_caps.js => rollup.get_rollup_caps.js} | 8 +- ...aps.js => rollup.get_rollup_index_caps.js} | 8 +- ...ck.rollup.put_job.js => rollup.put_job.js} | 8 +- ...llup_search.js => rollup.rollup_search.js} | 10 +- ...ollup.start_job.js => rollup.start_job.js} | 8 +- ....rollup.stop_job.js => rollup.stop_job.js} | 8 +- api/api/scripts_painless_context.js | 122 +++ api/api/security.disable_user.js | 4 + api/api/security.enable_user.js | 4 + api/api/security.get_privileges.js | 4 +- api/api/security.put_role_mapping.js | 2 +- ...ql.clear_cursor.js => sql.clear_cursor.js} | 8 +- api/api/{xpack.sql.query.js => sql.query.js} | 8 +- ...pack.sql.translate.js => sql.translate.js} | 8 +- ...cher.ack_watch.js => watcher.ack_watch.js} | 8 +- ...ate_watch.js => watcher.activate_watch.js} | 8 +- ...e_watch.js => watcher.deactivate_watch.js} | 8 +- ...elete_watch.js => watcher.delete_watch.js} | 8 +- ...cute_watch.js => watcher.execute_watch.js} | 8 +- ...cher.get_watch.js => watcher.get_watch.js} | 8 +- ...cher.put_watch.js => watcher.put_watch.js} | 8 +- ...pack.watcher.start.js => watcher.start.js} | 8 +- ...pack.watcher.stats.js => watcher.stats.js} | 12 +- ...{xpack.watcher.stop.js => watcher.stop.js} | 8 +- api/api/xpack.migration.get_assistance.js | 127 --- api/index.js | 165 ++-- api/requestParams.d.ts | 274 +++--- docs/reference.asciidoc | 886 ++++++++++-------- index.d.ts | 163 ++-- scripts/es-docker-platinum.sh | 7 +- scripts/es-docker.sh | 7 +- scripts/run.js | 6 +- scripts/utils/clone-es.js | 17 +- test/integration/helper.js | 2 + test/integration/index.js | 8 +- test/integration/test-runner.js | 6 +- 68 files changed, 2076 insertions(+), 933 deletions(-) rename api/api/{xpack.migration.upgrade.js => ccr.forget_follower.js} (78%) create mode 100644 api/api/data_frame.delete_data_frame_transform.js create mode 100644 api/api/data_frame.get_data_frame_transform.js create mode 100644 api/api/data_frame.get_data_frame_transform_stats.js create mode 100644 api/api/data_frame.preview_data_frame_transform.js create mode 100644 api/api/data_frame.put_data_frame_transform.js create mode 100644 api/api/data_frame.start_data_frame_transform.js create mode 100644 api/api/data_frame.stop_data_frame_transform.js rename api/api/{xpack.graph.explore.js => graph.explore.js} (93%) rename api/api/{xpack.license.delete.js => license.delete.js} (92%) rename api/api/{xpack.license.get.js => license.get.js} (92%) rename api/api/{xpack.license.get_basic_status.js => license.get_basic_status.js} (91%) rename api/api/{xpack.license.get_trial_status.js => license.get_trial_status.js} (91%) rename api/api/{xpack.license.post.js => license.post.js} (92%) rename api/api/{xpack.license.post_start_basic.js => license.post_start_basic.js} (91%) rename api/api/{xpack.license.post_start_trial.js => license.post_start_trial.js} (91%) rename api/api/{xpack.migration.deprecations.js => migration.deprecations.js} (91%) rename api/api/{xpack.rollup.delete_job.js => rollup.delete_job.js} (94%) rename api/api/{xpack.rollup.get_jobs.js => rollup.get_jobs.js} (94%) rename api/api/{xpack.rollup.get_rollup_caps.js => rollup.get_rollup_caps.js} (93%) rename api/api/{xpack.rollup.get_rollup_index_caps.js => rollup.get_rollup_index_caps.js} (93%) rename api/api/{xpack.rollup.put_job.js => rollup.put_job.js} (94%) rename api/api/{xpack.rollup.rollup_search.js => rollup.rollup_search.js} (92%) rename api/api/{xpack.rollup.start_job.js => rollup.start_job.js} (94%) rename api/api/{xpack.rollup.stop_job.js => rollup.stop_job.js} (94%) create mode 100644 api/api/scripts_painless_context.js rename api/api/{xpack.sql.clear_cursor.js => sql.clear_cursor.js} (93%) rename api/api/{xpack.sql.query.js => sql.query.js} (94%) rename api/api/{xpack.sql.translate.js => sql.translate.js} (93%) rename api/api/{xpack.watcher.ack_watch.js => watcher.ack_watch.js} (93%) rename api/api/{xpack.watcher.activate_watch.js => watcher.activate_watch.js} (91%) rename api/api/{xpack.watcher.deactivate_watch.js => watcher.deactivate_watch.js} (91%) rename api/api/{xpack.watcher.delete_watch.js => watcher.delete_watch.js} (91%) rename api/api/{xpack.watcher.execute_watch.js => watcher.execute_watch.js} (91%) rename api/api/{xpack.watcher.get_watch.js => watcher.get_watch.js} (92%) rename api/api/{xpack.watcher.put_watch.js => watcher.put_watch.js} (92%) rename api/api/{xpack.watcher.start.js => watcher.start.js} (91%) rename api/api/{xpack.watcher.stats.js => watcher.stats.js} (89%) rename api/api/{xpack.watcher.stop.js => watcher.stop.js} (92%) delete mode 100644 api/api/xpack.migration.get_assistance.js diff --git a/.ci/docker-compose.yml b/.ci/docker-compose.yml index fe46d5733..cd8df3ad0 100644 --- a/.ci/docker-compose.yml +++ b/.ci/docker-compose.yml @@ -22,7 +22,7 @@ services: - elasticsearch-oss elasticsearch-oss: - image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.0.0-beta1} + image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.0.0-SNAPSHOT} volumes: - esvol:/tmp networks: @@ -58,7 +58,7 @@ services: command: ["npm", "run", "test:integration"] elasticsearch-platinum: - image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.0.0-beta1} + image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.0.0-SNAPSHOT} ports: - "9200:9200" networks: diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index 84d69d9e0..8577d7c32 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -1,6 +1,6 @@ --- ELASTICSEARCH_VERSION: -- 7.0.0-beta1 +- 8.0.0-SNAPSHOT NODE_JS_VERSION: - 11 diff --git a/.travis.yml b/.travis.yml index 3eb76648b..869b3c57d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,11 @@ node_js: env: global: - - ELASTICSEARCH_VERSION=7.0.0-beta1 + - ELASTICSEARCH_VERSION=8.0.0-SNAPSHOT - QUIET=true before_install: - - wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz + - wget https://snapshots.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz - tar -xzf elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz - ./elasticsearch-${ELASTICSEARCH_VERSION}/bin/elasticsearch -Enode.attr.testattr=test -Epath.repo=/tmp -Erepositories.url.allowed_urls='http://snapshot.*' &> /dev/null & diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index aff657648..f3469eb26 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -39,6 +39,7 @@ function buildCatIndices (opts) { * @param {boolean} pri - Set to true to return stats only for primary shards * @param {list} s - Comma-separated list of column names or column aliases to sort by * @param {boolean} v - Verbose mode. Display column headers + * @param {boolean} include_unloaded_segments - If set to true segment stats will include stats for segments that are not currently loaded into memory */ const acceptedQuerystring = [ @@ -52,6 +53,7 @@ function buildCatIndices (opts) { 'pri', 's', 'v', + 'include_unloaded_segments', 'pretty', 'human', 'error_trace', @@ -61,6 +63,7 @@ function buildCatIndices (opts) { const snakeCase = { masterTimeout: 'master_timeout', + includeUnloadedSegments: 'include_unloaded_segments', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 5c3806181..5d455b480 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -51,6 +51,12 @@ function buildCcrFollowStats (opts) { options = {} } + // check required parameters + if (params['index'] == null) { + const err = new ConfigurationError('Missing required parameter: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) diff --git a/api/api/xpack.migration.upgrade.js b/api/api/ccr.forget_follower.js similarity index 78% rename from api/api/xpack.migration.upgrade.js rename to api/api/ccr.forget_follower.js index e1663d3e9..1e2504cee 100644 --- a/api/api/xpack.migration.upgrade.js +++ b/api/api/ccr.forget_follower.js @@ -22,25 +22,25 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackMigrationUpgrade (opts) { +function buildCcrForgetFollower (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.migration.upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html) request + * Perform a [ccr.forget_follower](http://www.elastic.co/guide/en/elasticsearch/reference/current) request * - * @param {string} index - The name of the index - * @param {boolean} wait_for_completion - Should the request block until the upgrade operation is completed + * @param {string} index - the name of the leader index for which specified follower retention leases should be removed + * @param {object} body - the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index */ const acceptedQuerystring = [ - 'wait_for_completion' + ] const snakeCase = { - waitForCompletion: 'wait_for_completion' + } - return function xpackMigrationUpgrade (params, options, callback) { + return function ccrForgetFollower (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -57,6 +57,10 @@ function buildXpackMigrationUpgrade (opts) { const err = new ConfigurationError('Missing required parameter: index') return handleError(err, callback) } + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { @@ -79,7 +83,7 @@ function buildXpackMigrationUpgrade (opts) { var path = '' - path = '/' + '_migration' + '/' + 'upgrade' + '/' + encodeURIComponent(index) + path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'forget_follower' // build request object const request = { @@ -120,4 +124,4 @@ function buildXpackMigrationUpgrade (opts) { } } -module.exports = buildXpackMigrationUpgrade +module.exports = buildCcrForgetFollower diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 327cbbaba..0127efecb 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -29,6 +29,7 @@ function buildClusterHealth (opts) { * Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request * * @param {list} index - Limit the information returned to a specific index + * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {enum} level - Specify the level of detail for returned information * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -42,6 +43,7 @@ function buildClusterHealth (opts) { */ const acceptedQuerystring = [ + 'expand_wildcards', 'level', 'local', 'master_timeout', @@ -60,6 +62,7 @@ function buildClusterHealth (opts) { ] const snakeCase = { + expandWildcards: 'expand_wildcards', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js new file mode 100644 index 000000000..6d4656451 --- /dev/null +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -0,0 +1,126 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameDeleteDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.delete_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the transform to delete + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFrameDeleteDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'DELETE' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameDeleteDataFrameTransform diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js new file mode 100644 index 000000000..a54947560 --- /dev/null +++ b/api/api/data_frame.get_data_frame_transform.js @@ -0,0 +1,129 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameGetDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.get_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html) request + * + * @param {string} transform_id - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms + * @param {int} from - skips a number of transform configs, defaults to 0 + * @param {int} size - specifies a max number of transforms to get, defaults to 100 + */ + + const acceptedQuerystring = [ + 'from', + 'size' + ] + + const snakeCase = { + + } + + return function dataFrameGetDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + if ((transform_id || transformId) != null) { + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + } else { + path = '/' + '_data_frame' + '/' + 'transforms' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameGetDataFrameTransform diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js new file mode 100644 index 000000000..1eec92cea --- /dev/null +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameGetDataFrameTransformStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request + * + * @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFrameGetDataFrameTransformStats (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stats' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameGetDataFrameTransformStats diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js new file mode 100644 index 000000000..761c8ad2f --- /dev/null +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFramePreviewDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.preview_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html) request + * + * @param {object} body - The definition for the data_frame transform to preview + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFramePreviewDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body } = params + var querystring = semicopy(params, ['method', 'body']) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + '_preview' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFramePreviewDataFrameTransform diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js new file mode 100644 index 000000000..a7e29105b --- /dev/null +++ b/api/api/data_frame.put_data_frame_transform.js @@ -0,0 +1,127 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFramePutDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.put_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the new transform. + * @param {object} body - The data frame transform definition + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFramePutDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'PUT' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFramePutDataFrameTransform diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js new file mode 100644 index 000000000..b75264fda --- /dev/null +++ b/api/api/data_frame.start_data_frame_transform.js @@ -0,0 +1,127 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameStartDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.start_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the transform to start + * @param {time} timeout - Controls the time to wait for the transform to start + */ + + const acceptedQuerystring = [ + 'timeout' + ] + + const snakeCase = { + + } + + return function dataFrameStartDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_start' + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameStartDataFrameTransform diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js new file mode 100644 index 000000000..2ae878753 --- /dev/null +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -0,0 +1,130 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameStopDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.stop_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the transform to stop + * @param {boolean} wait_for_completion - Whether to wait for the transform to fully stop before returning or not. Default to false + * @param {time} timeout - Controls the time to wait until the transform has stopped. Default to 30 seconds + */ + + const acceptedQuerystring = [ + 'wait_for_completion', + 'timeout' + ] + + const snakeCase = { + waitForCompletion: 'wait_for_completion' + + } + + return function dataFrameStopDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stop' + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameStopDataFrameTransform diff --git a/api/api/xpack.graph.explore.js b/api/api/graph.explore.js similarity index 93% rename from api/api/xpack.graph.explore.js rename to api/api/graph.explore.js index 1217aa335..19e601a64 100644 --- a/api/api/xpack.graph.explore.js +++ b/api/api/graph.explore.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackGraphExplore (opts) { +function buildGraphExplore (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request + * Perform a [graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -44,7 +44,7 @@ function buildXpackGraphExplore (opts) { } - return function xpackGraphExplore (params, options, callback) { + return function graphExplore (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -128,4 +128,4 @@ function buildXpackGraphExplore (opts) { } } -module.exports = buildXpackGraphExplore +module.exports = buildGraphExplore diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index d9a0e2e70..e5638c16d 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -29,11 +29,10 @@ function buildIlmExplainLifecycle (opts) { * Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request * * @param {string} index - The name of the index to explain - * @param {boolean} human - Return data such as dates in a human readable format */ const acceptedQuerystring = [ - 'human' + ] const snakeCase = { diff --git a/api/api/indices.close.js b/api/api/indices.close.js index 023bc3507..a19790e32 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -34,6 +34,7 @@ function buildIndicesClose (opts) { * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - 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 {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns. */ const acceptedQuerystring = [ @@ -42,6 +43,7 @@ function buildIndicesClose (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'wait_for_active_shards', 'pretty', 'human', 'error_trace', @@ -54,6 +56,7 @@ function buildIndicesClose (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index e8dcbe934..9316b53a8 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -30,7 +30,6 @@ function buildIndicesShrink (opts) { * * @param {string} index - The name of the source index to shrink * @param {string} target - The name of the target index to shrink into - * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -38,7 +37,6 @@ function buildIndicesShrink (opts) { */ const acceptedQuerystring = [ - 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -50,7 +48,6 @@ function buildIndicesShrink (opts) { ] const snakeCase = { - copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', diff --git a/api/api/indices.split.js b/api/api/indices.split.js index fbb062d1f..1dad6769d 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -30,7 +30,6 @@ function buildIndicesSplit (opts) { * * @param {string} index - The name of the source index to split * @param {string} target - The name of the target index to split into - * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -38,7 +37,6 @@ function buildIndicesSplit (opts) { */ const acceptedQuerystring = [ - 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -50,7 +48,6 @@ function buildIndicesSplit (opts) { ] const snakeCase = { - copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index e4b811ea5..d630947f9 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -37,6 +37,9 @@ function buildIndicesStats (opts) { * @param {enum} level - Return stats aggregated at cluster, index or shard level * @param {list} types - A comma-separated list of document types for the `indexing` index metric * @param {boolean} include_segment_file_sizes - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) + * @param {boolean} include_unloaded_segments - If set to true segment stats will include stats for segments that are not currently loaded into memory + * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {boolean} forbid_closed_indices - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices */ const acceptedQuerystring = [ @@ -47,6 +50,9 @@ function buildIndicesStats (opts) { 'level', 'types', 'include_segment_file_sizes', + 'include_unloaded_segments', + 'expand_wildcards', + 'forbid_closed_indices', 'pretty', 'human', 'error_trace', @@ -58,6 +64,9 @@ function buildIndicesStats (opts) { completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', + includeUnloadedSegments: 'include_unloaded_segments', + expandWildcards: 'expand_wildcards', + forbidClosedIndices: 'forbid_closed_indices', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/xpack.license.delete.js b/api/api/license.delete.js similarity index 92% rename from api/api/xpack.license.delete.js rename to api/api/license.delete.js index ca14c02bd..520058967 100644 --- a/api/api/xpack.license.delete.js +++ b/api/api/license.delete.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseDelete (opts) { +function buildLicenseDelete (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * */ @@ -38,7 +38,7 @@ function buildXpackLicenseDelete (opts) { } - return function xpackLicenseDelete (params, options, callback) { + return function licenseDelete (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackLicenseDelete (opts) { } } -module.exports = buildXpackLicenseDelete +module.exports = buildLicenseDelete diff --git a/api/api/xpack.license.get.js b/api/api/license.get.js similarity index 92% rename from api/api/xpack.license.get.js rename to api/api/license.get.js index c189b2b13..613d0e827 100644 --- a/api/api/xpack.license.get.js +++ b/api/api/license.get.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseGet (opts) { +function buildLicenseGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) */ @@ -39,7 +39,7 @@ function buildXpackLicenseGet (opts) { } - return function xpackLicenseGet (params, options, callback) { + return function licenseGet (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackLicenseGet (opts) { } } -module.exports = buildXpackLicenseGet +module.exports = buildLicenseGet diff --git a/api/api/xpack.license.get_basic_status.js b/api/api/license.get_basic_status.js similarity index 91% rename from api/api/xpack.license.get_basic_status.js rename to api/api/license.get_basic_status.js index a3f9cd80a..911e60a27 100644 --- a/api/api/xpack.license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseGetBasicStatus (opts) { +function buildLicenseGetBasicStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * */ @@ -38,7 +38,7 @@ function buildXpackLicenseGetBasicStatus (opts) { } - return function xpackLicenseGetBasicStatus (params, options, callback) { + return function licenseGetBasicStatus (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackLicenseGetBasicStatus (opts) { } } -module.exports = buildXpackLicenseGetBasicStatus +module.exports = buildLicenseGetBasicStatus diff --git a/api/api/xpack.license.get_trial_status.js b/api/api/license.get_trial_status.js similarity index 91% rename from api/api/xpack.license.get_trial_status.js rename to api/api/license.get_trial_status.js index 34487dd5c..51d570fa2 100644 --- a/api/api/xpack.license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseGetTrialStatus (opts) { +function buildLicenseGetTrialStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * */ @@ -38,7 +38,7 @@ function buildXpackLicenseGetTrialStatus (opts) { } - return function xpackLicenseGetTrialStatus (params, options, callback) { + return function licenseGetTrialStatus (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackLicenseGetTrialStatus (opts) { } } -module.exports = buildXpackLicenseGetTrialStatus +module.exports = buildLicenseGetTrialStatus diff --git a/api/api/xpack.license.post.js b/api/api/license.post.js similarity index 92% rename from api/api/xpack.license.post.js rename to api/api/license.post.js index f0f81c6c4..fd238e700 100644 --- a/api/api/xpack.license.post.js +++ b/api/api/license.post.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicensePost (opts) { +function buildLicensePost (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) * @param {object} body - licenses to be installed @@ -40,7 +40,7 @@ function buildXpackLicensePost (opts) { } - return function xpackLicensePost (params, options, callback) { + return function licensePost (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -114,4 +114,4 @@ function buildXpackLicensePost (opts) { } } -module.exports = buildXpackLicensePost +module.exports = buildLicensePost diff --git a/api/api/xpack.license.post_start_basic.js b/api/api/license.post_start_basic.js similarity index 91% rename from api/api/xpack.license.post_start_basic.js rename to api/api/license.post_start_basic.js index c473ceb73..72d9bb04d 100644 --- a/api/api/xpack.license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicensePostStartBasic (opts) { +function buildLicensePostStartBasic (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) */ @@ -39,7 +39,7 @@ function buildXpackLicensePostStartBasic (opts) { } - return function xpackLicensePostStartBasic (params, options, callback) { + return function licensePostStartBasic (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackLicensePostStartBasic (opts) { } } -module.exports = buildXpackLicensePostStartBasic +module.exports = buildLicensePostStartBasic diff --git a/api/api/xpack.license.post_start_trial.js b/api/api/license.post_start_trial.js similarity index 91% rename from api/api/xpack.license.post_start_trial.js rename to api/api/license.post_start_trial.js index 67fffcc4e..b99569790 100644 --- a/api/api/xpack.license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicensePostStartTrial (opts) { +function buildLicensePostStartTrial (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {string} type - The type of trial license to generate (default: "trial") * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) @@ -41,7 +41,7 @@ function buildXpackLicensePostStartTrial (opts) { } - return function xpackLicensePostStartTrial (params, options, callback) { + return function licensePostStartTrial (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -121,4 +121,4 @@ function buildXpackLicensePostStartTrial (opts) { } } -module.exports = buildXpackLicensePostStartTrial +module.exports = buildLicensePostStartTrial diff --git a/api/api/xpack.migration.deprecations.js b/api/api/migration.deprecations.js similarity index 91% rename from api/api/xpack.migration.deprecations.js rename to api/api/migration.deprecations.js index d6d5edef8..cc5de6d85 100644 --- a/api/api/xpack.migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackMigrationDeprecations (opts) { +function buildMigrationDeprecations (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request + * Perform a [migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request * * @param {string} index - Index pattern */ @@ -39,7 +39,7 @@ function buildXpackMigrationDeprecations (opts) { } - return function xpackMigrationDeprecations (params, options, callback) { + return function migrationDeprecations (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackMigrationDeprecations (opts) { } } -module.exports = buildXpackMigrationDeprecations +module.exports = buildMigrationDeprecations diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 365f18942..2792f7e50 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -31,6 +31,7 @@ function buildMlGetCalendars (opts) { * @param {string} calendar_id - The ID of the calendar to fetch * @param {int} from - skips a number of calendars * @param {int} size - specifies a max number of calendars to get + * @param {object} body - The from and size parameters optionally sent in the body */ const acceptedQuerystring = [ @@ -54,12 +55,6 @@ function buildMlGetCalendars (opts) { options = {} } - // check required parameters - if (params.body != null) { - const err = new ConfigurationError('This API does not require a body') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -91,7 +86,7 @@ function buildMlGetCalendars (opts) { const request = { method, path, - body: '', + body: body || '', querystring } diff --git a/api/api/reindex.js b/api/api/reindex.js index 90397417b..44949d112 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -33,6 +33,7 @@ function buildReindex (opts) { * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) * @param {boolean} wait_for_completion - Should the request should block until the reindex is complete. * @param {number} requests_per_second - The throttle to set on this request in sub-requests per second. -1 means no throttle. + * @param {time} scroll - Control how long to keep the search context alive * @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. * @param {object} body - The search definition using the Query DSL and the prototype for the index request. */ @@ -43,6 +44,7 @@ function buildReindex (opts) { 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', + 'scroll', 'slices', 'pretty', 'human', diff --git a/api/api/xpack.rollup.delete_job.js b/api/api/rollup.delete_job.js similarity index 94% rename from api/api/xpack.rollup.delete_job.js rename to api/api/rollup.delete_job.js index a4e960daa..353c35094 100644 --- a/api/api/xpack.rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupDeleteJob (opts) { +function buildRollupDeleteJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.delete_job]() request + * Perform a [rollup.delete_job]() request * * @param {string} id - The ID of the job to delete */ @@ -39,7 +39,7 @@ function buildXpackRollupDeleteJob (opts) { } - return function xpackRollupDeleteJob (params, options, callback) { + return function rollupDeleteJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackRollupDeleteJob (opts) { } } -module.exports = buildXpackRollupDeleteJob +module.exports = buildRollupDeleteJob diff --git a/api/api/xpack.rollup.get_jobs.js b/api/api/rollup.get_jobs.js similarity index 94% rename from api/api/xpack.rollup.get_jobs.js rename to api/api/rollup.get_jobs.js index 90a58f40f..e88e8a8ef 100644 --- a/api/api/xpack.rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupGetJobs (opts) { +function buildRollupGetJobs (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.get_jobs]() request + * Perform a [rollup.get_jobs]() request * * @param {string} id - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs */ @@ -39,7 +39,7 @@ function buildXpackRollupGetJobs (opts) { } - return function xpackRollupGetJobs (params, options, callback) { + return function rollupGetJobs (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -117,4 +117,4 @@ function buildXpackRollupGetJobs (opts) { } } -module.exports = buildXpackRollupGetJobs +module.exports = buildRollupGetJobs diff --git a/api/api/xpack.rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js similarity index 93% rename from api/api/xpack.rollup.get_rollup_caps.js rename to api/api/rollup.get_rollup_caps.js index 712061e83..aec85ccfa 100644 --- a/api/api/xpack.rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupGetRollupCaps (opts) { +function buildRollupGetRollupCaps (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.get_rollup_caps]() request + * Perform a [rollup.get_rollup_caps]() request * * @param {string} id - The ID of the index to check rollup capabilities on, or left blank for all jobs */ @@ -39,7 +39,7 @@ function buildXpackRollupGetRollupCaps (opts) { } - return function xpackRollupGetRollupCaps (params, options, callback) { + return function rollupGetRollupCaps (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -117,4 +117,4 @@ function buildXpackRollupGetRollupCaps (opts) { } } -module.exports = buildXpackRollupGetRollupCaps +module.exports = buildRollupGetRollupCaps diff --git a/api/api/xpack.rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js similarity index 93% rename from api/api/xpack.rollup.get_rollup_index_caps.js rename to api/api/rollup.get_rollup_index_caps.js index ceb97b228..1cf85f7c3 100644 --- a/api/api/xpack.rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupGetRollupIndexCaps (opts) { +function buildRollupGetRollupIndexCaps (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.get_rollup_index_caps]() request + * Perform a [rollup.get_rollup_index_caps]() request * * @param {string} index - The rollup index or index pattern to obtain rollup capabilities from. */ @@ -39,7 +39,7 @@ function buildXpackRollupGetRollupIndexCaps (opts) { } - return function xpackRollupGetRollupIndexCaps (params, options, callback) { + return function rollupGetRollupIndexCaps (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackRollupGetRollupIndexCaps (opts) { } } -module.exports = buildXpackRollupGetRollupIndexCaps +module.exports = buildRollupGetRollupIndexCaps diff --git a/api/api/xpack.rollup.put_job.js b/api/api/rollup.put_job.js similarity index 94% rename from api/api/xpack.rollup.put_job.js rename to api/api/rollup.put_job.js index 48518f09e..5db700e80 100644 --- a/api/api/xpack.rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupPutJob (opts) { +function buildRollupPutJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.put_job]() request + * Perform a [rollup.put_job]() request * * @param {string} id - The ID of the job to create * @param {object} body - The job configuration @@ -40,7 +40,7 @@ function buildXpackRollupPutJob (opts) { } - return function xpackRollupPutJob (params, options, callback) { + return function rollupPutJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -124,4 +124,4 @@ function buildXpackRollupPutJob (opts) { } } -module.exports = buildXpackRollupPutJob +module.exports = buildRollupPutJob diff --git a/api/api/xpack.rollup.rollup_search.js b/api/api/rollup.rollup_search.js similarity index 92% rename from api/api/xpack.rollup.rollup_search.js rename to api/api/rollup.rollup_search.js index b21faaf22..78094e181 100644 --- a/api/api/xpack.rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -22,13 +22,13 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupRollupSearch (opts) { +function buildRollupRollupSearch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.rollup_search]() request + * Perform a [rollup.rollup_search]() request * - * @param {string} index - The index or index-pattern (containing rollup or regular data) that should be searched + * @param {list} index - The indices or index-pattern(s) (containing rollup or regular data) that should be searched * @param {string} type - The doc type inside the index * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response @@ -45,7 +45,7 @@ function buildXpackRollupRollupSearch (opts) { restTotalHitsAsInt: 'rest_total_hits_as_int' } - return function xpackRollupRollupSearch (params, options, callback) { + return function rollupRollupSearch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -139,4 +139,4 @@ function buildXpackRollupRollupSearch (opts) { } } -module.exports = buildXpackRollupRollupSearch +module.exports = buildRollupRollupSearch diff --git a/api/api/xpack.rollup.start_job.js b/api/api/rollup.start_job.js similarity index 94% rename from api/api/xpack.rollup.start_job.js rename to api/api/rollup.start_job.js index 823221c1d..48abec711 100644 --- a/api/api/xpack.rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupStartJob (opts) { +function buildRollupStartJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.start_job]() request + * Perform a [rollup.start_job]() request * * @param {string} id - The ID of the job to start */ @@ -39,7 +39,7 @@ function buildXpackRollupStartJob (opts) { } - return function xpackRollupStartJob (params, options, callback) { + return function rollupStartJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackRollupStartJob (opts) { } } -module.exports = buildXpackRollupStartJob +module.exports = buildRollupStartJob diff --git a/api/api/xpack.rollup.stop_job.js b/api/api/rollup.stop_job.js similarity index 94% rename from api/api/xpack.rollup.stop_job.js rename to api/api/rollup.stop_job.js index ad4683d83..1aa07fa2d 100644 --- a/api/api/xpack.rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupStopJob (opts) { +function buildRollupStopJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.stop_job]() request + * Perform a [rollup.stop_job]() request * * @param {string} id - The ID of the job to stop * @param {boolean} wait_for_completion - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. @@ -43,7 +43,7 @@ function buildXpackRollupStopJob (opts) { } - return function xpackRollupStopJob (params, options, callback) { + return function rollupStopJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackRollupStopJob (opts) { } } -module.exports = buildXpackRollupStopJob +module.exports = buildRollupStopJob diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js new file mode 100644 index 000000000..65e4fdac8 --- /dev/null +++ b/api/api/scripts_painless_context.js @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildScriptsPainlessContext (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [scripts_painless_context](undefined) request + * + * @param {string} context - Select a specific context to retrieve API information about + */ + + const acceptedQuerystring = [ + 'context', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + return function scriptsPainlessContext (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = null + var { method, body } = params + var querystring = semicopy(params, ['method', 'body']) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_scripts' + '/' + 'painless' + '/' + '_context' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildScriptsPainlessContext diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index d991c4853..a15e13b2a 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -53,6 +53,10 @@ function buildSecurityDisableUser (opts) { } // check required parameters + if (params['username'] == null) { + const err = new ConfigurationError('Missing required parameter: username') + return handleError(err, callback) + } if (params.body != null) { const err = new ConfigurationError('This API does not require a body') return handleError(err, callback) diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index de69556c4..f13274d71 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -53,6 +53,10 @@ function buildSecurityEnableUser (opts) { } // check required parameters + if (params['username'] == null) { + const err = new ConfigurationError('Missing required parameter: username') + return handleError(err, callback) + } if (params.body != null) { const err = new ConfigurationError('This API does not require a body') return handleError(err, callback) diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index fd2d39da1..ef4045ff1 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -85,9 +85,9 @@ function buildSecurityGetPrivileges (opts) { var path = '' - if (application && name) { + if ((application) != null && (name) != null) { path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) - } else if (application) { + } else if ((application) != null) { path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) } else { path = '/' + '_security' + '/' + 'privilege' diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index cd40cbad1..612bdb873 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -30,7 +30,7 @@ function buildSecurityPutRoleMapping (opts) { * * @param {string} name - Role-mapping name * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * @param {object} body - The role to add + * @param {object} body - The role mapping to add */ const acceptedQuerystring = [ diff --git a/api/api/xpack.sql.clear_cursor.js b/api/api/sql.clear_cursor.js similarity index 93% rename from api/api/xpack.sql.clear_cursor.js rename to api/api/sql.clear_cursor.js index 79548622c..0dac8e9b5 100644 --- a/api/api/xpack.sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackSqlClearCursor (opts) { +function buildSqlClearCursor (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.sql.clear_cursor](Clear SQL cursor) request + * Perform a [sql.clear_cursor](Clear SQL cursor) request * * @param {object} body - Specify the cursor value in the `cursor` element to clean the cursor. */ @@ -39,7 +39,7 @@ function buildXpackSqlClearCursor (opts) { } - return function xpackSqlClearCursor (params, options, callback) { + return function sqlClearCursor (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackSqlClearCursor (opts) { } } -module.exports = buildXpackSqlClearCursor +module.exports = buildSqlClearCursor diff --git a/api/api/xpack.sql.query.js b/api/api/sql.query.js similarity index 94% rename from api/api/xpack.sql.query.js rename to api/api/sql.query.js index 923190fef..0eb23acc2 100644 --- a/api/api/xpack.sql.query.js +++ b/api/api/sql.query.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackSqlQuery (opts) { +function buildSqlQuery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.sql.query](Execute SQL) request + * Perform a [sql.query](Execute SQL) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {object} body - Use the `query` element to start a query. Use the `cursor` element to continue a query. @@ -40,7 +40,7 @@ function buildXpackSqlQuery (opts) { } - return function xpackSqlQuery (params, options, callback) { + return function sqlQuery (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -120,4 +120,4 @@ function buildXpackSqlQuery (opts) { } } -module.exports = buildXpackSqlQuery +module.exports = buildSqlQuery diff --git a/api/api/xpack.sql.translate.js b/api/api/sql.translate.js similarity index 93% rename from api/api/xpack.sql.translate.js rename to api/api/sql.translate.js index c5204666e..be1325763 100644 --- a/api/api/xpack.sql.translate.js +++ b/api/api/sql.translate.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackSqlTranslate (opts) { +function buildSqlTranslate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.sql.translate](Translate SQL into Elasticsearch queries) request + * Perform a [sql.translate](Translate SQL into Elasticsearch queries) request * * @param {object} body - Specify the query in the `query` element. */ @@ -39,7 +39,7 @@ function buildXpackSqlTranslate (opts) { } - return function xpackSqlTranslate (params, options, callback) { + return function sqlTranslate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackSqlTranslate (opts) { } } -module.exports = buildXpackSqlTranslate +module.exports = buildSqlTranslate diff --git a/api/api/xpack.watcher.ack_watch.js b/api/api/watcher.ack_watch.js similarity index 93% rename from api/api/xpack.watcher.ack_watch.js rename to api/api/watcher.ack_watch.js index 0dc0481b6..d7158969f 100644 --- a/api/api/xpack.watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherAckWatch (opts) { +function buildWatcherAckWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request + * Perform a [watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request * * @param {string} watch_id - Watch ID * @param {list} action_id - A comma-separated list of the action ids to be acked @@ -40,7 +40,7 @@ function buildXpackWatcherAckWatch (opts) { } - return function xpackWatcherAckWatch (params, options, callback) { + return function watcherAckWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -134,4 +134,4 @@ function buildXpackWatcherAckWatch (opts) { } } -module.exports = buildXpackWatcherAckWatch +module.exports = buildWatcherAckWatch diff --git a/api/api/xpack.watcher.activate_watch.js b/api/api/watcher.activate_watch.js similarity index 91% rename from api/api/xpack.watcher.activate_watch.js rename to api/api/watcher.activate_watch.js index cadf57117..8012179d2 100644 --- a/api/api/xpack.watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherActivateWatch (opts) { +function buildWatcherActivateWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request + * Perform a [watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request * * @param {string} watch_id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherActivateWatch (opts) { } - return function xpackWatcherActivateWatch (params, options, callback) { + return function watcherActivateWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherActivateWatch (opts) { } } -module.exports = buildXpackWatcherActivateWatch +module.exports = buildWatcherActivateWatch diff --git a/api/api/xpack.watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js similarity index 91% rename from api/api/xpack.watcher.deactivate_watch.js rename to api/api/watcher.deactivate_watch.js index ce5f741bb..cd7cfa9bf 100644 --- a/api/api/xpack.watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherDeactivateWatch (opts) { +function buildWatcherDeactivateWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request + * Perform a [watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request * * @param {string} watch_id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherDeactivateWatch (opts) { } - return function xpackWatcherDeactivateWatch (params, options, callback) { + return function watcherDeactivateWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherDeactivateWatch (opts) { } } -module.exports = buildXpackWatcherDeactivateWatch +module.exports = buildWatcherDeactivateWatch diff --git a/api/api/xpack.watcher.delete_watch.js b/api/api/watcher.delete_watch.js similarity index 91% rename from api/api/xpack.watcher.delete_watch.js rename to api/api/watcher.delete_watch.js index 15d5c2f8e..c126fea0c 100644 --- a/api/api/xpack.watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherDeleteWatch (opts) { +function buildWatcherDeleteWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request + * Perform a [watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request * * @param {string} id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherDeleteWatch (opts) { } - return function xpackWatcherDeleteWatch (params, options, callback) { + return function watcherDeleteWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherDeleteWatch (opts) { } } -module.exports = buildXpackWatcherDeleteWatch +module.exports = buildWatcherDeleteWatch diff --git a/api/api/xpack.watcher.execute_watch.js b/api/api/watcher.execute_watch.js similarity index 91% rename from api/api/xpack.watcher.execute_watch.js rename to api/api/watcher.execute_watch.js index b692e6045..633797a5d 100644 --- a/api/api/xpack.watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherExecuteWatch (opts) { +function buildWatcherExecuteWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request + * Perform a [watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request * * @param {string} id - Watch ID * @param {boolean} debug - indicates whether the watch should execute in debug mode @@ -41,7 +41,7 @@ function buildXpackWatcherExecuteWatch (opts) { } - return function xpackWatcherExecuteWatch (params, options, callback) { + return function watcherExecuteWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackWatcherExecuteWatch (opts) { } } -module.exports = buildXpackWatcherExecuteWatch +module.exports = buildWatcherExecuteWatch diff --git a/api/api/xpack.watcher.get_watch.js b/api/api/watcher.get_watch.js similarity index 92% rename from api/api/xpack.watcher.get_watch.js rename to api/api/watcher.get_watch.js index 452b03ce8..807ec2643 100644 --- a/api/api/xpack.watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherGetWatch (opts) { +function buildWatcherGetWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request + * Perform a [watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request * * @param {string} id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherGetWatch (opts) { } - return function xpackWatcherGetWatch (params, options, callback) { + return function watcherGetWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherGetWatch (opts) { } } -module.exports = buildXpackWatcherGetWatch +module.exports = buildWatcherGetWatch diff --git a/api/api/xpack.watcher.put_watch.js b/api/api/watcher.put_watch.js similarity index 92% rename from api/api/xpack.watcher.put_watch.js rename to api/api/watcher.put_watch.js index 35e973534..4f6d1d701 100644 --- a/api/api/xpack.watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherPutWatch (opts) { +function buildWatcherPutWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request + * Perform a [watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request * * @param {string} id - Watch ID * @param {boolean} active - Specify whether the watch is in/active by default @@ -48,7 +48,7 @@ function buildXpackWatcherPutWatch (opts) { ifPrimaryTerm: 'if_primary_term' } - return function xpackWatcherPutWatch (params, options, callback) { + return function watcherPutWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -128,4 +128,4 @@ function buildXpackWatcherPutWatch (opts) { } } -module.exports = buildXpackWatcherPutWatch +module.exports = buildWatcherPutWatch diff --git a/api/api/xpack.watcher.start.js b/api/api/watcher.start.js similarity index 91% rename from api/api/xpack.watcher.start.js rename to api/api/watcher.start.js index 0684c8260..5cd32357c 100644 --- a/api/api/xpack.watcher.start.js +++ b/api/api/watcher.start.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherStart (opts) { +function buildWatcherStart (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request + * Perform a [watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request * */ @@ -38,7 +38,7 @@ function buildXpackWatcherStart (opts) { } - return function xpackWatcherStart (params, options, callback) { + return function watcherStart (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackWatcherStart (opts) { } } -module.exports = buildXpackWatcherStart +module.exports = buildWatcherStart diff --git a/api/api/xpack.watcher.stats.js b/api/api/watcher.stats.js similarity index 89% rename from api/api/xpack.watcher.stats.js rename to api/api/watcher.stats.js index 444dfd49b..efdae5e0d 100644 --- a/api/api/xpack.watcher.stats.js +++ b/api/api/watcher.stats.js @@ -22,14 +22,14 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherStats (opts) { +function buildWatcherStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request + * Perform a [watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request * - * @param {enum} metric - Controls what additional stat metrics should be include in the response - * @param {enum} metric - Controls what additional stat metrics should be include in the response + * @param {list} metric - Controls what additional stat metrics should be include in the response + * @param {list} metric - Controls what additional stat metrics should be include in the response * @param {boolean} emit_stacktraces - Emits stack traces of currently running watches */ @@ -42,7 +42,7 @@ function buildXpackWatcherStats (opts) { emitStacktraces: 'emit_stacktraces' } - return function xpackWatcherStats (params, options, callback) { + return function watcherStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -126,4 +126,4 @@ function buildXpackWatcherStats (opts) { } } -module.exports = buildXpackWatcherStats +module.exports = buildWatcherStats diff --git a/api/api/xpack.watcher.stop.js b/api/api/watcher.stop.js similarity index 92% rename from api/api/xpack.watcher.stop.js rename to api/api/watcher.stop.js index 0490656ac..18cb40f9e 100644 --- a/api/api/xpack.watcher.stop.js +++ b/api/api/watcher.stop.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherStop (opts) { +function buildWatcherStop (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request + * Perform a [watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request * */ @@ -38,7 +38,7 @@ function buildXpackWatcherStop (opts) { } - return function xpackWatcherStop (params, options, callback) { + return function watcherStop (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackWatcherStop (opts) { } } -module.exports = buildXpackWatcherStop +module.exports = buildWatcherStop diff --git a/api/api/xpack.migration.get_assistance.js b/api/api/xpack.migration.get_assistance.js deleted file mode 100644 index 43e6041ac..000000000 --- a/api/api/xpack.migration.get_assistance.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ -/* eslint no-unused-vars: 0 */ - -function buildXpackMigrationGetAssistance (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts - /** - * Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request - * - * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * @param {boolean} allow_no_indices - 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 {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. - * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) - */ - - const acceptedQuerystring = [ - 'allow_no_indices', - 'expand_wildcards', - 'ignore_unavailable' - ] - - const snakeCase = { - allowNoIndices: 'allow_no_indices', - expandWildcards: 'expand_wildcards', - ignoreUnavailable: 'ignore_unavailable' - } - - return function xpackMigrationGetAssistance (params, options, callback) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // validate headers object - if (options.headers != null && typeof options.headers !== 'object') { - const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) - return handleError(err, callback) - } - - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((index) != null) { - path = '/' + '_migration' + '/' + 'assistance' + '/' + encodeURIComponent(index) - } else { - path = '/' + '_migration' + '/' + 'assistance' - } - - // build request object - const request = { - method, - path, - body: null, - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } - } -} - -module.exports = buildXpackMigrationGetAssistance diff --git a/api/index.js b/api/index.js index 57622d189..d31ded72e 100644 --- a/api/index.js +++ b/api/index.js @@ -63,6 +63,8 @@ function ESAPI (opts) { followInfo: lazyLoad('ccr.follow_info', opts), follow_stats: lazyLoad('ccr.follow_stats', opts), followStats: lazyLoad('ccr.follow_stats', opts), + forget_follower: lazyLoad('ccr.forget_follower', opts), + forgetFollower: lazyLoad('ccr.forget_follower', opts), get_auto_follow_pattern: lazyLoad('ccr.get_auto_follow_pattern', opts), getAutoFollowPattern: lazyLoad('ccr.get_auto_follow_pattern', opts), pause_follow: lazyLoad('ccr.pause_follow', opts), @@ -94,6 +96,38 @@ function ESAPI (opts) { }, count: lazyLoad('count', opts), create: lazyLoad('create', opts), + data_frame: { + delete_data_frame_transform: lazyLoad('data_frame.delete_data_frame_transform', opts), + deleteDataFrameTransform: lazyLoad('data_frame.delete_data_frame_transform', opts), + get_data_frame_transform: lazyLoad('data_frame.get_data_frame_transform', opts), + getDataFrameTransform: lazyLoad('data_frame.get_data_frame_transform', opts), + get_data_frame_transform_stats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + getDataFrameTransformStats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + preview_data_frame_transform: lazyLoad('data_frame.preview_data_frame_transform', opts), + previewDataFrameTransform: lazyLoad('data_frame.preview_data_frame_transform', opts), + put_data_frame_transform: lazyLoad('data_frame.put_data_frame_transform', opts), + putDataFrameTransform: lazyLoad('data_frame.put_data_frame_transform', opts), + start_data_frame_transform: lazyLoad('data_frame.start_data_frame_transform', opts), + startDataFrameTransform: lazyLoad('data_frame.start_data_frame_transform', opts), + stop_data_frame_transform: lazyLoad('data_frame.stop_data_frame_transform', opts), + stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts) + }, + dataFrame: { + delete_data_frame_transform: lazyLoad('data_frame.delete_data_frame_transform', opts), + deleteDataFrameTransform: lazyLoad('data_frame.delete_data_frame_transform', opts), + get_data_frame_transform: lazyLoad('data_frame.get_data_frame_transform', opts), + getDataFrameTransform: lazyLoad('data_frame.get_data_frame_transform', opts), + get_data_frame_transform_stats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + getDataFrameTransformStats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + preview_data_frame_transform: lazyLoad('data_frame.preview_data_frame_transform', opts), + previewDataFrameTransform: lazyLoad('data_frame.preview_data_frame_transform', opts), + put_data_frame_transform: lazyLoad('data_frame.put_data_frame_transform', opts), + putDataFrameTransform: lazyLoad('data_frame.put_data_frame_transform', opts), + start_data_frame_transform: lazyLoad('data_frame.start_data_frame_transform', opts), + startDataFrameTransform: lazyLoad('data_frame.start_data_frame_transform', opts), + stop_data_frame_transform: lazyLoad('data_frame.stop_data_frame_transform', opts), + stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts) + }, delete: lazyLoad('delete', opts), delete_by_query: lazyLoad('delete_by_query', opts), deleteByQuery: lazyLoad('delete_by_query', opts), @@ -112,6 +146,9 @@ function ESAPI (opts) { getScript: lazyLoad('get_script', opts), get_source: lazyLoad('get_source', opts), getSource: lazyLoad('get_source', opts), + graph: { + explore: lazyLoad('graph.explore', opts) + }, ilm: { delete_lifecycle: lazyLoad('ilm.delete_lifecycle', opts), deleteLifecycle: lazyLoad('ilm.delete_lifecycle', opts), @@ -205,7 +242,23 @@ function ESAPI (opts) { putPipeline: lazyLoad('ingest.put_pipeline', opts), simulate: lazyLoad('ingest.simulate', opts) }, + license: { + delete: lazyLoad('license.delete', opts), + get: lazyLoad('license.get', opts), + get_basic_status: lazyLoad('license.get_basic_status', opts), + getBasicStatus: lazyLoad('license.get_basic_status', opts), + get_trial_status: lazyLoad('license.get_trial_status', opts), + getTrialStatus: lazyLoad('license.get_trial_status', opts), + post: lazyLoad('license.post', opts), + post_start_basic: lazyLoad('license.post_start_basic', opts), + postStartBasic: lazyLoad('license.post_start_basic', opts), + post_start_trial: lazyLoad('license.post_start_trial', opts), + postStartTrial: lazyLoad('license.post_start_trial', opts) + }, mget: lazyLoad('mget', opts), + migration: { + deprecations: lazyLoad('migration.deprecations', opts) + }, ml: { close_job: lazyLoad('ml.close_job', opts), closeJob: lazyLoad('ml.close_job', opts), @@ -323,6 +376,26 @@ function ESAPI (opts) { reindexRethrottle: lazyLoad('reindex_rethrottle', opts), render_search_template: lazyLoad('render_search_template', opts), renderSearchTemplate: lazyLoad('render_search_template', opts), + rollup: { + delete_job: lazyLoad('rollup.delete_job', opts), + deleteJob: lazyLoad('rollup.delete_job', opts), + get_jobs: lazyLoad('rollup.get_jobs', opts), + getJobs: lazyLoad('rollup.get_jobs', opts), + get_rollup_caps: lazyLoad('rollup.get_rollup_caps', opts), + getRollupCaps: lazyLoad('rollup.get_rollup_caps', opts), + get_rollup_index_caps: lazyLoad('rollup.get_rollup_index_caps', opts), + getRollupIndexCaps: lazyLoad('rollup.get_rollup_index_caps', opts), + put_job: lazyLoad('rollup.put_job', opts), + putJob: lazyLoad('rollup.put_job', opts), + rollup_search: lazyLoad('rollup.rollup_search', opts), + rollupSearch: lazyLoad('rollup.rollup_search', opts), + start_job: lazyLoad('rollup.start_job', opts), + startJob: lazyLoad('rollup.start_job', opts), + stop_job: lazyLoad('rollup.stop_job', opts), + stopJob: lazyLoad('rollup.stop_job', opts) + }, + scripts_painless_context: lazyLoad('scripts_painless_context', opts), + scriptsPainlessContext: lazyLoad('scripts_painless_context', opts), scripts_painless_execute: lazyLoad('scripts_painless_execute', opts), scriptsPainlessExecute: lazyLoad('scripts_painless_execute', opts), scroll: lazyLoad('scroll', opts), @@ -397,6 +470,12 @@ function ESAPI (opts) { verify_repository: lazyLoad('snapshot.verify_repository', opts), verifyRepository: lazyLoad('snapshot.verify_repository', opts) }, + sql: { + clear_cursor: lazyLoad('sql.clear_cursor', opts), + clearCursor: lazyLoad('sql.clear_cursor', opts), + query: lazyLoad('sql.query', opts), + translate: lazyLoad('sql.translate', opts) + }, ssl: { certificates: lazyLoad('ssl.certificates', opts) }, @@ -411,74 +490,28 @@ function ESAPI (opts) { updateByQuery: lazyLoad('update_by_query', opts), update_by_query_rethrottle: lazyLoad('update_by_query_rethrottle', opts), updateByQueryRethrottle: lazyLoad('update_by_query_rethrottle', opts), + watcher: { + ack_watch: lazyLoad('watcher.ack_watch', opts), + ackWatch: lazyLoad('watcher.ack_watch', opts), + activate_watch: lazyLoad('watcher.activate_watch', opts), + activateWatch: lazyLoad('watcher.activate_watch', opts), + deactivate_watch: lazyLoad('watcher.deactivate_watch', opts), + deactivateWatch: lazyLoad('watcher.deactivate_watch', opts), + delete_watch: lazyLoad('watcher.delete_watch', opts), + deleteWatch: lazyLoad('watcher.delete_watch', opts), + execute_watch: lazyLoad('watcher.execute_watch', opts), + executeWatch: lazyLoad('watcher.execute_watch', opts), + get_watch: lazyLoad('watcher.get_watch', opts), + getWatch: lazyLoad('watcher.get_watch', opts), + put_watch: lazyLoad('watcher.put_watch', opts), + putWatch: lazyLoad('watcher.put_watch', opts), + start: lazyLoad('watcher.start', opts), + stats: lazyLoad('watcher.stats', opts), + stop: lazyLoad('watcher.stop', opts) + }, xpack: { - graph: { - explore: lazyLoad('xpack.graph.explore', opts) - }, info: lazyLoad('xpack.info', opts), - license: { - delete: lazyLoad('xpack.license.delete', opts), - get: lazyLoad('xpack.license.get', opts), - get_basic_status: lazyLoad('xpack.license.get_basic_status', opts), - getBasicStatus: lazyLoad('xpack.license.get_basic_status', opts), - get_trial_status: lazyLoad('xpack.license.get_trial_status', opts), - getTrialStatus: lazyLoad('xpack.license.get_trial_status', opts), - post: lazyLoad('xpack.license.post', opts), - post_start_basic: lazyLoad('xpack.license.post_start_basic', opts), - postStartBasic: lazyLoad('xpack.license.post_start_basic', opts), - post_start_trial: lazyLoad('xpack.license.post_start_trial', opts), - postStartTrial: lazyLoad('xpack.license.post_start_trial', opts) - }, - migration: { - deprecations: lazyLoad('xpack.migration.deprecations', opts), - get_assistance: lazyLoad('xpack.migration.get_assistance', opts), - getAssistance: lazyLoad('xpack.migration.get_assistance', opts), - upgrade: lazyLoad('xpack.migration.upgrade', opts) - }, - rollup: { - delete_job: lazyLoad('xpack.rollup.delete_job', opts), - deleteJob: lazyLoad('xpack.rollup.delete_job', opts), - get_jobs: lazyLoad('xpack.rollup.get_jobs', opts), - getJobs: lazyLoad('xpack.rollup.get_jobs', opts), - get_rollup_caps: lazyLoad('xpack.rollup.get_rollup_caps', opts), - getRollupCaps: lazyLoad('xpack.rollup.get_rollup_caps', opts), - get_rollup_index_caps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts), - getRollupIndexCaps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts), - put_job: lazyLoad('xpack.rollup.put_job', opts), - putJob: lazyLoad('xpack.rollup.put_job', opts), - rollup_search: lazyLoad('xpack.rollup.rollup_search', opts), - rollupSearch: lazyLoad('xpack.rollup.rollup_search', opts), - start_job: lazyLoad('xpack.rollup.start_job', opts), - startJob: lazyLoad('xpack.rollup.start_job', opts), - stop_job: lazyLoad('xpack.rollup.stop_job', opts), - stopJob: lazyLoad('xpack.rollup.stop_job', opts) - }, - sql: { - clear_cursor: lazyLoad('xpack.sql.clear_cursor', opts), - clearCursor: lazyLoad('xpack.sql.clear_cursor', opts), - query: lazyLoad('xpack.sql.query', opts), - translate: lazyLoad('xpack.sql.translate', opts) - }, - usage: lazyLoad('xpack.usage', opts), - watcher: { - ack_watch: lazyLoad('xpack.watcher.ack_watch', opts), - ackWatch: lazyLoad('xpack.watcher.ack_watch', opts), - activate_watch: lazyLoad('xpack.watcher.activate_watch', opts), - activateWatch: lazyLoad('xpack.watcher.activate_watch', opts), - deactivate_watch: lazyLoad('xpack.watcher.deactivate_watch', opts), - deactivateWatch: lazyLoad('xpack.watcher.deactivate_watch', opts), - delete_watch: lazyLoad('xpack.watcher.delete_watch', opts), - deleteWatch: lazyLoad('xpack.watcher.delete_watch', opts), - execute_watch: lazyLoad('xpack.watcher.execute_watch', opts), - executeWatch: lazyLoad('xpack.watcher.execute_watch', opts), - get_watch: lazyLoad('xpack.watcher.get_watch', opts), - getWatch: lazyLoad('xpack.watcher.get_watch', opts), - put_watch: lazyLoad('xpack.watcher.put_watch', opts), - putWatch: lazyLoad('xpack.watcher.put_watch', opts), - start: lazyLoad('xpack.watcher.start', opts), - stats: lazyLoad('xpack.watcher.stats', opts), - stop: lazyLoad('xpack.watcher.stop', opts) - } + usage: lazyLoad('xpack.usage', opts) } } diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 755fddf88..7f2cd898d 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -115,6 +115,7 @@ export interface CatIndices extends Generic { pri?: boolean; s?: string | string[]; v?: boolean; + include_unloaded_segments?: boolean; } export interface CatMaster extends Generic { @@ -277,6 +278,7 @@ export interface ClusterGetSettings extends Generic { export interface ClusterHealth extends Generic { index?: string | string[]; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; level?: 'cluster' | 'indices' | 'shards'; local?: boolean; master_timeout?: string; @@ -574,6 +576,7 @@ export interface IndicesClose extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + wait_for_active_shards?: string; } export interface IndicesCreate extends Generic { @@ -835,7 +838,6 @@ export interface IndicesShardStores extends Generic { export interface IndicesShrink extends Generic { index: string; target: string; - copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -845,7 +847,6 @@ export interface IndicesShrink extends Generic { export interface IndicesSplit extends Generic { index: string; target: string; - copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -862,6 +863,9 @@ export interface IndicesStats extends Generic { level?: 'cluster' | 'indices' | 'shards'; types?: string | string[]; include_segment_file_sizes?: boolean; + include_unloaded_segments?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + forbid_closed_indices?: boolean; } export interface IndicesUpdateAliases extends Generic { @@ -1051,6 +1055,7 @@ export interface Reindex extends Generic { wait_for_active_shards?: string; wait_for_completion?: boolean; requests_per_second?: number; + scroll?: string; slices?: number; body: any; } @@ -1065,6 +1070,10 @@ export interface RenderSearchTemplate extends Generic { body?: any; } +export interface ScriptsPainlessContext extends Generic { + context?: string; +} + export interface ScriptsPainlessExecute extends Generic { body?: any; } @@ -1337,7 +1346,12 @@ export interface CcrFollowInfo extends Generic { } export interface CcrFollowStats extends Generic { - index?: string | string[]; + index: string | string[]; +} + +export interface CcrForgetFollower extends Generic { + index: string; + body: any; } export interface CcrGetAutoFollowPattern extends Generic { @@ -1365,13 +1379,54 @@ export interface CcrUnfollow extends Generic { index: string; } +export interface DataFrameDeleteDataFrameTransform extends Generic { + transform_id: string; +} + +export interface DataFrameGetDataFrameTransform extends Generic { + transform_id?: string; + from?: number; + size?: number; +} + +export interface DataFrameGetDataFrameTransformStats extends Generic { + transform_id?: string; +} + +export interface DataFramePreviewDataFrameTransform extends Generic { + body: any; +} + +export interface DataFramePutDataFrameTransform extends Generic { + transform_id: string; + body: any; +} + +export interface DataFrameStartDataFrameTransform extends Generic { + transform_id: string; + timeout?: string; +} + +export interface DataFrameStopDataFrameTransform extends Generic { + transform_id: string; + wait_for_completion?: boolean; + timeout?: string; +} + +export interface GraphExplore extends Generic { + index?: string | string[]; + type?: string | string[]; + routing?: string; + timeout?: string; + body?: any; +} + export interface IlmDeleteLifecycle extends Generic { policy?: string; } export interface IlmExplainLifecycle extends Generic { index?: string; - human?: boolean; } export interface IlmGetLifecycle extends Generic { @@ -1425,6 +1480,37 @@ export interface IndicesUnfreeze extends Generic { wait_for_active_shards?: string; } +export interface LicenseDelete extends Generic { +} + +export interface LicenseGet extends Generic { + local?: boolean; +} + +export interface LicenseGetBasicStatus extends Generic { +} + +export interface LicenseGetTrialStatus extends Generic { +} + +export interface LicensePost extends Generic { + acknowledge?: boolean; + body?: any; +} + +export interface LicensePostStartBasic extends Generic { + acknowledge?: boolean; +} + +export interface LicensePostStartTrial extends Generic { + type?: string; + acknowledge?: boolean; +} + +export interface MigrationDeprecations extends Generic { + index?: string; +} + export interface MlCloseJob extends Generic { job_id: string; allow_no_jobs?: boolean; @@ -1538,6 +1624,7 @@ export interface MlGetCalendars extends Generic { calendar_id?: string; from?: number; size?: number; + body?: any; } export interface MlGetCategories extends Generic { @@ -1738,6 +1825,45 @@ export interface MonitoringBulk extends Generic { body: any; } +export interface RollupDeleteJob extends Generic { + id: string; +} + +export interface RollupGetJobs extends Generic { + id?: string; +} + +export interface RollupGetRollupCaps extends Generic { + id?: string; +} + +export interface RollupGetRollupIndexCaps extends Generic { + index: string; +} + +export interface RollupPutJob extends Generic { + id: string; + body: any; +} + +export interface RollupRollupSearch extends Generic { + index: string | string[]; + type?: string; + typed_keys?: boolean; + rest_total_hits_as_int?: boolean; + body: any; +} + +export interface RollupStartJob extends Generic { + id: string; +} + +export interface RollupStopJob extends Generic { + id: string; + wait_for_completion?: boolean; + timeout?: string; +} + export interface SecurityAuthenticate extends Generic { } @@ -1783,12 +1909,12 @@ export interface SecurityDeleteUser extends Generic { } export interface SecurityDisableUser extends Generic { - username?: string; + username: string; refresh?: 'true' | 'false' | 'wait_for'; } export interface SecurityEnableUser extends Generic { - username?: string; + username: string; refresh?: 'true' | 'false' | 'wait_for'; } @@ -1859,148 +1985,50 @@ export interface SecurityPutUser extends Generic { body: any; } -export interface SslCertificates extends Generic { -} - -export interface XpackGraphExplore extends Generic { - index?: string | string[]; - type?: string | string[]; - routing?: string; - timeout?: string; - body?: any; -} - -export interface XpackInfo extends Generic { - categories?: string | string[]; -} - -export interface XpackLicenseDelete extends Generic { -} - -export interface XpackLicenseGet extends Generic { - local?: boolean; -} - -export interface XpackLicenseGetBasicStatus extends Generic { -} - -export interface XpackLicenseGetTrialStatus extends Generic { -} - -export interface XpackLicensePost extends Generic { - acknowledge?: boolean; - body?: any; -} - -export interface XpackLicensePostStartBasic extends Generic { - acknowledge?: boolean; -} - -export interface XpackLicensePostStartTrial extends Generic { - type?: string; - acknowledge?: boolean; -} - -export interface XpackMigrationDeprecations extends Generic { - index?: string; -} - -export interface XpackMigrationGetAssistance extends Generic { - index?: string | string[]; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - ignore_unavailable?: boolean; -} - -export interface XpackMigrationUpgrade extends Generic { - index: string; - wait_for_completion?: boolean; -} - -export interface XpackRollupDeleteJob extends Generic { - id: string; -} - -export interface XpackRollupGetJobs extends Generic { - id?: string; -} - -export interface XpackRollupGetRollupCaps extends Generic { - id?: string; -} - -export interface XpackRollupGetRollupIndexCaps extends Generic { - index: string; -} - -export interface XpackRollupPutJob extends Generic { - id: string; - body: any; -} - -export interface XpackRollupRollupSearch extends Generic { - index: string; - type?: string; - typed_keys?: boolean; - rest_total_hits_as_int?: boolean; +export interface SqlClearCursor extends Generic { body: any; } -export interface XpackRollupStartJob extends Generic { - id: string; -} - -export interface XpackRollupStopJob extends Generic { - id: string; - wait_for_completion?: boolean; - timeout?: string; -} - -export interface XpackSqlClearCursor extends Generic { - body: any; -} - -export interface XpackSqlQuery extends Generic { +export interface SqlQuery extends Generic { format?: string; body: any; } -export interface XpackSqlTranslate extends Generic { +export interface SqlTranslate extends Generic { body: any; } -export interface XpackUsage extends Generic { - master_timeout?: string; +export interface SslCertificates extends Generic { } -export interface XpackWatcherAckWatch extends Generic { +export interface WatcherAckWatch extends Generic { watch_id: string; action_id?: string | string[]; } -export interface XpackWatcherActivateWatch extends Generic { +export interface WatcherActivateWatch extends Generic { watch_id: string; } -export interface XpackWatcherDeactivateWatch extends Generic { +export interface WatcherDeactivateWatch extends Generic { watch_id: string; } -export interface XpackWatcherDeleteWatch extends Generic { +export interface WatcherDeleteWatch extends Generic { id: string; } -export interface XpackWatcherExecuteWatch extends Generic { +export interface WatcherExecuteWatch extends Generic { id?: string; debug?: boolean; body?: any; } -export interface XpackWatcherGetWatch extends Generic { +export interface WatcherGetWatch extends Generic { id: string; } -export interface XpackWatcherPutWatch extends Generic { +export interface WatcherPutWatch extends Generic { id: string; active?: boolean; version?: number; @@ -2009,13 +2037,21 @@ export interface XpackWatcherPutWatch extends Generic { body?: any; } -export interface XpackWatcherStart extends Generic { +export interface WatcherStart extends Generic { } -export interface XpackWatcherStats extends Generic { - metric?: '_all' | 'queued_watches' | 'current_watches' | 'pending_watches'; +export interface WatcherStats extends Generic { + metric?: string | string[]; emit_stacktraces?: boolean; } -export interface XpackWatcherStop extends Generic { +export interface WatcherStop extends Generic { +} + +export interface XpackInfo extends Generic { + categories?: string | string[]; +} + +export interface XpackUsage extends Generic { + master_timeout?: string; } diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 82257cb39..1ce137e78 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -312,6 +312,9 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html |`v` |`boolean` - Verbose mode. Display column headers +|`include_unloaded_segments` or `includeUnloadedSegments` +|`boolean` - If set to true segment stats will include stats for segments that are not currently loaded into memory + |=== === cat.master @@ -815,6 +818,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.htm |`index` |`string, string[]` - Limit the information returned to a specific index +|`expand_wildcards` or `expandWildcards` +|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `all` + |`level` |`'cluster', 'indices', 'shards'` - Specify the level of detail for returned information + _Default:_ `cluster` @@ -1748,6 +1755,9 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` +|`wait_for_active_shards` or `waitForActiveShards` +|`string` - Sets the number of active shards to wait for before the operation returns. + |=== === indices.create @@ -2579,9 +2589,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-ind |`target` |`string` - The name of the target index to shrink into -|`copy_settings` or `copySettings` -|`boolean` - whether or not to copy settings from the source index (defaults to false) - |`timeout` |`string` - Explicit operation timeout @@ -2610,9 +2617,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-inde |`target` |`string` - The name of the target index to split into -|`copy_settings` or `copySettings` -|`boolean` - whether or not to copy settings from the source index (defaults to false) - |`timeout` |`string` - Explicit operation timeout @@ -2663,6 +2667,17 @@ _Default:_ `indices` |`include_segment_file_sizes` or `includeSegmentFileSizes` |`boolean` - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) +|`include_unloaded_segments` or `includeUnloadedSegments` +|`boolean` - If set to true segment stats will include stats for segments that are not currently loaded into memory + +|`expand_wildcards` or `expandWildcards` +|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `open` + +|`forbid_closed_indices` or `forbidClosedIndices` +|`boolean` - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices + +_Default:_ `true` + |=== === indices.updateAliases @@ -3264,6 +3279,10 @@ _Default:_ `true` |`requests_per_second` or `requestsPerSecond` |`number` - The throttle to set on this request in sub-requests per second. -1 means no throttle. +|`scroll` +|`string` - Control how long to keep the search context alive + +_Default:_ `5m` + |`slices` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + _Default:_ `1` @@ -3305,6 +3324,19 @@ http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-temp |=== +=== scriptsPainlessContext +[source,js] +---- +client.scriptsPainlessContext([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`context` +|`string` - Select a specific context to retrieve API information about + +|=== + === scriptsPainlessExecute [source,js] ---- @@ -4181,6 +4213,22 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-s |=== +=== ccr.forgetFollower +[source,js] +---- +client.ccr.forgetFollower([params] [, options] [, callback]) +---- +http://www.elastic.co/guide/en/elasticsearch/reference/current +[cols=2*] +|=== +|`index` +|`string` - the name of the leader index for which specified follower retention leases should be removed + +|`body` +|`object` - the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index + +|=== + === ccr.getAutoFollowPattern [source,js] ---- @@ -4260,6 +4308,140 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current |=== +=== dataFrame.deleteDataFrameTransform +[source,js] +---- +client.dataFrame.deleteDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform to delete + +|=== + +=== dataFrame.getDataFrameTransform +[source,js] +---- +client.dataFrame.getDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms + +|`from` +|`number` - skips a number of transform configs, defaults to 0 + +|`size` +|`number` - specifies a max number of transforms to get, defaults to 100 + +|=== + +=== dataFrame.getDataFrameTransformStats +[source,js] +---- +client.dataFrame.getDataFrameTransformStats([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms + +|=== + +=== dataFrame.previewDataFrameTransform +[source,js] +---- +client.dataFrame.previewDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html +[cols=2*] +|=== +|`body` +|`object` - The definition for the data_frame transform to preview + +|=== + +=== dataFrame.putDataFrameTransform +[source,js] +---- +client.dataFrame.putDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the new transform. + +|`body` +|`object` - The data frame transform definition + +|=== + +=== dataFrame.startDataFrameTransform +[source,js] +---- +client.dataFrame.startDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform to start + +|`timeout` +|`string` - Controls the time to wait for the transform to start + +|=== + +=== dataFrame.stopDataFrameTransform +[source,js] +---- +client.dataFrame.stopDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform to stop + +|`wait_for_completion` or `waitForCompletion` +|`boolean` - Whether to wait for the transform to fully stop before returning or not. Default to false + +|`timeout` +|`string` - Controls the time to wait until the transform has stopped. Default to 30 seconds + +|=== + +=== graph.explore +[source,js] +---- +client.graph.explore([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html +[cols=2*] +|=== +|`index` +|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + +|`type` +|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types + +|`routing` +|`string` - Specific routing value + +|`timeout` +|`string` - Explicit operation timeout + +|`body` +|`object` - Graph Query DSL + +|=== + === ilm.deleteLifecycle [source,js] ---- @@ -4284,10 +4466,6 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-life |`index` |`string` - The name of the index to explain -|`human` -|`boolean` - Return data such as dates in a human readable format + -_Default:_ `false` - |=== === ilm.getLifecycle @@ -4449,6 +4627,101 @@ _Default:_ `closed` |=== +=== license.delete +[source,js] +---- +client.license.delete([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html + + +=== license.get +[source,js] +---- +client.license.get([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`local` +|`boolean` - Return local information, do not retrieve the state from master node (default: false) + +|=== + +=== license.getBasicStatus +[source,js] +---- +client.license.getBasicStatus([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html + + +=== license.getTrialStatus +[source,js] +---- +client.license.getTrialStatus([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html + + +=== license.post +[source,js] +---- +client.license.post([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`acknowledge` +|`boolean` - whether the user has acknowledged acknowledge messages (default: false) + +|`body` +|`object` - licenses to be installed + +|=== + +=== license.postStartBasic +[source,js] +---- +client.license.postStartBasic([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`acknowledge` +|`boolean` - whether the user has acknowledged acknowledge messages (default: false) + +|=== + +=== license.postStartTrial +[source,js] +---- +client.license.postStartTrial([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`type` +|`string` - The type of trial license to generate (default: "trial") + +|`acknowledge` +|`boolean` - whether the user has acknowledged acknowledge messages (default: false) + +|=== + +=== migration.deprecations +[source,js] +---- +client.migration.deprecations([params] [, options] [, callback]) +---- +http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html +[cols=2*] +|=== +|`index` +|`string` - Index pattern + +|=== + === ml.closeJob [source,js] ---- @@ -4809,6 +5082,9 @@ client.ml.getCalendars([params] [, options] [, callback]) |`size` |`number` - specifies a max number of calendars to get +|`body` +|`object` - The from and size parameters optionally sent in the body + |=== === ml.getCategories @@ -5434,63 +5710,188 @@ http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html |=== -=== security.authenticate +=== rollup.deleteJob [source,js] ---- -client.security.authenticate([params] [, options] [, callback]) +client.rollup.deleteJob([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html - -=== security.changePassword -[source,js] ----- -client.security.changePassword([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html [cols=2*] |=== -|`username` -|`string` - The username of the user to change the password for - -|`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - -|`body` -|`object` - the new password for the user +|`id` +|`string` - The ID of the job to delete |=== -=== security.clearCachedRealms +=== rollup.getJobs [source,js] ---- -client.security.clearCachedRealms([params] [, options] [, callback]) +client.rollup.getJobs([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html + [cols=2*] |=== -|`realms` -|`string, string[]` - Comma-separated list of realms to clear - -|`usernames` -|`string, string[]` - Comma-separated list of usernames to clear from the cache +|`id` +|`string` - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs |=== -=== security.clearCachedRoles +=== rollup.getRollupCaps [source,js] ---- -client.security.clearCachedRoles([params] [, options] [, callback]) +client.rollup.getRollupCaps([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html + [cols=2*] |=== -|`name` -|`string, string[]` - Role name +|`id` +|`string` - The ID of the index to check rollup capabilities on, or left blank for all jobs |=== -=== security.createApiKey +=== rollup.getRollupIndexCaps +[source,js] +---- +client.rollup.getRollupIndexCaps([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`index` +|`string` - The rollup index or index pattern to obtain rollup capabilities from. + +|=== + +=== rollup.putJob +[source,js] +---- +client.rollup.putJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to create + +|`body` +|`object` - The job configuration + +|=== + +=== rollup.rollupSearch +[source,js] +---- +client.rollup.rollupSearch([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`index` +|`string, string[]` - The indices or index-pattern(s) (containing rollup or regular data) that should be searched + +|`type` +|`string` - The doc type inside the index + +|`typed_keys` or `typedKeys` +|`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response + +|`rest_total_hits_as_int` or `restTotalHitsAsInt` +|`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + +|`body` +|`object` - The search request body + +|=== + +=== rollup.startJob +[source,js] +---- +client.rollup.startJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to start + +|=== + +=== rollup.stopJob +[source,js] +---- +client.rollup.stopJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to stop + +|`wait_for_completion` or `waitForCompletion` +|`boolean` - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. + +|`timeout` +|`string` - Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. + +|=== + +=== security.authenticate +[source,js] +---- +client.security.authenticate([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html + + +=== security.changePassword +[source,js] +---- +client.security.changePassword([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html +[cols=2*] +|=== +|`username` +|`string` - The username of the user to change the password for + +|`refresh` +|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. + +|`body` +|`object` - the new password for the user + +|=== + +=== security.clearCachedRealms +[source,js] +---- +client.security.clearCachedRealms([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html +[cols=2*] +|=== +|`realms` +|`string, string[]` - Comma-separated list of realms to clear + +|`usernames` +|`string, string[]` - Comma-separated list of usernames to clear from the cache + +|=== + +=== security.clearCachedRoles +[source,js] +---- +client.security.clearCachedRoles([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html +[cols=2*] +|=== +|`name` +|`string, string[]` - Role name + +|=== + +=== security.createApiKey [source,js] ---- client.security.createApiKey([params] [, options] [, callback]) @@ -5795,7 +6196,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` -|`object` - The role to add +|`object` - The role mapping to add |=== @@ -5818,316 +6219,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |=== -=== ssl.certificates -[source,js] ----- -client.ssl.certificates([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html - - -=== xpack.graph.explore -[source,js] ----- -client.xpack.graph.explore([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html -[cols=2*] -|=== -|`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - -|`routing` -|`string` - Specific routing value - -|`timeout` -|`string` - Explicit operation timeout - -|`body` -|`object` - Graph Query DSL - -|=== - -=== xpack.info -[source,js] ----- -client.xpack.info([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html -[cols=2*] -|=== -|`categories` -|`string, string[]` - Comma-separated list of info categories. Can be any of: build, license, features - -|=== - -=== xpack.license.delete -[source,js] ----- -client.xpack.license.delete([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html - - -=== xpack.license.get -[source,js] ----- -client.xpack.license.get([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`local` -|`boolean` - Return local information, do not retrieve the state from master node (default: false) - -|=== - -=== xpack.license.getBasicStatus -[source,js] ----- -client.xpack.license.getBasicStatus([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html - - -=== xpack.license.getTrialStatus -[source,js] ----- -client.xpack.license.getTrialStatus([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html - - -=== xpack.license.post -[source,js] ----- -client.xpack.license.post([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`acknowledge` -|`boolean` - whether the user has acknowledged acknowledge messages (default: false) - -|`body` -|`object` - licenses to be installed - -|=== - -=== xpack.license.postStartBasic -[source,js] ----- -client.xpack.license.postStartBasic([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`acknowledge` -|`boolean` - whether the user has acknowledged acknowledge messages (default: false) - -|=== - -=== xpack.license.postStartTrial -[source,js] ----- -client.xpack.license.postStartTrial([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`type` -|`string` - The type of trial license to generate (default: "trial") - -|`acknowledge` -|`boolean` - whether the user has acknowledged acknowledge messages (default: false) - -|=== - -=== xpack.migration.deprecations +=== sql.clearCursor [source,js] ---- -client.xpack.migration.deprecations([params] [, options] [, callback]) ----- -http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html -[cols=2*] -|=== -|`index` -|`string` - Index pattern - -|=== - -=== xpack.migration.getAssistance -[source,js] ----- -client.xpack.migration.getAssistance([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html -[cols=2*] -|=== -|`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - -|`allow_no_indices` or `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) - -|`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + -_Default:_ `open` - -|`ignore_unavailable` or `ignoreUnavailable` -|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) - -|=== - -=== xpack.migration.upgrade -[source,js] ----- -client.xpack.migration.upgrade([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html -[cols=2*] -|=== -|`index` -|`string` - The name of the index - -|`wait_for_completion` or `waitForCompletion` -|`boolean` - Should the request block until the upgrade operation is completed + -_Default:_ `true` - -|=== - -=== xpack.rollup.deleteJob -[source,js] ----- -client.xpack.rollup.deleteJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to delete - -|=== - -=== xpack.rollup.getJobs -[source,js] ----- -client.xpack.rollup.getJobs([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs - -|=== - -=== xpack.rollup.getRollupCaps -[source,js] ----- -client.xpack.rollup.getRollupCaps([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the index to check rollup capabilities on, or left blank for all jobs - -|=== - -=== xpack.rollup.getRollupIndexCaps -[source,js] ----- -client.xpack.rollup.getRollupIndexCaps([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`index` -|`string` - The rollup index or index pattern to obtain rollup capabilities from. - -|=== - -=== xpack.rollup.putJob -[source,js] ----- -client.xpack.rollup.putJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to create - -|`body` -|`object` - The job configuration - -|=== - -=== xpack.rollup.rollupSearch -[source,js] ----- -client.xpack.rollup.rollupSearch([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`index` -|`string` - The index or index-pattern (containing rollup or regular data) that should be searched - -|`type` -|`string` - The doc type inside the index - -|`typed_keys` or `typedKeys` -|`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response - -|`rest_total_hits_as_int` or `restTotalHitsAsInt` -|`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response - -|`body` -|`object` - The search request body - -|=== - -=== xpack.rollup.startJob -[source,js] ----- -client.xpack.rollup.startJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to start - -|=== - -=== xpack.rollup.stopJob -[source,js] ----- -client.xpack.rollup.stopJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to stop - -|`wait_for_completion` or `waitForCompletion` -|`boolean` - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. - -|`timeout` -|`string` - Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. - -|=== - -=== xpack.sql.clearCursor -[source,js] ----- -client.xpack.sql.clearCursor([params] [, options] [, callback]) +client.sql.clearCursor([params] [, options] [, callback]) ---- Clear SQL cursor [cols=2*] @@ -6137,10 +6232,10 @@ Clear SQL cursor |=== -=== xpack.sql.query +=== sql.query [source,js] ---- -client.xpack.sql.query([params] [, options] [, callback]) +client.sql.query([params] [, options] [, callback]) ---- Execute SQL [cols=2*] @@ -6153,10 +6248,10 @@ Execute SQL |=== -=== xpack.sql.translate +=== sql.translate [source,js] ---- -client.xpack.sql.translate([params] [, options] [, callback]) +client.sql.translate([params] [, options] [, callback]) ---- Translate SQL into Elasticsearch queries [cols=2*] @@ -6166,23 +6261,18 @@ Translate SQL into Elasticsearch queries |=== -=== xpack.usage +=== ssl.certificates [source,js] ---- -client.xpack.usage([params] [, options] [, callback]) +client.ssl.certificates([params] [, options] [, callback]) ---- -Retrieve information about xpack features usage -[cols=2*] -|=== -|`master_timeout` or `masterTimeout` -|`string` - Specify timeout for watch write operation +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html -|=== -=== xpack.watcher.ackWatch +=== watcher.ackWatch [source,js] ---- -client.xpack.watcher.ackWatch([params] [, options] [, callback]) +client.watcher.ackWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html [cols=2*] @@ -6195,10 +6285,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-w |=== -=== xpack.watcher.activateWatch +=== watcher.activateWatch [source,js] ---- -client.xpack.watcher.activateWatch([params] [, options] [, callback]) +client.watcher.activateWatch([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html [cols=2*] @@ -6208,10 +6298,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-acti |=== -=== xpack.watcher.deactivateWatch +=== watcher.deactivateWatch [source,js] ---- -client.xpack.watcher.deactivateWatch([params] [, options] [, callback]) +client.watcher.deactivateWatch([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html [cols=2*] @@ -6221,10 +6311,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deac |=== -=== xpack.watcher.deleteWatch +=== watcher.deleteWatch [source,js] ---- -client.xpack.watcher.deleteWatch([params] [, options] [, callback]) +client.watcher.deleteWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html [cols=2*] @@ -6234,10 +6324,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delet |=== -=== xpack.watcher.executeWatch +=== watcher.executeWatch [source,js] ---- -client.xpack.watcher.executeWatch([params] [, options] [, callback]) +client.watcher.executeWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html [cols=2*] @@ -6253,10 +6343,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execu |=== -=== xpack.watcher.getWatch +=== watcher.getWatch [source,js] ---- -client.xpack.watcher.getWatch([params] [, options] [, callback]) +client.watcher.getWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html [cols=2*] @@ -6266,10 +6356,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-w |=== -=== xpack.watcher.putWatch +=== watcher.putWatch [source,js] ---- -client.xpack.watcher.putWatch([params] [, options] [, callback]) +client.watcher.putWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html [cols=2*] @@ -6294,37 +6384,63 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-w |=== -=== xpack.watcher.start +=== watcher.start [source,js] ---- -client.xpack.watcher.start([params] [, options] [, callback]) +client.watcher.start([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html -=== xpack.watcher.stats +=== watcher.stats [source,js] ---- -client.xpack.watcher.stats([params] [, options] [, callback]) +client.watcher.stats([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html [cols=2*] |=== |`metric` -|`'_all', 'queued_watches', 'current_watches', 'pending_watches'` - Controls what additional stat metrics should be include in the response +|`string, string[]` - Controls what additional stat metrics should be include in the response |`metric` -|`'_all', 'queued_watches', 'current_watches', 'pending_watches'` - Controls what additional stat metrics should be include in the response +|`string, string[]` - Controls what additional stat metrics should be include in the response |`emit_stacktraces` or `emitStacktraces` |`boolean` - Emits stack traces of currently running watches |=== -=== xpack.watcher.stop +=== watcher.stop [source,js] ---- -client.xpack.watcher.stop([params] [, options] [, callback]) +client.watcher.stop([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html + +=== xpack.info +[source,js] +---- +client.xpack.info([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html +[cols=2*] +|=== +|`categories` +|`string, string[]` - Comma-separated list of info categories. Can be any of: build, license, features + +|=== + +=== xpack.usage +[source,js] +---- +client.xpack.usage([params] [, options] [, callback]) +---- +Retrieve information about xpack features usage +[cols=2*] +|=== +|`master_timeout` or `masterTimeout` +|`string` - Specify timeout for watch write operation + +|=== diff --git a/index.d.ts b/index.d.ts index dd7a4244f..0fd8d458d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -134,6 +134,8 @@ declare class Client extends EventEmitter { followInfo: ApiMethod follow_stats: ApiMethod followStats: ApiMethod + forget_follower: ApiMethod + forgetFollower: ApiMethod get_auto_follow_pattern: ApiMethod getAutoFollowPattern: ApiMethod pause_follow: ApiMethod @@ -165,6 +167,38 @@ declare class Client extends EventEmitter { } count: ApiMethod create: ApiMethod + data_frame: { + delete_data_frame_transform: ApiMethod + deleteDataFrameTransform: ApiMethod + get_data_frame_transform: ApiMethod + getDataFrameTransform: ApiMethod + get_data_frame_transform_stats: ApiMethod + getDataFrameTransformStats: ApiMethod + preview_data_frame_transform: ApiMethod + previewDataFrameTransform: ApiMethod + put_data_frame_transform: ApiMethod + putDataFrameTransform: ApiMethod + start_data_frame_transform: ApiMethod + startDataFrameTransform: ApiMethod + stop_data_frame_transform: ApiMethod + stopDataFrameTransform: ApiMethod + } + dataFrame: { + delete_data_frame_transform: ApiMethod + deleteDataFrameTransform: ApiMethod + get_data_frame_transform: ApiMethod + getDataFrameTransform: ApiMethod + get_data_frame_transform_stats: ApiMethod + getDataFrameTransformStats: ApiMethod + preview_data_frame_transform: ApiMethod + previewDataFrameTransform: ApiMethod + put_data_frame_transform: ApiMethod + putDataFrameTransform: ApiMethod + start_data_frame_transform: ApiMethod + startDataFrameTransform: ApiMethod + stop_data_frame_transform: ApiMethod + stopDataFrameTransform: ApiMethod + } delete: ApiMethod delete_by_query: ApiMethod deleteByQuery: ApiMethod @@ -183,6 +217,9 @@ declare class Client extends EventEmitter { getScript: ApiMethod get_source: ApiMethod getSource: ApiMethod + graph: { + explore: ApiMethod + } ilm: { delete_lifecycle: ApiMethod deleteLifecycle: ApiMethod @@ -276,7 +313,23 @@ declare class Client extends EventEmitter { putPipeline: ApiMethod simulate: ApiMethod } + license: { + delete: ApiMethod + get: ApiMethod + get_basic_status: ApiMethod + getBasicStatus: ApiMethod + get_trial_status: ApiMethod + getTrialStatus: ApiMethod + post: ApiMethod + post_start_basic: ApiMethod + postStartBasic: ApiMethod + post_start_trial: ApiMethod + postStartTrial: ApiMethod + } mget: ApiMethod + migration: { + deprecations: ApiMethod + } ml: { close_job: ApiMethod closeJob: ApiMethod @@ -394,6 +447,26 @@ declare class Client extends EventEmitter { reindexRethrottle: ApiMethod render_search_template: ApiMethod renderSearchTemplate: ApiMethod + rollup: { + delete_job: ApiMethod + deleteJob: ApiMethod + get_jobs: ApiMethod + getJobs: ApiMethod + get_rollup_caps: ApiMethod + getRollupCaps: ApiMethod + get_rollup_index_caps: ApiMethod + getRollupIndexCaps: ApiMethod + put_job: ApiMethod + putJob: ApiMethod + rollup_search: ApiMethod + rollupSearch: ApiMethod + start_job: ApiMethod + startJob: ApiMethod + stop_job: ApiMethod + stopJob: ApiMethod + } + scripts_painless_context: ApiMethod + scriptsPainlessContext: ApiMethod scripts_painless_execute: ApiMethod scriptsPainlessExecute: ApiMethod scroll: ApiMethod @@ -468,6 +541,12 @@ declare class Client extends EventEmitter { verify_repository: ApiMethod verifyRepository: ApiMethod } + sql: { + clear_cursor: ApiMethod + clearCursor: ApiMethod + query: ApiMethod + translate: ApiMethod + } ssl: { certificates: ApiMethod } @@ -482,74 +561,28 @@ declare class Client extends EventEmitter { updateByQuery: ApiMethod update_by_query_rethrottle: ApiMethod updateByQueryRethrottle: ApiMethod + watcher: { + ack_watch: ApiMethod + ackWatch: ApiMethod + activate_watch: ApiMethod + activateWatch: ApiMethod + deactivate_watch: ApiMethod + deactivateWatch: ApiMethod + delete_watch: ApiMethod + deleteWatch: ApiMethod + execute_watch: ApiMethod + executeWatch: ApiMethod + get_watch: ApiMethod + getWatch: ApiMethod + put_watch: ApiMethod + putWatch: ApiMethod + start: ApiMethod + stats: ApiMethod + stop: ApiMethod + } xpack: { - graph: { - explore: ApiMethod - } info: ApiMethod - license: { - delete: ApiMethod - get: ApiMethod - get_basic_status: ApiMethod - getBasicStatus: ApiMethod - get_trial_status: ApiMethod - getTrialStatus: ApiMethod - post: ApiMethod - post_start_basic: ApiMethod - postStartBasic: ApiMethod - post_start_trial: ApiMethod - postStartTrial: ApiMethod - } - migration: { - deprecations: ApiMethod - get_assistance: ApiMethod - getAssistance: ApiMethod - upgrade: ApiMethod - } - rollup: { - delete_job: ApiMethod - deleteJob: ApiMethod - get_jobs: ApiMethod - getJobs: ApiMethod - get_rollup_caps: ApiMethod - getRollupCaps: ApiMethod - get_rollup_index_caps: ApiMethod - getRollupIndexCaps: ApiMethod - put_job: ApiMethod - putJob: ApiMethod - rollup_search: ApiMethod - rollupSearch: ApiMethod - start_job: ApiMethod - startJob: ApiMethod - stop_job: ApiMethod - stopJob: ApiMethod - } - sql: { - clear_cursor: ApiMethod - clearCursor: ApiMethod - query: ApiMethod - translate: ApiMethod - } usage: ApiMethod - watcher: { - ack_watch: ApiMethod - ackWatch: ApiMethod - activate_watch: ApiMethod - activateWatch: ApiMethod - deactivate_watch: ApiMethod - deactivateWatch: ApiMethod - delete_watch: ApiMethod - deleteWatch: ApiMethod - execute_watch: ApiMethod - executeWatch: ApiMethod - get_watch: ApiMethod - getWatch: ApiMethod - put_watch: ApiMethod - putWatch: ApiMethod - start: ApiMethod - stats: ApiMethod - stop: ApiMethod - } } } diff --git a/scripts/es-docker-platinum.sh b/scripts/es-docker-platinum.sh index 8ab34962a..9b6b69494 100755 --- a/scripts/es-docker-platinum.sh +++ b/scripts/es-docker-platinum.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Images are cached locally, it may be needed +# to delete an old image and download again +# the latest snapshot. + repo=$(pwd) testnodecrt="/.ci/certs/testnode.crt" testnodekey="/.ci/certs/testnode.key" @@ -28,5 +32,4 @@ exec docker run \ -v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \ -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ -p 9200:9200 \ - docker.elastic.co/elasticsearch/elasticsearch:7.0.0-beta1 - # docker.elastic.co/elasticsearch/elasticsearch:6.6.0 + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index d0e4f5adb..b50050389 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Images are cached locally, it may be needed +# to delete an old image and download again +# the latest snapshot. + exec docker run \ --rm \ -e "node.attr.testattr=test" \ @@ -9,5 +13,4 @@ exec docker run \ -p 9200:9200 \ --network=elastic \ --name=elasticsearch \ - docker.elastic.co/elasticsearch/elasticsearch:7.0.0-beta1 - # docker.elastic.co/elasticsearch/elasticsearch:6.6.0 + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT diff --git a/scripts/run.js b/scripts/run.js index 23839c175..df47b783e 100644 --- a/scripts/run.js +++ b/scripts/run.js @@ -35,12 +35,12 @@ const { } = require('./utils') start(minimist(process.argv.slice(2), { - string: ['tag'] + string: ['tag', 'branch'] })) function start (opts) { const log = ora('Loading Elasticsearch Repository').start() - if (semver.valid(opts.tag) === null) { + if (opts.branch == null && semver.valid(opts.tag) === null) { log.fail(`Missing or invalid tag: ${opts.tag}`) return } @@ -55,7 +55,7 @@ function start (opts) { log.text = 'Cleaning API folder...' rimraf.sync(join(apiOutputFolder, '*.js')) - cloneAndCheckout({ log, tag: opts.tag }, (err, { apiFolder, xPackFolder }) => { + cloneAndCheckout({ log, tag: opts.tag, branch: opts.branch }, (err, { apiFolder, xPackFolder }) => { if (err) { log.fail(err.message) return diff --git a/scripts/utils/clone-es.js b/scripts/utils/clone-es.js index 7889541c3..05608eeaa 100644 --- a/scripts/utils/clone-es.js +++ b/scripts/utils/clone-es.js @@ -29,7 +29,7 @@ const apiFolder = join(esFolder, 'rest-api-spec', 'src', 'main', 'resources', 'r const xPackFolder = join(esFolder, 'x-pack', 'plugin', 'src', 'test', 'resources', 'rest-api-spec', 'api') function cloneAndCheckout (opts, callback) { - const { log, tag } = opts + const { log, tag, branch } = opts withTag(tag, callback) /** @@ -57,13 +57,19 @@ function cloneAndCheckout (opts, callback) { if (fresh) { clone(checkout) + } else if (opts.branch) { + checkout(true) } else { checkout() } - function checkout () { - log.text = `Checking out tag '${tag}'` - git.checkout(tag, err => { + function checkout (alsoPull = false) { + if (branch) { + log.text = `Checking out branch '${branch}'` + } else { + log.text = `Checking out tag '${tag}'` + } + git.checkout(branch || tag, err => { if (err) { if (retry++ > 0) { callback(new Error(`Cannot checkout tag '${tag}'`), { apiFolder, xPackFolder }) @@ -71,6 +77,9 @@ function cloneAndCheckout (opts, callback) { } return pull(checkout) } + if (alsoPull) { + return pull(checkout) + } callback(null, { apiFolder, xPackFolder }) }) } diff --git a/test/integration/helper.js b/test/integration/helper.js index 7c9822698..ded90388d 100644 --- a/test/integration/helper.js +++ b/test/integration/helper.js @@ -26,6 +26,8 @@ const esDefaultRoles = [ 'beats_system', 'code_admin', 'code_user', + 'data_frame_transforms_admin', + 'data_frame_transforms_user', 'ingest_admin', 'kibana_dashboard_only_user', 'kibana_system', diff --git a/test/integration/index.js b/test/integration/index.js index e68b5bcf5..328d83b7e 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -49,7 +49,12 @@ const platinumBlackList = { 'indices.get_alias/20_empty.yml': ['Check empty aliases when getting all aliases via /_alias'], // https://github.com/elastic/elasticsearch/pull/39400 'ml/jobs_crud.yml': ['Test put job with id that is already taken'], - // TODO: investigate why this is failing + // it gets random failures on CI, must investigate + 'ml/set_upgrade_mode.yml': [ + 'Attempt to open job when upgrade_mode is enabled', + 'Setting upgrade mode to disabled from enabled' + ], + // investigate why this is failing 'monitoring/bulk/10_basic.yml': ['*'], 'monitoring/bulk/20_privileges.yml': ['*'], 'license/20_put_license.yml': ['*'], @@ -150,7 +155,6 @@ Runner.prototype.start = function (opts) { files.forEach(runTestFile.bind(this)) function runTestFile (file) { - // if (!file.endsWith('watcher/execute_watch/70_invalid.yml')) return for (var i = 0; i < customSkips.length; i++) { if (file.endsWith(customSkips[i])) return } diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js index 63ca22085..d02495264 100644 --- a/test/integration/test-runner.js +++ b/test/integration/test-runner.js @@ -182,15 +182,15 @@ TestRunner.prototype.cleanupPlatinum = function (q, done) { }) q.add((q, done) => { - this.client.xpack.rollup.getJobs({ id: '_all' }, (err, { body }) => { + this.client.rollup.getJobs({ id: '_all' }, (err, { body }) => { this.tap.error(err, 'should not error: rollup.getJobs') const jobs = body.jobs.map(j => j.config.id) helper.runInParallel( - this.client, 'xpack.rollup.stopJob', + this.client, 'rollup.stopJob', jobs.map(j => ({ id: j, waitForCompletion: true })) ) .then(() => helper.runInParallel( - this.client, 'xpack.rollup.deleteJob', + this.client, 'rollup.deleteJob', jobs.map(j => ({ id: j })) )) .then(() => done()) From 22d65e54aca03f4d6b10f8ec071a0b6d2f92b341 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 28 Mar 2019 10:10:26 +0100 Subject: [PATCH 05/84] Updated CONTRIBUTING.md (#794) As titled, also renamed the script files for a better DX. --- CONTRIBUTING.md | 39 ++++++++++++++++--- package.json | 1 - scripts/{run.js => generate.js} | 0 .../utils/{generate.js => generateApis.js} | 0 scripts/utils/{genMain.js => generateMain.js} | 0 scripts/utils/index.js | 4 +- 6 files changed, 36 insertions(+), 8 deletions(-) rename scripts/{run.js => generate.js} (100%) rename scripts/utils/{generate.js => generateApis.js} (100%) rename scripts/utils/{genMain.js => generateMain.js} (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5341aaa61..13a6bb39a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,11 +31,7 @@ Once your changes are ready to submit for review: 1. Test your changes Run the test suite to make sure that nothing is broken. - Usually run `npm test` is enough, our CI will take care of running the integration test. - If you want to run them on your own, you should spin up and Elasticsearch instance via the scripts that you - can find inside the `scripts` folder, and then run `npm run test:integration`.
- If you want to run the integration test for the Elastic licensed APIs, you should run the `platinum` script, and - then run `TEST_ES_SERVER=https://elastic:changeme@localhost:9200 npm run test:integration`. + Usually run `npm test` is enough, our CI will take care of running the integration test. If you want to run the integration test yourself, see the *Testing* section below. 2. Submit a pull request @@ -60,6 +56,39 @@ Once your changes are ready to submit for review: but we'll do our best to dedicate it the attention it deserves. Your effort is much appreciated! +### Code generation + +The entire content of the API folder is generated as well as the `docs/reference.asciidoc` file.
+If you want to run the code generation you should run the following command: +```sh +node scripts/generate --tag +# or +node scripts/generate --branch +``` +Then you should copy the content of `api/generated.d.ts` into the `index.d.ts` file *(automate this step would be a nice pr!)*. + +### Testing +There are different test scripts, usually during development you only need to run `npm test`, but if you want you can run just a part of the suite, following you will find all the testing scripts and what they do. + +| Script | Description | +|---|---| +| `npm run test:unit` | Runs the content of the `test/unit` folder. | +| `npm run test:behavior` | Runs the content of the `test/behavior` folder. | +| `npm run test:types` | Runs the content of the `test/types` folder. | +| `npm run test:unit -- --cov --coverage-report=html` | Runs the content of the `test/unit` folder and calculates the code coverage. | +| `npm run test:integration` | Runs the integration test runner.
*Note: it requires a living instance of Elasticsearch.* | +| `npm run lint` | Run the [linter](https://standardjs.com/). | +| `npm run lint:fix` | Fixes the lint errors. | +| `npm test` | Runs lint, unit, behavior, and types test. | + +#### Integration test +The integration test are generated on the fly by the runner you will find inside `test/integration`, once you execute it, it will clone the Elasticsearch repository and checkout the correct version to grab the [OSS yaml files](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/test) and the [Elastic licensed yaml files](https://github.com/elastic/elasticsearch/tree/master/x-pack/plugin/src/test/resources/rest-api-spec/test) that will be used for generating the test. + +Usually this step is executed by CI since it takes some time, but you can easily run this yourself! Just follow this steps: +1. Boot an Elasticsearch instance, you can do that by running `./scripts/es-docker.sh` or `./scripts/es-docker-platinum.sh`, the first one will work only with the OSS APIs, while the second will work also with the Elastic licensed APIs; +1. If you are running the OSS test, you should use `npm run test:integration`, otherwise use `TEST_ES_SERVER=https://elastic:changeme@localhost:9200 npm run test:integration`. You can also pass a `-b` parameter if you want the test to bail out at the first failure: `npm run test:integration -- -b`; +1. Grab a coffee, it will take some time ;) + ### Releasing If you have access to make releases, the process is as follows: diff --git a/package.json b/package.json index 44de8821e..d33cd6593 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "test:behavior": "tap test/behavior/*.test.js -J -t 300", "test:integration": "tap test/integration/index.js -T --harmony --no-esm", "test:types": "tsc --project ./test/types/tsconfig.json", - "test:benchmarks": "nanobench test/benchmarks/*.bench.js", "test:coverage": "nyc npm run test:unit && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", "lint:fix": "standard --fix", diff --git a/scripts/run.js b/scripts/generate.js similarity index 100% rename from scripts/run.js rename to scripts/generate.js diff --git a/scripts/utils/generate.js b/scripts/utils/generateApis.js similarity index 100% rename from scripts/utils/generate.js rename to scripts/utils/generateApis.js diff --git a/scripts/utils/genMain.js b/scripts/utils/generateMain.js similarity index 100% rename from scripts/utils/genMain.js rename to scripts/utils/generateMain.js diff --git a/scripts/utils/index.js b/scripts/utils/index.js index 51169910b..77578cf9a 100644 --- a/scripts/utils/index.js +++ b/scripts/utils/index.js @@ -19,10 +19,10 @@ 'use strict' -const generate = require('./generate') +const generate = require('./generateApis') const generateRequestTypes = require('./generateRequestTypes') const cloneAndCheckout = require('./clone-es') -const genFactory = require('./genMain') +const genFactory = require('./generateMain') const generateDocs = require('./generateDocs') module.exports = { From e98edffd02bbe989d19544254c6b797baadee828 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 28 Mar 2019 17:34:45 +0100 Subject: [PATCH 06/84] Fix docs (#796) Follow up of https://github.com/elastic/docs/pull/701. --- docs/authentication.asciidoc | 1 + docs/breaking-changes.asciidoc | 1 + docs/child.asciidoc | 1 + docs/configuration.asciidoc | 1 + docs/extend.asciidoc | 1 + docs/introduction.asciidoc | 1 + docs/reference.asciidoc | 1 + docs/typescript.asciidoc | 1 + docs/usage.asciidoc | 1 + scripts/utils/generateDocs.js | 14 +++++++++++++- 10 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/authentication.asciidoc b/docs/authentication.asciidoc index bf75e5644..bd6a0fa30 100644 --- a/docs/authentication.asciidoc +++ b/docs/authentication.asciidoc @@ -1,3 +1,4 @@ +[[auth-reference]] == Authentication This document contains code snippets to show you how to connect to various Elasticsearch providers. diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc index 724f6ed56..c7ece5ac5 100644 --- a/docs/breaking-changes.asciidoc +++ b/docs/breaking-changes.asciidoc @@ -1,3 +1,4 @@ +[[breaking-changes]] == Breaking changes coming from the old client If you were already using the previous version of this client --i.e. the one you used to install with `npm install elasticsearch`-- you will encounter some breaking changes. diff --git a/docs/child.asciidoc b/docs/child.asciidoc index 2c58b013f..a86fded0a 100644 --- a/docs/child.asciidoc +++ b/docs/child.asciidoc @@ -1,3 +1,4 @@ +[[child-client]] == Creating a child client There are some use cases where you may need multiple instances of the client. You can easily do that by calling `new Client()` as many times as you need, but you will lose all the benefits of using one single client, such as the long living connections and the connection pool handling. + diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 60bca53cd..3df5caafc 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -1,3 +1,4 @@ +[[client-configuration]] == Client configuration The client is designed to be easily configured as you see fit for your needs, following you can see all the possible basic options that you can use to configure it. diff --git a/docs/extend.asciidoc b/docs/extend.asciidoc index 0c246e53a..de62ddd6a 100644 --- a/docs/extend.asciidoc +++ b/docs/extend.asciidoc @@ -1,3 +1,4 @@ +[[extend-client]] == Extend the client Sometimes you need to reuse the same logic, or you want to build a custom API to allow you simplify your code. + diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc index 5f0a2e73a..35bd75b3b 100644 --- a/docs/introduction.asciidoc +++ b/docs/introduction.asciidoc @@ -1,3 +1,4 @@ +[[introduction]] == Introduction The official Node.js client for Elasticsearch. diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 1ce137e78..5c9377cae 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1,3 +1,4 @@ +[[api-reference]] == API Reference //////// diff --git a/docs/typescript.asciidoc b/docs/typescript.asciidoc index 85f06d5b6..4dbe92054 100644 --- a/docs/typescript.asciidoc +++ b/docs/typescript.asciidoc @@ -1,3 +1,4 @@ +[[typescript]] == TypeScript support The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API. diff --git a/docs/usage.asciidoc b/docs/usage.asciidoc index ea0c39649..8065c120b 100644 --- a/docs/usage.asciidoc +++ b/docs/usage.asciidoc @@ -1,3 +1,4 @@ +[[client-usage]] == Usage Use the client is pretty straightforward, it supports all the public APIs of Elasticsearch, and every method exposes the same signature. diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index 49519ad9e..fc0dd8797 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -23,6 +23,7 @@ const dedent = require('dedent') function generateDocs (common, spec) { var doc = dedent` + [[api-reference]] == API Reference //////// @@ -68,7 +69,7 @@ function commonParameters (spec) { function generateApiDoc (spec) { const name = Object.keys(spec)[0] - const documentationUrl = spec[name].documentation + const documentationUrl = fixLink(spec[name].documentation) const params = [] // url params const urlParts = spec[name].url.parts @@ -139,6 +140,17 @@ function generateApiDoc (spec) { return doc } +// Fixes bad urls in the JSON spec +function fixLink (str) { + if (!str) return '' + if (str.includes('/5.x/')) { + // fixes wrong url in ES5 + str = str.replace(/5\.x/, '5.6') + } + + return str +} + function getType (type, options) { switch (type) { case 'list': From c92b156473c1f41b73b4a0116614c5aaa0477728 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 29 Mar 2019 03:50:08 -0400 Subject: [PATCH 07/84] Docs: Fix the API reference (#799) --- docs/index.asciidoc | 3 + docs/reference.asciidoc | 497 ++++++++++++++++------------------ scripts/utils/generateDocs.js | 37 ++- 3 files changed, 267 insertions(+), 270 deletions(-) diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 9995ab490..8569a45b3 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -1,5 +1,8 @@ = @elastic/elasticsearch +:branch: master +include::{asciidoc-dir}/../../shared/attributes.asciidoc[] + include::introduction.asciidoc[] include::usage.asciidoc[] include::configuration.asciidoc[] diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 5c9377cae..c448cef75 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -10,7 +10,8 @@ node scripts/run.js --tag v7.0.0-beta === Common parameters Parameters that are accepted by all API endpoints. -https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html + +link:{ref}/common-options.html[Reference] [cols=2*] |=== |`pretty` @@ -35,7 +36,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.h ---- client.bulk([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html +link:{ref}/docs-bulk.html[Reference] [cols=2*] |=== |`index` @@ -81,7 +82,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html ---- client.cat.aliases([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html +link:{ref}/cat-alias.html[Reference] [cols=2*] |=== |`name` @@ -115,7 +116,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html ---- client.cat.allocation([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html +link:{ref}/cat-allocation.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` @@ -152,7 +153,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.htm ---- client.cat.count([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html +link:{ref}/cat-count.html[Reference] [cols=2*] |=== |`index` @@ -186,7 +187,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html ---- client.cat.fielddata([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html +link:{ref}/cat-fielddata.html[Reference] [cols=2*] |=== |`fields` @@ -226,7 +227,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html ---- client.cat.health([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html +link:{ref}/cat-health.html[Reference] [cols=2*] |=== |`format` @@ -261,7 +262,7 @@ _Default:_ `true` ---- client.cat.help([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html +link:{ref}/cat.html[Reference] [cols=2*] |=== |`help` @@ -277,7 +278,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html ---- client.cat.indices([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html +link:{ref}/cat-indices.html[Reference] [cols=2*] |=== |`index` @@ -323,7 +324,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html ---- client.cat.master([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html +link:{ref}/cat-master.html[Reference] [cols=2*] |=== |`format` @@ -354,7 +355,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html ---- client.cat.nodeattrs([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html +link:{ref}/cat-nodeattrs.html[Reference] [cols=2*] |=== |`format` @@ -385,7 +386,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html ---- client.cat.nodes([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html +link:{ref}/cat-nodes.html[Reference] [cols=2*] |=== |`format` @@ -419,7 +420,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html ---- client.cat.pendingTasks([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html +link:{ref}/cat-pending-tasks.html[Reference] [cols=2*] |=== |`format` @@ -450,7 +451,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks. ---- client.cat.plugins([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html +link:{ref}/cat-plugins.html[Reference] [cols=2*] |=== |`format` @@ -481,7 +482,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html ---- client.cat.recovery([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html +link:{ref}/cat-recovery.html[Reference] [cols=2*] |=== |`index` @@ -515,7 +516,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html ---- client.cat.repositories([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html +link:{ref}/cat-repositories.html[Reference] [cols=2*] |=== |`format` @@ -546,7 +547,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.h ---- client.cat.segments([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html +link:{ref}/cat-segments.html[Reference] [cols=2*] |=== |`index` @@ -577,7 +578,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html ---- client.cat.shards([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html +link:{ref}/cat-shards.html[Reference] [cols=2*] |=== |`index` @@ -614,7 +615,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html ---- client.cat.snapshots([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html +link:{ref}/cat-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -648,7 +649,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html ---- client.cat.tasks([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html +link:{ref}/tasks.html[Reference] [cols=2*] |=== |`format` @@ -685,7 +686,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html ---- client.cat.templates([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html +link:{ref}/cat-templates.html[Reference] [cols=2*] |=== |`name` @@ -719,7 +720,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html ---- client.cat.threadPool([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html +link:{ref}/cat-thread-pool.html[Reference] [cols=2*] |=== |`thread_pool_patterns` or `threadPoolPatterns` @@ -756,7 +757,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.ht ---- client.clearScroll([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html +link:{ref}/search-request-scroll.html[Reference] [cols=2*] |=== |`scroll_id` or `scrollId` @@ -772,7 +773,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scr ---- client.cluster.allocationExplain([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html +link:{ref}/cluster-allocation-explain.html[Reference] [cols=2*] |=== |`include_yes_decisions` or `includeYesDecisions` @@ -791,7 +792,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation ---- client.cluster.getSettings([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html +link:{ref}/cluster-update-settings.html[Reference] [cols=2*] |=== |`flat_settings` or `flatSettings` @@ -813,7 +814,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-set ---- client.cluster.health([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html +link:{ref}/cluster-health.html[Reference] [cols=2*] |=== |`index` @@ -861,7 +862,7 @@ _Default:_ `cluster` ---- client.cluster.pendingTasks([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html +link:{ref}/cluster-pending.html[Reference] [cols=2*] |=== |`local` @@ -877,7 +878,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.ht ---- client.cluster.putSettings([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html +link:{ref}/cluster-update-settings.html[Reference] [cols=2*] |=== |`flat_settings` or `flatSettings` @@ -899,7 +900,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-set ---- client.cluster.remoteInfo([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html +link:{ref}/cluster-remote-info.html[Reference] === cluster.reroute @@ -907,7 +908,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-inf ---- client.cluster.reroute([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html +link:{ref}/cluster-reroute.html[Reference] [cols=2*] |=== |`dry_run` or `dryRun` @@ -938,7 +939,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.ht ---- client.cluster.state([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html +link:{ref}/cluster-state.html[Reference] [cols=2*] |=== |`index` @@ -979,7 +980,7 @@ _Default:_ `open` ---- client.cluster.stats([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html +link:{ref}/cluster-stats.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` @@ -998,7 +999,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html ---- client.count([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html +link:{ref}/search-count.html[Reference] [cols=2*] |=== |`index` @@ -1061,7 +1062,7 @@ _Default:_ `OR` ---- client.create([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html +link:{ref}/docs-index_.html[Reference] [cols=2*] |=== |`id` @@ -1107,7 +1108,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html ---- client.delete([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html +link:{ref}/docs-delete.html[Reference] [cols=2*] |=== |`id` @@ -1153,7 +1154,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html ---- client.deleteByQuery([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html +link:{ref}/docs-delete-by-query.html[Reference] [cols=2*] |=== |`index` @@ -1274,7 +1275,7 @@ _Default:_ `1` ---- client.deleteByQueryRethrottle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html +link:{ref}/docs-delete-by-query.html[Reference] [cols=2*] |=== |`task_id` or `taskId` @@ -1290,7 +1291,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-q ---- client.deleteScript([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +link:{ref}/modules-scripting.html[Reference] [cols=2*] |=== |`id` @@ -1309,7 +1310,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting. ---- client.exists([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +link:{ref}/docs-get.html[Reference] [cols=2*] |=== |`id` @@ -1361,7 +1362,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html ---- client.existsSource([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +link:{ref}/docs-get.html[Reference] [cols=2*] |=== |`id` @@ -1410,7 +1411,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html ---- client.explain([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html +link:{ref}/search-explain.html[Reference] [cols=2*] |=== |`id` @@ -1472,7 +1473,7 @@ _Default:_ `OR` ---- client.fieldCaps([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html +link:{ref}/search-field-caps.html[Reference] [cols=2*] |=== |`index` @@ -1498,7 +1499,7 @@ _Default:_ `open` ---- client.get([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +link:{ref}/docs-get.html[Reference] [cols=2*] |=== |`id` @@ -1556,7 +1557,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html ---- client.getScript([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +link:{ref}/modules-scripting.html[Reference] [cols=2*] |=== |`id` @@ -1572,7 +1573,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting. ---- client.getSource([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html +link:{ref}/docs-get.html[Reference] [cols=2*] |=== |`id` @@ -1621,7 +1622,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html ---- client.index([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html +link:{ref}/docs-index_.html[Reference] [cols=2*] |=== |`id` @@ -1677,7 +1678,7 @@ _Default:_ `index` ---- client.indices.analyze([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html +link:{ref}/indices-analyze.html[Reference] [cols=2*] |=== |`index` @@ -1696,7 +1697,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.ht ---- client.indices.clearCache([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html +link:{ref}/indices-clearcache.html[Reference] [cols=2*] |=== |`index` @@ -1734,7 +1735,7 @@ _Default:_ `open` ---- client.indices.close([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html +link:{ref}/indices-open-close.html[Reference] [cols=2*] |=== |`index` @@ -1766,7 +1767,7 @@ _Default:_ `open` ---- client.indices.create([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html +link:{ref}/indices-create-index.html[Reference] [cols=2*] |=== |`index` @@ -1794,7 +1795,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-ind ---- client.indices.delete([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html +link:{ref}/indices-delete-index.html[Reference] [cols=2*] |=== |`index` @@ -1823,7 +1824,7 @@ _Default:_ `open` ---- client.indices.deleteAlias([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` @@ -1845,7 +1846,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht ---- client.indices.deleteTemplate([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +link:{ref}/indices-templates.html[Reference] [cols=2*] |=== |`name` @@ -1864,7 +1865,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. ---- client.indices.exists([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html +link:{ref}/indices-exists.html[Reference] [cols=2*] |=== |`index` @@ -1896,7 +1897,7 @@ _Default:_ `open` ---- client.indices.existsAlias([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` @@ -1925,7 +1926,7 @@ _Default:_ `all` ---- client.indices.existsTemplate([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +link:{ref}/indices-templates.html[Reference] [cols=2*] |=== |`name` @@ -1947,7 +1948,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. ---- client.indices.existsType([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html +link:{ref}/indices-types-exists.html[Reference] [cols=2*] |=== |`index` @@ -1976,7 +1977,7 @@ _Default:_ `open` ---- client.indices.flush([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html +link:{ref}/indices-flush.html[Reference] [cols=2*] |=== |`index` @@ -2005,7 +2006,7 @@ _Default:_ `open` ---- client.indices.flushSynced([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html +link:{ref}/indices-synced-flush.html[Reference] [cols=2*] |=== |`index` @@ -2028,7 +2029,7 @@ _Default:_ `open` ---- client.indices.forcemerge([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html +link:{ref}/indices-forcemerge.html[Reference] [cols=2*] |=== |`index` @@ -2060,7 +2061,7 @@ _Default:_ `open` ---- client.indices.get([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html +link:{ref}/indices-get-index.html[Reference] [cols=2*] |=== |`index` @@ -2098,7 +2099,7 @@ _Default:_ `open` ---- client.indices.getAlias([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` @@ -2127,7 +2128,7 @@ _Default:_ `all` ---- client.indices.getFieldMapping([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html +link:{ref}/indices-get-field-mapping.html[Reference] [cols=2*] |=== |`index` @@ -2165,7 +2166,7 @@ _Default:_ `open` ---- client.indices.getMapping([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html +link:{ref}/indices-get-mapping.html[Reference] [cols=2*] |=== |`index` @@ -2200,7 +2201,7 @@ _Default:_ `open` ---- client.indices.getSettings([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html +link:{ref}/indices-get-settings.html[Reference] [cols=2*] |=== |`index` @@ -2238,7 +2239,7 @@ _Default:_ `open,closed` ---- client.indices.getTemplate([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +link:{ref}/indices-templates.html[Reference] [cols=2*] |=== |`name` @@ -2263,7 +2264,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. ---- client.indices.getUpgrade([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html +link:{ref}/indices-upgrade.html[Reference] [cols=2*] |=== |`index` @@ -2286,7 +2287,7 @@ _Default:_ `open` ---- client.indices.open([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html +link:{ref}/indices-open-close.html[Reference] [cols=2*] |=== |`index` @@ -2318,7 +2319,7 @@ _Default:_ `closed` ---- client.indices.putAlias([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` @@ -2343,7 +2344,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht ---- client.indices.putMapping([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html +link:{ref}/indices-put-mapping.html[Reference] [cols=2*] |=== |`index` @@ -2381,7 +2382,7 @@ _Default:_ `open` ---- client.indices.putSettings([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html +link:{ref}/indices-update-settings.html[Reference] [cols=2*] |=== |`index` @@ -2419,7 +2420,7 @@ _Default:_ `open` ---- client.indices.putTemplate([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html +link:{ref}/indices-templates.html[Reference] [cols=2*] |=== |`name` @@ -2453,7 +2454,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates. ---- client.indices.recovery([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html +link:{ref}/indices-recovery.html[Reference] [cols=2*] |=== |`index` @@ -2472,7 +2473,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.h ---- client.indices.refresh([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html +link:{ref}/indices-refresh.html[Reference] [cols=2*] |=== |`index` @@ -2495,7 +2496,7 @@ _Default:_ `open` ---- client.indices.rollover([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html +link:{ref}/indices-rollover-index.html[Reference] [cols=2*] |=== |`alias` @@ -2529,7 +2530,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-i ---- client.indices.segments([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html +link:{ref}/indices-segments.html[Reference] [cols=2*] |=== |`index` @@ -2555,7 +2556,7 @@ _Default:_ `open` ---- client.indices.shardStores([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html +link:{ref}/indices-shards-stores.html[Reference] [cols=2*] |=== |`index` @@ -2581,7 +2582,7 @@ _Default:_ `open` ---- client.indices.shrink([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html +link:{ref}/indices-shrink-index.html[Reference] [cols=2*] |=== |`index` @@ -2609,7 +2610,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-ind ---- client.indices.split([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html +link:{ref}/indices-split-index.html[Reference] [cols=2*] |=== |`index` @@ -2637,7 +2638,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-inde ---- client.indices.stats([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html +link:{ref}/indices-stats.html[Reference] [cols=2*] |=== |`index` @@ -2686,7 +2687,7 @@ _Default:_ `true` ---- client.indices.updateAliases([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html +link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`timeout` @@ -2705,7 +2706,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.ht ---- client.indices.upgrade([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html +link:{ref}/indices-upgrade.html[Reference] [cols=2*] |=== |`index` @@ -2734,7 +2735,7 @@ _Default:_ `open` ---- client.indices.validateQuery([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html +link:{ref}/search-validate.html[Reference] [cols=2*] |=== |`index` @@ -2791,7 +2792,7 @@ _Default:_ `OR` ---- client.info([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/ +link:http://www.elastic.co/guide/[Reference] === ingest.deletePipeline @@ -2799,7 +2800,7 @@ http://www.elastic.co/guide/ ---- client.ingest.deletePipeline([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html +link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] [cols=2*] |=== |`id` @@ -2818,7 +2819,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html ---- client.ingest.getPipeline([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html +link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] [cols=2*] |=== |`id` @@ -2834,7 +2835,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html ---- client.ingest.processorGrok([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html +link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] === ingest.putPipeline @@ -2842,7 +2843,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html ---- client.ingest.putPipeline([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html +link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] [cols=2*] |=== |`id` @@ -2864,7 +2865,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html ---- client.ingest.simulate([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html +link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] [cols=2*] |=== |`id` @@ -2883,7 +2884,7 @@ https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html ---- client.mget([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html +link:{ref}/docs-multi-get.html[Reference] [cols=2*] |=== |`index` @@ -2926,7 +2927,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.htm ---- client.msearch([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html +link:{ref}/search-multi-search.html[Reference] [cols=2*] |=== |`index` @@ -2969,7 +2970,7 @@ _Default:_ `true` ---- client.msearchTemplate([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html +link:{ref}/search-multi-search.html[Reference] [cols=2*] |=== |`index` @@ -3004,7 +3005,7 @@ _Default:_ `true` ---- client.mtermvectors([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html +link:{ref}/docs-multi-termvectors.html[Reference] [cols=2*] |=== |`index` @@ -3066,7 +3067,7 @@ _Default:_ `true` ---- client.nodes.hotThreads([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html +link:{ref}/cluster-nodes-hot-threads.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` @@ -3097,7 +3098,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot- ---- client.nodes.info([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html +link:{ref}/cluster-nodes-info.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` @@ -3119,7 +3120,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info ---- client.nodes.reloadSecureSettings([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings +link:https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings[Reference] [cols=2*] |=== |`node_id` or `nodeId` @@ -3135,7 +3136,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.h ---- client.nodes.stats([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html +link:{ref}/cluster-nodes-stats.html[Reference] [cols=2*] |=== |`metric` @@ -3179,7 +3180,7 @@ _Default:_ `node` ---- client.nodes.usage([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html +link:{ref}/cluster-nodes-usage.html[Reference] [cols=2*] |=== |`metric` @@ -3198,7 +3199,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usag ---- client.ping([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/ +link:http://www.elastic.co/guide/[Reference] === putScript @@ -3206,7 +3207,7 @@ http://www.elastic.co/guide/ ---- client.putScript([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html +link:{ref}/modules-scripting.html[Reference] [cols=2*] |=== |`id` @@ -3234,7 +3235,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting. ---- client.rankEval([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html +link:{ref}/search-rank-eval.html[Reference] [cols=2*] |=== |`index` @@ -3260,7 +3261,7 @@ _Default:_ `open` ---- client.reindex([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html +link:{ref}/docs-reindex.html[Reference] [cols=2*] |=== |`refresh` @@ -3298,7 +3299,7 @@ _Default:_ `1` ---- client.reindexRethrottle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html +link:{ref}/docs-reindex.html[Reference] [cols=2*] |=== |`task_id` or `taskId` @@ -3314,7 +3315,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html ---- client.renderSearchTemplate([params] [, options] [, callback]) ---- -http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html +link:{ref}/search-template.html[Reference] [cols=2*] |=== |`id` @@ -3330,7 +3331,6 @@ http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-temp ---- client.scriptsPainlessContext([params] [, options] [, callback]) ---- - [cols=2*] |=== |`context` @@ -3343,7 +3343,7 @@ client.scriptsPainlessContext([params] [, options] [, callback]) ---- client.scriptsPainlessExecute([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html +link:https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html[Reference] [cols=2*] |=== |`body` @@ -3356,7 +3356,7 @@ https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-a ---- client.scroll([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html +link:{ref}/search-request-scroll.html[Reference] [cols=2*] |=== |`scroll_id` or `scrollId` @@ -3381,7 +3381,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scr ---- client.search([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html +link:{ref}/search-search.html[Reference] [cols=2*] |=== |`index` @@ -3534,7 +3534,7 @@ _Default:_ `128` ---- client.searchShards([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html +link:{ref}/search-shards.html[Reference] [cols=2*] |=== |`index` @@ -3566,7 +3566,7 @@ _Default:_ `open` ---- client.searchTemplate([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html +link:{ref}/search-template.html[Reference] [cols=2*] |=== |`index` @@ -3626,7 +3626,7 @@ _Default:_ `true` ---- client.snapshot.create([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3651,7 +3651,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.createRepository([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3676,7 +3676,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.delete([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3695,7 +3695,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.deleteRepository([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3714,7 +3714,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.get([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3739,7 +3739,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.getRepository([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3758,7 +3758,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.restore([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3783,7 +3783,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.status([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3805,7 +3805,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.snapshot.verifyRepository([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html +link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` @@ -3824,7 +3824,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots. ---- client.tasks.cancel([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html +link:{ref}/tasks.html[Reference] [cols=2*] |=== |`task_id` or `taskId` @@ -3846,7 +3846,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html ---- client.tasks.get([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html +link:{ref}/tasks.html[Reference] [cols=2*] |=== |`task_id` or `taskId` @@ -3865,7 +3865,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html ---- client.tasks.list([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html +link:{ref}/tasks.html[Reference] [cols=2*] |=== |`nodes` @@ -3897,7 +3897,7 @@ _Default:_ `nodes` ---- client.termvectors([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html +link:{ref}/docs-termvectors.html[Reference] [cols=2*] |=== |`index` @@ -3959,7 +3959,7 @@ _Default:_ `true` ---- client.update([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html +link:{ref}/docs-update.html[Reference] [cols=2*] |=== |`id` @@ -4017,7 +4017,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html ---- client.updateByQuery([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html +link:{ref}/docs-update-by-query.html[Reference] [cols=2*] |=== |`index` @@ -4144,7 +4144,7 @@ _Default:_ `1` ---- client.updateByQueryRethrottle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html +link:{ref}/docs-update-by-query.html[Reference] [cols=2*] |=== |`task_id` or `taskId` @@ -4160,7 +4160,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-q ---- client.ccr.deleteAutoFollowPattern([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html +link:{ref}/ccr-delete-auto-follow-pattern.html[Reference] [cols=2*] |=== |`name` @@ -4173,7 +4173,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto- ---- client.ccr.follow([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html +link:{ref}/ccr-put-follow.html[Reference] [cols=2*] |=== |`index` @@ -4193,7 +4193,7 @@ _Default:_ `0` ---- client.ccr.followInfo([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html +link:{ref}/ccr-get-follow-info.html[Reference] [cols=2*] |=== |`index` @@ -4206,7 +4206,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-i ---- client.ccr.followStats([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html +link:{ref}/ccr-get-follow-stats.html[Reference] [cols=2*] |=== |`index` @@ -4219,7 +4219,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-s ---- client.ccr.forgetFollower([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current +link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] [cols=2*] |=== |`index` @@ -4235,7 +4235,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current ---- client.ccr.getAutoFollowPattern([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html +link:{ref}/ccr-get-auto-follow-pattern.html[Reference] [cols=2*] |=== |`name` @@ -4248,7 +4248,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-fol ---- client.ccr.pauseFollow([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html +link:{ref}/ccr-post-pause-follow.html[Reference] [cols=2*] |=== |`index` @@ -4261,7 +4261,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-f ---- client.ccr.putAutoFollowPattern([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html +link:{ref}/ccr-put-auto-follow-pattern.html[Reference] [cols=2*] |=== |`name` @@ -4277,7 +4277,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-fol ---- client.ccr.resumeFollow([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html +link:{ref}/ccr-post-resume-follow.html[Reference] [cols=2*] |=== |`index` @@ -4293,7 +4293,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume- ---- client.ccr.stats([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html +link:{ref}/ccr-get-stats.html[Reference] === ccr.unfollow @@ -4301,7 +4301,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.ht ---- client.ccr.unfollow([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current +link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] [cols=2*] |=== |`index` @@ -4314,7 +4314,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current ---- client.dataFrame.deleteDataFrameTransform([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html +link:{ref}/delete-data-frame-transform.html[Reference] [cols=2*] |=== |`transform_id` or `transformId` @@ -4327,7 +4327,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-fram ---- client.dataFrame.getDataFrameTransform([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html +link:{ref}/get-data-frame-transform.html[Reference] [cols=2*] |=== |`transform_id` or `transformId` @@ -4346,7 +4346,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-t ---- client.dataFrame.getDataFrameTransformStats([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html +link:{ref}/get-data-frame-transform-stats.html[Reference] [cols=2*] |=== |`transform_id` or `transformId` @@ -4359,7 +4359,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-t ---- client.dataFrame.previewDataFrameTransform([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html +link:{ref}/preview-data-frame-transform.html[Reference] [cols=2*] |=== |`body` @@ -4372,7 +4372,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-fra ---- client.dataFrame.putDataFrameTransform([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html +link:{ref}/put-data-frame-transform.html[Reference] [cols=2*] |=== |`transform_id` or `transformId` @@ -4388,7 +4388,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-t ---- client.dataFrame.startDataFrameTransform([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html +link:{ref}/start-data-frame-transform.html[Reference] [cols=2*] |=== |`transform_id` or `transformId` @@ -4404,7 +4404,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame ---- client.dataFrame.stopDataFrameTransform([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html +link:{ref}/stop-data-frame-transform.html[Reference] [cols=2*] |=== |`transform_id` or `transformId` @@ -4423,7 +4423,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame- ---- client.graph.explore([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html +link:{ref}/graph-explore-api.html[Reference] [cols=2*] |=== |`index` @@ -4448,7 +4448,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-ap ---- client.ilm.deleteLifecycle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html +link:{ref}/ilm-delete-lifecycle.html[Reference] [cols=2*] |=== |`policy` @@ -4461,7 +4461,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifec ---- client.ilm.explainLifecycle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html +link:{ref}/ilm-explain-lifecycle.html[Reference] [cols=2*] |=== |`index` @@ -4474,7 +4474,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-life ---- client.ilm.getLifecycle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html +link:{ref}/ilm-get-lifecycle.html[Reference] [cols=2*] |=== |`policy` @@ -4487,7 +4487,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycl ---- client.ilm.getStatus([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html +link:{ref}/ilm-get-status.html[Reference] === ilm.moveToStep @@ -4495,7 +4495,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.h ---- client.ilm.moveToStep([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html +link:{ref}/ilm-move-to-step.html[Reference] [cols=2*] |=== |`index` @@ -4511,7 +4511,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step ---- client.ilm.putLifecycle([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html +link:{ref}/ilm-put-lifecycle.html[Reference] [cols=2*] |=== |`policy` @@ -4527,7 +4527,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycl ---- client.ilm.removePolicy([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html +link:{ref}/ilm-remove-policy.html[Reference] [cols=2*] |=== |`index` @@ -4540,7 +4540,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-polic ---- client.ilm.retry([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html +link:{ref}/ilm-retry-policy.html[Reference] [cols=2*] |=== |`index` @@ -4553,7 +4553,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy ---- client.ilm.start([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html +link:{ref}/ilm-start.html[Reference] === ilm.stop @@ -4561,7 +4561,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html ---- client.ilm.stop([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html +link:{ref}/ilm-stop.html[Reference] === indices.freeze @@ -4569,7 +4569,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html ---- client.indices.freeze([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html +link:{ref}/freeze-index-api.html[Reference] [cols=2*] |=== |`index` @@ -4601,7 +4601,7 @@ _Default:_ `closed` ---- client.indices.unfreeze([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html +link:{ref}/freeze-index-api.html[Reference] [cols=2*] |=== |`index` @@ -4633,7 +4633,7 @@ _Default:_ `closed` ---- client.license.delete([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/delete-license.html[Reference] === license.get @@ -4641,7 +4641,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.license.get([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/get-license.html[Reference] [cols=2*] |=== |`local` @@ -4654,7 +4654,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.license.getBasicStatus([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/get-basic-status.html[Reference] === license.getTrialStatus @@ -4662,7 +4662,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.license.getTrialStatus([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/get-trial-status.html[Reference] === license.post @@ -4670,7 +4670,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.license.post([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/update-license.html[Reference] [cols=2*] |=== |`acknowledge` @@ -4686,7 +4686,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.license.postStartBasic([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/start-basic.html[Reference] [cols=2*] |=== |`acknowledge` @@ -4699,7 +4699,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.license.postStartTrial([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/x-pack/current/license-management.html +link:{ref}/start-trial.html[Reference] [cols=2*] |=== |`type` @@ -4715,7 +4715,7 @@ https://www.elastic.co/guide/en/x-pack/current/license-management.html ---- client.migration.deprecations([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html +link:{ref}/migration-api-deprecation.html[Reference] [cols=2*] |=== |`index` @@ -4728,7 +4728,7 @@ http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html ---- client.ml.closeJob([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html +link:{ref}/ml-close-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -4753,7 +4753,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html ---- client.ml.deleteCalendar([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -4766,7 +4765,6 @@ client.ml.deleteCalendar([params] [, options] [, callback]) ---- client.ml.deleteCalendarEvent([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -4782,7 +4780,6 @@ client.ml.deleteCalendarEvent([params] [, options] [, callback]) ---- client.ml.deleteCalendarJob([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -4798,7 +4795,7 @@ client.ml.deleteCalendarJob([params] [, options] [, callback]) ---- client.ml.deleteDatafeed([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html +link:{ref}/ml-delete-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -4816,13 +4813,11 @@ client.ml.deleteExpiredData([params] [, options] [, callback]) ---- - === ml.deleteFilter [source,js] ---- client.ml.deleteFilter([params] [, options] [, callback]) ---- - [cols=2*] |=== |`filter_id` or `filterId` @@ -4835,7 +4830,7 @@ client.ml.deleteFilter([params] [, options] [, callback]) ---- client.ml.deleteForecast([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html +link:{ref}/ml-delete-forecast.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -4857,7 +4852,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecas ---- client.ml.deleteJob([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html +link:{ref}/ml-delete-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -4877,7 +4872,7 @@ _Default:_ `true` ---- client.ml.deleteModelSnapshot([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html +link:{ref}/ml-delete-snapshot.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -4893,7 +4888,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapsho ---- client.ml.findFileStructure([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure.html +link:{ref}/ml-find-file-structure.html[Reference] [cols=2*] |=== |`lines_to_sample` or `linesToSample` @@ -4947,7 +4942,7 @@ _Default:_ `25s` ---- client.ml.flushJob([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html +link:{ref}/ml-flush-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -4978,7 +4973,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html ---- client.ml.forecast([params] [, options] [, callback]) ---- - [cols=2*] |=== |`job_id` or `jobId` @@ -4997,7 +4991,7 @@ client.ml.forecast([params] [, options] [, callback]) ---- client.ml.getBuckets([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html +link:{ref}/ml-get-bucket.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5043,7 +5037,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.htm ---- client.ml.getCalendarEvents([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -5071,7 +5064,6 @@ client.ml.getCalendarEvents([params] [, options] [, callback]) ---- client.ml.getCalendars([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -5093,7 +5085,7 @@ client.ml.getCalendars([params] [, options] [, callback]) ---- client.ml.getCategories([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html +link:{ref}/ml-get-category.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5118,7 +5110,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.h ---- client.ml.getDatafeedStats([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html +link:{ref}/ml-get-datafeed-stats.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5134,7 +5126,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-s ---- client.ml.getDatafeeds([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html +link:{ref}/ml-get-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5150,7 +5142,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.h ---- client.ml.getFilters([params] [, options] [, callback]) ---- - [cols=2*] |=== |`filter_id` or `filterId` @@ -5169,7 +5160,7 @@ client.ml.getFilters([params] [, options] [, callback]) ---- client.ml.getInfluencers([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html +link:{ref}/ml-get-influencer.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5209,7 +5200,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer ---- client.ml.getJobStats([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html +link:{ref}/ml-get-job-stats.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5225,7 +5216,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats. ---- client.ml.getJobs([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html +link:{ref}/ml-get-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5241,7 +5232,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html ---- client.ml.getModelSnapshots([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html +link:{ref}/ml-get-snapshot.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5278,7 +5269,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.h ---- client.ml.getOverallBuckets([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html +link:{ref}/ml-get-overall-buckets.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5315,7 +5306,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-bu ---- client.ml.getRecords([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html +link:{ref}/ml-get-record.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5357,13 +5348,12 @@ client.ml.info([params] [, options] [, callback]) ---- - === ml.openJob [source,js] ---- client.ml.openJob([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html +link:{ref}/ml-open-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5382,7 +5372,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html ---- client.ml.postCalendarEvents([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -5398,7 +5387,7 @@ client.ml.postCalendarEvents([params] [, options] [, callback]) ---- client.ml.postData([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html +link:{ref}/ml-post-data.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5420,7 +5409,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html ---- client.ml.previewDatafeed([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html +link:{ref}/ml-preview-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5433,7 +5422,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafe ---- client.ml.putCalendar([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -5449,7 +5437,6 @@ client.ml.putCalendar([params] [, options] [, callback]) ---- client.ml.putCalendarJob([params] [, options] [, callback]) ---- - [cols=2*] |=== |`calendar_id` or `calendarId` @@ -5465,7 +5452,7 @@ client.ml.putCalendarJob([params] [, options] [, callback]) ---- client.ml.putDatafeed([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html +link:{ref}/ml-put-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5481,7 +5468,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.h ---- client.ml.putFilter([params] [, options] [, callback]) ---- - [cols=2*] |=== |`filter_id` or `filterId` @@ -5497,7 +5483,7 @@ client.ml.putFilter([params] [, options] [, callback]) ---- client.ml.putJob([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html +link:{ref}/ml-put-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5513,7 +5499,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html ---- client.ml.revertModelSnapshot([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html +link:{ref}/ml-revert-snapshot.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5535,7 +5521,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapsho ---- client.ml.setUpgradeMode([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html +link:{ref}/ml-set-upgrade-mode.html[Reference] [cols=2*] |=== |`enabled` @@ -5551,7 +5537,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mo ---- client.ml.startDatafeed([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html +link:{ref}/ml-start-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5576,7 +5562,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed ---- client.ml.stopDatafeed([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html +link:{ref}/ml-stop-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5598,7 +5584,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed. ---- client.ml.updateDatafeed([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html +link:{ref}/ml-update-datafeed.html[Reference] [cols=2*] |=== |`datafeed_id` or `datafeedId` @@ -5614,7 +5600,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafee ---- client.ml.updateFilter([params] [, options] [, callback]) ---- - [cols=2*] |=== |`filter_id` or `filterId` @@ -5630,7 +5615,7 @@ client.ml.updateFilter([params] [, options] [, callback]) ---- client.ml.updateJob([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html +link:{ref}/ml-update-job.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5646,7 +5631,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.htm ---- client.ml.updateModelSnapshot([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html +link:{ref}/ml-update-snapshot.html[Reference] [cols=2*] |=== |`job_id` or `jobId` @@ -5665,7 +5650,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapsho ---- client.ml.validate([params] [, options] [, callback]) ---- - [cols=2*] |=== |`body` @@ -5678,7 +5662,6 @@ client.ml.validate([params] [, options] [, callback]) ---- client.ml.validateDetector([params] [, options] [, callback]) ---- - [cols=2*] |=== |`body` @@ -5691,7 +5674,7 @@ client.ml.validateDetector([params] [, options] [, callback]) ---- client.monitoring.bulk([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html +link:{ref}/es-monitoring.html[Reference] [cols=2*] |=== |`type` @@ -5716,7 +5699,6 @@ http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html ---- client.rollup.deleteJob([params] [, options] [, callback]) ---- - [cols=2*] |=== |`id` @@ -5729,7 +5711,6 @@ client.rollup.deleteJob([params] [, options] [, callback]) ---- client.rollup.getJobs([params] [, options] [, callback]) ---- - [cols=2*] |=== |`id` @@ -5742,7 +5723,6 @@ client.rollup.getJobs([params] [, options] [, callback]) ---- client.rollup.getRollupCaps([params] [, options] [, callback]) ---- - [cols=2*] |=== |`id` @@ -5755,7 +5735,6 @@ client.rollup.getRollupCaps([params] [, options] [, callback]) ---- client.rollup.getRollupIndexCaps([params] [, options] [, callback]) ---- - [cols=2*] |=== |`index` @@ -5768,7 +5747,6 @@ client.rollup.getRollupIndexCaps([params] [, options] [, callback]) ---- client.rollup.putJob([params] [, options] [, callback]) ---- - [cols=2*] |=== |`id` @@ -5784,7 +5762,6 @@ client.rollup.putJob([params] [, options] [, callback]) ---- client.rollup.rollupSearch([params] [, options] [, callback]) ---- - [cols=2*] |=== |`index` @@ -5809,7 +5786,6 @@ client.rollup.rollupSearch([params] [, options] [, callback]) ---- client.rollup.startJob([params] [, options] [, callback]) ---- - [cols=2*] |=== |`id` @@ -5822,7 +5798,6 @@ client.rollup.startJob([params] [, options] [, callback]) ---- client.rollup.stopJob([params] [, options] [, callback]) ---- - [cols=2*] |=== |`id` @@ -5841,7 +5816,7 @@ client.rollup.stopJob([params] [, options] [, callback]) ---- client.security.authenticate([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html +link:{ref}/security-api-authenticate.html[Reference] === security.changePassword @@ -5849,7 +5824,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-aut ---- client.security.changePassword([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html +link:{ref}/security-api-change-password.html[Reference] [cols=2*] |=== |`username` @@ -5868,7 +5843,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cha ---- client.security.clearCachedRealms([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html +link:{ref}/security-api-clear-cache.html[Reference] [cols=2*] |=== |`realms` @@ -5884,7 +5859,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cle ---- client.security.clearCachedRoles([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html +link:{ref}/security-api-clear-role-cache.html[Reference] [cols=2*] |=== |`name` @@ -5897,7 +5872,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cle ---- client.security.createApiKey([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html +link:{ref}/security-api-create-api-key.html[Reference] [cols=2*] |=== |`refresh` @@ -5913,7 +5888,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-cre ---- client.security.deletePrivileges([params] [, options] [, callback]) ---- -TODO +link:TODO[Reference] [cols=2*] |=== |`application` @@ -5932,7 +5907,7 @@ TODO ---- client.security.deleteRole([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html +link:{ref}/security-api-delete-role.html[Reference] [cols=2*] |=== |`name` @@ -5948,7 +5923,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-del ---- client.security.deleteRoleMapping([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html +link:{ref}/security-api-delete-role-mapping.html[Reference] [cols=2*] |=== |`name` @@ -5964,7 +5939,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-del ---- client.security.deleteUser([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html +link:{ref}/security-api-delete-user.html[Reference] [cols=2*] |=== |`username` @@ -5980,7 +5955,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-del ---- client.security.disableUser([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html +link:{ref}/security-api-disable-user.html[Reference] [cols=2*] |=== |`username` @@ -5996,7 +5971,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-dis ---- client.security.enableUser([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html +link:{ref}/security-api-enable-user.html[Reference] [cols=2*] |=== |`username` @@ -6012,7 +5987,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ena ---- client.security.getApiKey([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html +link:{ref}/security-api-get-api-key.html[Reference] [cols=2*] |=== |`id` @@ -6034,7 +6009,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get ---- client.security.getPrivileges([params] [, options] [, callback]) ---- -TODO +link:TODO[Reference] [cols=2*] |=== |`application` @@ -6050,7 +6025,7 @@ TODO ---- client.security.getRole([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html +link:{ref}/security-api-get-role.html[Reference] [cols=2*] |=== |`name` @@ -6063,7 +6038,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get ---- client.security.getRoleMapping([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html +link:{ref}/security-api-get-role-mapping.html[Reference] [cols=2*] |=== |`name` @@ -6076,7 +6051,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get ---- client.security.getToken([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html +link:{ref}/security-api-get-token.html[Reference] [cols=2*] |=== |`body` @@ -6089,7 +6064,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get ---- client.security.getUser([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html +link:{ref}/security-api-get-user.html[Reference] [cols=2*] |=== |`username` @@ -6102,7 +6077,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get ---- client.security.getUserPrivileges([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html +link:{ref}/security-api-get-privileges.html[Reference] === security.hasPrivileges @@ -6110,7 +6085,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get ---- client.security.hasPrivileges([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html +link:{ref}/security-api-has-privileges.html[Reference] [cols=2*] |=== |`user` @@ -6126,7 +6101,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has ---- client.security.invalidateApiKey([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html +link:{ref}/security-api-invalidate-api-key.html[Reference] [cols=2*] |=== |`body` @@ -6139,7 +6114,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-inv ---- client.security.invalidateToken([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html +link:{ref}/security-api-invalidate-token.html[Reference] [cols=2*] |=== |`body` @@ -6152,7 +6127,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-inv ---- client.security.putPrivileges([params] [, options] [, callback]) ---- -TODO +link:TODO[Reference] [cols=2*] |=== |`refresh` @@ -6168,7 +6143,7 @@ TODO ---- client.security.putRole([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html +link:{ref}/security-api-put-role.html[Reference] [cols=2*] |=== |`name` @@ -6187,7 +6162,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put ---- client.security.putRoleMapping([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html +link:{ref}/security-api-put-role-mapping.html[Reference] [cols=2*] |=== |`name` @@ -6206,7 +6181,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put ---- client.security.putUser([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html +link:{ref}/security-api-put-user.html[Reference] [cols=2*] |=== |`username` @@ -6225,7 +6200,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put ---- client.sql.clearCursor([params] [, options] [, callback]) ---- -Clear SQL cursor +link:Clear SQL cursor[Reference] [cols=2*] |=== |`body` @@ -6238,7 +6213,7 @@ Clear SQL cursor ---- client.sql.query([params] [, options] [, callback]) ---- -Execute SQL +link:Execute SQL[Reference] [cols=2*] |=== |`format` @@ -6254,7 +6229,7 @@ Execute SQL ---- client.sql.translate([params] [, options] [, callback]) ---- -Translate SQL into Elasticsearch queries +link:Translate SQL into Elasticsearch queries[Reference] [cols=2*] |=== |`body` @@ -6267,7 +6242,7 @@ Translate SQL into Elasticsearch queries ---- client.ssl.certificates([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html +link:{ref}/security-api-ssl.html[Reference] === watcher.ackWatch @@ -6275,7 +6250,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl ---- client.watcher.ackWatch([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html +link:{ref}/watcher-api-ack-watch.html[Reference] [cols=2*] |=== |`watch_id` or `watchId` @@ -6291,7 +6266,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-w ---- client.watcher.activateWatch([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html +link:{ref}/watcher-api-activate-watch.html[Reference] [cols=2*] |=== |`watch_id` or `watchId` @@ -6304,7 +6279,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-acti ---- client.watcher.deactivateWatch([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html +link:{ref}/watcher-api-deactivate-watch.html[Reference] [cols=2*] |=== |`watch_id` or `watchId` @@ -6317,7 +6292,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deac ---- client.watcher.deleteWatch([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html +link:{ref}/watcher-api-delete-watch.html[Reference] [cols=2*] |=== |`id` @@ -6330,7 +6305,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delet ---- client.watcher.executeWatch([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html +link:{ref}/watcher-api-execute-watch.html[Reference] [cols=2*] |=== |`id` @@ -6349,7 +6324,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execu ---- client.watcher.getWatch([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html +link:{ref}/watcher-api-get-watch.html[Reference] [cols=2*] |=== |`id` @@ -6362,7 +6337,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-w ---- client.watcher.putWatch([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html +link:{ref}/watcher-api-put-watch.html[Reference] [cols=2*] |=== |`id` @@ -6390,7 +6365,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-w ---- client.watcher.start([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html +link:{ref}/watcher-api-start.html[Reference] === watcher.stats @@ -6398,7 +6373,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start ---- client.watcher.stats([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html +link:{ref}/watcher-api-stats.html[Reference] [cols=2*] |=== |`metric` @@ -6417,7 +6392,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats ---- client.watcher.stop([params] [, options] [, callback]) ---- -http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html +link:{ref}/watcher-api-stop.html[Reference] === xpack.info @@ -6425,7 +6400,7 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop. ---- client.xpack.info([params] [, options] [, callback]) ---- -https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html +link:{ref}/info-api.html[Reference] [cols=2*] |=== |`categories` @@ -6438,7 +6413,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html ---- client.xpack.usage([params] [, options] [, callback]) ---- -Retrieve information about xpack features usage +link:Retrieve information about xpack features usage[Reference] [cols=2*] |=== |`master_timeout` or `masterTimeout` diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index fc0dd8797..c9d531f20 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -43,7 +43,8 @@ function commonParameters (spec) { var doc = dedent` === Common parameters Parameters that are accepted by all API endpoints. - https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html + + link:{ref}/common-options.html[Reference] [cols=2*] |===\n` Object.keys(spec.params).forEach(key => { @@ -69,7 +70,7 @@ function commonParameters (spec) { function generateApiDoc (spec) { const name = Object.keys(spec)[0] - const documentationUrl = fixLink(spec[name].documentation) + const documentationUrl = fixLink(name, spec[name].documentation) const params = [] // url params const urlParts = spec[name].url.parts @@ -113,8 +114,10 @@ function generateApiDoc (spec) { [source,js] ---- client.${camelify(name)}([params] [, options] [, callback]) - ---- - ${documentationUrl || ''}\n` + ----\n` + if (documentationUrl) { + doc += `link:${documentationUrl}[Reference]\n` + } if (params.length !== 0) { doc += dedent`[cols=2*] @@ -140,13 +143,29 @@ function generateApiDoc (spec) { return doc } +const LINK_OVERRIDES = { + 'license.delete': '{ref}/delete-license.html', + 'license.get': '{ref}/get-license.html', + 'license.get_basic_status': '{ref}/get-basic-status.html', + 'license.get_trial_status': '{ref}/get-trial-status.html', + 'license.post': '{ref}/update-license.html', + 'license.post_start_basic': '{ref}/start-basic.html', + 'license.post_start_trial': '{ref}/start-trial.html', + 'migration.deprecations': '{ref}/migration-api-deprecation.html', + 'monitoring.bulk': '{ref}/es-monitoring.html' +} // Fixes bad urls in the JSON spec -function fixLink (str) { +function fixLink (name, str) { + const override = LINK_OVERRIDES[name] + if (override) return override if (!str) return '' - if (str.includes('/5.x/')) { - // fixes wrong url in ES5 - str = str.replace(/5\.x/, '5.6') - } + /* Replace references to the guide with the attribute {ref} because + * the json files in the Elasticsearch repo are a bit of a mess. */ + str = str.replace(/^.+guide\/en\/elasticsearch\/reference\/[^/]+\/([^./]*\.html)$/, '{ref}/$1') + str = str.replace(/frozen\.html/, 'freeze-index-api.html') + str = str.replace(/ml-file-structure\.html/, 'ml-find-file-structure.html') + str = str.replace(/security-api-get-user-privileges\.html/, 'security-api-get-privileges.html') + str = str.replace(/security-api-get-user-privileges\.html/, 'security-api-get-privileges.html') return str } From 0073756d3ab842b2b935d65bd4c699aae6ce5728 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 29 Mar 2019 10:44:47 -0400 Subject: [PATCH 08/84] Docs: Handle more funny cases from ES api spec (#800) Handles a few "special" doc urls from ES's api spec files. These are only a problem in 6.x but we'd like to keep the generateDocs script the same across all branches for easier backporting. --- scripts/utils/generateDocs.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index c9d531f20..81b846b35 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -156,12 +156,15 @@ const LINK_OVERRIDES = { } // Fixes bad urls in the JSON spec function fixLink (name, str) { + /* In 6.x some API start with `xpack.` when in master they do not. We + * can safely ignore that for link generation. */ + name = name.replace(/^xpack\./, '') const override = LINK_OVERRIDES[name] if (override) return override if (!str) return '' /* Replace references to the guide with the attribute {ref} because * the json files in the Elasticsearch repo are a bit of a mess. */ - str = str.replace(/^.+guide\/en\/elasticsearch\/reference\/[^/]+\/([^./]*\.html)$/, '{ref}/$1') + str = str.replace(/^.+guide\/en\/elasticsearch\/reference\/[^/]+\/([^./]*\.html(?:#.+)?)$/, '{ref}/$1') str = str.replace(/frozen\.html/, 'freeze-index-api.html') str = str.replace(/ml-file-structure\.html/, 'ml-find-file-structure.html') str = str.replace(/security-api-get-user-privileges\.html/, 'security-api-get-privileges.html') From 02e24ea98115a49c0c98cb40afd32a72838b8f48 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 29 Mar 2019 15:46:01 +0100 Subject: [PATCH 09/84] Generated reference --- docs/reference.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index c448cef75..9c9349d08 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -3120,7 +3120,7 @@ link:{ref}/cluster-nodes-info.html[Reference] ---- client.nodes.reloadSecureSettings([params] [, options] [, callback]) ---- -link:https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings[Reference] +link:{ref}/secure-settings.html#reloadable-secure-settings[Reference] [cols=2*] |=== |`node_id` or `nodeId` From 373957c55cbdcf51c543fe3df67c2b267e1e344c Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 29 Mar 2019 13:07:35 -0400 Subject: [PATCH 10/84] Docs: Fix ingest doc links (#801) The ingest docs in Elasticsearch doing point to the actual ingest APIs. This makes up generate links to the real APIs instead, fixing some broken links in the 5.x docs in the process. --- scripts/utils/generateDocs.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index 81b846b35..837be9ce1 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -152,7 +152,12 @@ const LINK_OVERRIDES = { 'license.post_start_basic': '{ref}/start-basic.html', 'license.post_start_trial': '{ref}/start-trial.html', 'migration.deprecations': '{ref}/migration-api-deprecation.html', - 'monitoring.bulk': '{ref}/es-monitoring.html' + 'monitoring.bulk': '{ref}/es-monitoring.html', + 'ingest.delete_pipeline': '{ref}/delete-pipeline-api.html', + 'ingest.get_pipeline': '{ref}/get-pipeline-api.html', + 'ingest.put_pipeline': '{ref}/put-pipeline-api.html', + 'ingest.simulate': '{ref}/simulate-pipeline-api.html', + 'ingest.processor_grok': '{ref}/grok-processor.html#grok-processor-rest-get' } // Fixes bad urls in the JSON spec function fixLink (name, str) { @@ -168,7 +173,6 @@ function fixLink (name, str) { str = str.replace(/frozen\.html/, 'freeze-index-api.html') str = str.replace(/ml-file-structure\.html/, 'ml-find-file-structure.html') str = str.replace(/security-api-get-user-privileges\.html/, 'security-api-get-privileges.html') - str = str.replace(/security-api-get-user-privileges\.html/, 'security-api-get-privileges.html') return str } From 52cd07eca32fc271c013ef7561c5a2be334da9fd Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 29 Mar 2019 18:10:09 +0100 Subject: [PATCH 11/84] Generated reference --- docs/reference.asciidoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 9c9349d08..1c6fa04c5 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -2800,7 +2800,7 @@ link:http://www.elastic.co/guide/[Reference] ---- client.ingest.deletePipeline([params] [, options] [, callback]) ---- -link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] +link:{ref}/delete-pipeline-api.html[Reference] [cols=2*] |=== |`id` @@ -2819,7 +2819,7 @@ link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Re ---- client.ingest.getPipeline([params] [, options] [, callback]) ---- -link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] +link:{ref}/get-pipeline-api.html[Reference] [cols=2*] |=== |`id` @@ -2835,7 +2835,7 @@ link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Re ---- client.ingest.processorGrok([params] [, options] [, callback]) ---- -link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] +link:{ref}/grok-processor.html#grok-processor-rest-get[Reference] === ingest.putPipeline @@ -2843,7 +2843,7 @@ link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Re ---- client.ingest.putPipeline([params] [, options] [, callback]) ---- -link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] +link:{ref}/put-pipeline-api.html[Reference] [cols=2*] |=== |`id` @@ -2865,7 +2865,7 @@ link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Re ---- client.ingest.simulate([params] [, options] [, callback]) ---- -link:https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html[Reference] +link:{ref}/simulate-pipeline-api.html[Reference] [cols=2*] |=== |`id` From aea1ecfe15658c05b5de27fca0bdc215e0a5dce1 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 1 Apr 2019 09:08:32 +0200 Subject: [PATCH 12/84] Handle bulk errors in examples --- docs/examples/asStream.asciidoc | 7 ++++++- docs/examples/bulk.asciidoc | 7 ++++++- docs/examples/ignore.asciidoc | 7 ++++++- docs/examples/msearch.asciidoc | 7 ++++++- docs/examples/scroll.asciidoc | 7 ++++++- docs/examples/suggest.asciidoc | 7 ++++++- docs/examples/transport.request.asciidoc | 7 ++++++- 7 files changed, 42 insertions(+), 7 deletions(-) diff --git a/docs/examples/asStream.asciidoc b/docs/examples/asStream.asciidoc index 648f2cd06..d449fca1a 100644 --- a/docs/examples/asStream.asciidoc +++ b/docs/examples/asStream.asciidoc @@ -11,7 +11,7 @@ const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) async function run () { - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ refresh: true, body: [ // operation to perform @@ -36,6 +36,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + // Let's search! const { body } = await client.search({ index: 'game-of-thrones', diff --git a/docs/examples/bulk.asciidoc b/docs/examples/bulk.asciidoc index b7de4d37f..7d87b7af1 100644 --- a/docs/examples/bulk.asciidoc +++ b/docs/examples/bulk.asciidoc @@ -12,7 +12,7 @@ const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) async function run () { - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ // here we are forcing an index refresh, // otherwise we will not get any result // in the consequent search @@ -40,6 +40,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + // Let's search! const { body } = await client.search({ index: 'game-of-thrones', diff --git a/docs/examples/ignore.asciidoc b/docs/examples/ignore.asciidoc index d747daae7..c7a40583d 100644 --- a/docs/examples/ignore.asciidoc +++ b/docs/examples/ignore.asciidoc @@ -10,7 +10,7 @@ const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) async function run () { - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ refresh: true, body: [ // operation to perform @@ -35,6 +35,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + // Let's search! const { body } = await client.search({ index: 'game-of-thrones', diff --git a/docs/examples/msearch.asciidoc b/docs/examples/msearch.asciidoc index 9dbdec1ff..9cf2d79cd 100644 --- a/docs/examples/msearch.asciidoc +++ b/docs/examples/msearch.asciidoc @@ -11,7 +11,7 @@ const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) async function run () { - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ refresh: true, body: [ { index: { _index: 'game-of-thrones' } }, @@ -34,6 +34,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + const { body } = await client.msearch({ body: [ { index: 'game-of-thrones' }, diff --git a/docs/examples/scroll.asciidoc b/docs/examples/scroll.asciidoc index d07b7449f..84b5aed83 100644 --- a/docs/examples/scroll.asciidoc +++ b/docs/examples/scroll.asciidoc @@ -21,7 +21,7 @@ async function run () { const responseQueue = [] // Let's index some data! - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ // here we are forcing an index refresh, // otherwise we will not get any result // in the consequent search @@ -49,6 +49,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + // start things off by searching, setting a scroll timeout, and pushing // our first response into the queue to be processed const response = await client.search({ diff --git a/docs/examples/suggest.asciidoc b/docs/examples/suggest.asciidoc index d252f6803..004e51648 100644 --- a/docs/examples/suggest.asciidoc +++ b/docs/examples/suggest.asciidoc @@ -14,7 +14,7 @@ const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) async function run () { - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ refresh: true, body: [ { index: { _index: 'game-of-thrones' } }, @@ -37,6 +37,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + const { body } = await client.search({ index: 'game-of-thrones', body: { diff --git a/docs/examples/transport.request.asciidoc b/docs/examples/transport.request.asciidoc index 8689a7363..5cd89aa76 100644 --- a/docs/examples/transport.request.asciidoc +++ b/docs/examples/transport.request.asciidoc @@ -16,7 +16,7 @@ const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) async function run () { - await client.bulk({ + const { body: bulkResponse } = await client.bulk({ refresh: true, body: [ { index: { _index: 'game-of-thrones' } }, @@ -39,6 +39,11 @@ async function run () { ] }) + if (bulkResponse.errors) { + console.log(bulkResponse) + process.exit(1) + } + const { body } = await client.transport.request({ method: 'POST', path: '/game-of-thrones/_search', From 5794ad54e4c795f177be5af071d7c6a8728f0a5d Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 1 Apr 2019 09:49:57 +0200 Subject: [PATCH 13/84] Updated README.md --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 3d9b24312..7ec2f077a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ --- -**Note:** In the past months we have worked on the new Elasticsearch Node.js client, we will announce it soon! -If you want you can already try it by following the instructions below, while if you're going to use the legacy one or report an issue, please check out [elastic/elasticsearch-js-legacy](https://github.com/elastic/elasticsearch-js-legacy). +**Note:** In the past months we have worked on the new Elasticsearch Node.js client, and if you want you can already try it by following the instructions below, while if you're going to use the legacy one or report an issue, please check out [elastic/elasticsearch-js-legacy](https://github.com/elastic/elasticsearch-js-legacy). --- @@ -28,12 +27,6 @@ npm install @elastic/elasticsearch ### Compatibility ---- - -**Warning:** currently on npm you will only find a beta release that works with Elasticsearch 7, we will add the support for Elasticsearch 5, 6, and 7 once we release the final version of this library. - ---- - The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using. ``` # Elasticsearch 7.x From 5af9ec1040666acc9d413c14fd54241aa8a167bf Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 8 Apr 2019 17:13:44 +0200 Subject: [PATCH 14/84] Support for publish_address as hostname/ip:port (#804) --- lib/ConnectionPool.d.ts | 2 +- lib/ConnectionPool.js | 21 ++++- lib/Transport.js | 3 +- test/behavior/sniff.test.js | 33 ++++++++ test/unit/connection-pool.test.js | 131 +++++++++++++++++++++++------- test/utils/buildCluster.js | 6 +- 6 files changed, 159 insertions(+), 37 deletions(-) diff --git a/lib/ConnectionPool.d.ts b/lib/ConnectionPool.d.ts index 0dbbded05..9acbb7d01 100644 --- a/lib/ConnectionPool.d.ts +++ b/lib/ConnectionPool.d.ts @@ -127,7 +127,7 @@ export default class ConnectionPool { * @param {object} nodes * @returns {array} hosts */ - nodesToHost(nodes: any): any[]; + nodesToHost(nodes: any, protocol: string): any[]; /** * Transforms an url string to a host object * diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index 9e74dcb62..b4b396ac8 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -332,18 +332,33 @@ class ConnectionPool { * @param {object} nodes * @returns {array} hosts */ - nodesToHost (nodes) { + nodesToHost (nodes, protocol) { const ids = Object.keys(nodes) const hosts = [] for (var i = 0, len = ids.length; i < len; i++) { const node = nodes[ids[i]] // If there is no protocol in - // the `publish_address` new URL wil throw + // the `publish_address` new URL will throw + // the publish_address can have two forms: + // - ip:port + // - hostname/ip:port + // if we encounter the second case, we should + // use the hostname instead of the ip var address = node.http.publish_address + const hostAndIpRegex = /^[a-z0-9_.-]*\/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/gi + const match = address.match(hostAndIpRegex) + if (match !== null) { + const ipRegex = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/ + const ip = address.match(ipRegex)[0] + // extract the hostname, the -1 at the end removes the final / + const hostname = address.slice(0, address.indexOf(ip) - 1) + const port = address.split(':')[1] + address = `${hostname}:${port}` + } address = address.slice(0, 4) === 'http' ? address - : 'http://' + address + : `${protocol}//${address}` const roles = node.roles.reduce((acc, role) => { acc[role] = true return acc diff --git a/lib/Transport.js b/lib/Transport.js index 7bbc90412..f9ff4f092 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -353,7 +353,8 @@ class Transport { } debug('Sniffing ended successfully', result.body) - const hosts = this.connectionPool.nodesToHost(result.body.nodes) + const protocol = result.meta.connection.url.protocol || 'http:' + const hosts = this.connectionPool.nodesToHost(result.body.nodes, protocol) this.connectionPool.update(hosts) result.meta.sniff = { hosts, reason } diff --git a/test/behavior/sniff.test.js b/test/behavior/sniff.test.js index c76709b49..c3071ead6 100644 --- a/test/behavior/sniff.test.js +++ b/test/behavior/sniff.test.js @@ -93,6 +93,39 @@ test('Should update the connection pool', t => { }) }) +test('Should handle hostnames in publish_address', t => { + t.plan(10) + + buildCluster({ hostPublishAddress: true }, ({ nodes, shutdown }) => { + const client = new Client({ + node: nodes[Object.keys(nodes)[0]].url + }) + t.strictEqual(client.connectionPool.connections.size, 1) + + client.on(events.SNIFF, (err, request) => { + t.error(err) + t.strictEqual( + request.meta.sniff.reason, + Transport.sniffReasons.DEFAULT + ) + }) + + // run the sniffer + client.transport.sniff((err, hosts) => { + t.error(err) + t.strictEqual(hosts.length, 4) + + for (var i = 0; i < hosts.length; i++) { + // the first node will be an update of the existing one + t.strictEqual(hosts[i].url.hostname, 'localhost') + } + + t.strictEqual(client.connectionPool.connections.size, 4) + }) + t.teardown(shutdown) + }) +}) + test('Sniff interval', t => { t.plan(10) diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index 9a5b502b4..d5ef6320e 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -282,41 +282,112 @@ test('API', t => { }) t.test('nodesToHost', t => { - const pool = new ConnectionPool({ Connection }) - const nodes = { - a1: { - http: { - publish_address: '127.0.0.1:9200' - }, - roles: ['master', 'data', 'ingest'] - }, - a2: { - http: { - publish_address: '127.0.0.1:9202' + t.test('publish_address as ip address', t => { + const pool = new ConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: '127.0.0.1:9200' + }, + roles: ['master', 'data', 'ingest'] }, - roles: ['master', 'data', 'ingest'] + a2: { + http: { + publish_address: '127.0.0.1:9201' + }, + roles: ['master', 'data', 'ingest'] + } } - } - t.deepEqual(pool.nodesToHost(nodes), [{ - url: new URL('http://127.0.0.1:9200'), - id: 'a1', - roles: { - master: true, - data: true, - ingest: true, - ml: false + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, '127.0.0.1:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, '127.0.0.1:9201') + t.end() + }) + + t.test('publish_address as host/ip', t => { + const pool = new ConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: 'example.com/127.0.0.1:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: 'example.com/127.0.0.1:9201' + }, + roles: ['master', 'data', 'ingest'] + } } - }, { - url: new URL('http://127.0.0.1:9201'), - id: 'a2', - roles: { - master: true, - data: true, - ingest: true, - ml: false + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://example.com:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://example.com:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, 'example.com:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, 'example.com:9201') + t.end() + }) + + t.test('Should use the configure protocol', t => { + const pool = new ConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: 'example.com/127.0.0.1:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: 'example.com/127.0.0.1:9201' + }, + roles: ['master', 'data', 'ingest'] + } } - }]) + + t.strictEqual(pool.nodesToHost(nodes, 'https:')[0].url.protocol, 'https:') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.protocol, 'http:') + t.end() + }) + t.end() }) diff --git a/test/utils/buildCluster.js b/test/utils/buildCluster.js index a781f32cc..25614f5ef 100644 --- a/test/utils/buildCluster.js +++ b/test/utils/buildCluster.js @@ -53,12 +53,14 @@ function buildCluster (options, callback) { buildServer(options.handler || handler, ({ port }, server) => { nodes[opts.id] = { - url: `http://localhost:${port}`, + url: `http://127.0.0.1:${port}`, server } sniffResult.nodes[opts.id] = { http: { - publish_address: `http://localhost:${port}` + publish_address: options.hostPublishAddress + ? `localhost/127.0.0.1:${port}` + : `127.0.0.1:${port}` }, roles: ['master', 'data', 'ingest'] } From 0d65274de324a48f37e684947e6f42ebf1ed33d0 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 9 Apr 2019 16:48:31 +0200 Subject: [PATCH 15/84] Updated issues template --- .github/ISSUE_TEMPLATE.md | 2 +- .github/ISSUE_TEMPLATE/bug.md | 2 +- .github/ISSUE_TEMPLATE/regression.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 0a2ad2dec..b1465f693 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,7 +3,7 @@ #### You have already researched for similar issues? It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one. -#### Are you sure this is an issue with @elastic/elasticsearch or are you just looking for some help? +#### Are you sure this is an issue with `@elastic/elasticsearch` or are you just looking for some help? Issues should only be posted in this repository after you have been able to reproduce them and confirm that they are a bug or incorrect/missing information in the [docs](https://github.com/elastic/elasticsearch-js/docs). diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 620b6a5ce..6941b9a0f 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -36,6 +36,6 @@ Paste the results here: ## Your Environment - *node version*: 6,8,10 -- *@elastic/elasticsearch version*: >=7.0.0 +- `@elastic/elasticsearch` *version*: >=7.0.0 - *os*: Mac, Windows, Linux - *any other relevant information* diff --git a/.github/ISSUE_TEMPLATE/regression.md b/.github/ISSUE_TEMPLATE/regression.md index 079234a36..29ac65860 100644 --- a/.github/ISSUE_TEMPLATE/regression.md +++ b/.github/ISSUE_TEMPLATE/regression.md @@ -42,6 +42,6 @@ Paste the results here: ## Your Environment - *node version*: 6,8,10 -- *@elastic/elasticsearch version*: >=7.0.0 +- `@elastic/elasticsearch` *version*: >=7.0.0 - *os*: Mac, Windows, Linux - *any other relevant information* From 2919f93b73b40dafd18b924e2af000d555979f48 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 10 Apr 2019 11:13:22 +0200 Subject: [PATCH 16/84] Custom http agent support (#810) --- docs/configuration.asciidoc | 14 +++++++++- index.d.ts | 4 +-- lib/Connection.d.ts | 4 ++- lib/Connection.js | 26 ++++++++++--------- test/unit/connection.test.js | 50 ++++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 16 deletions(-) diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 3df5caafc..45f186fd4 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -90,8 +90,20 @@ _Default:_ `false` _Default:_ `null` |`agent` -|`http.AgentOptions` - http agent https://nodejs.org/api/http.html#http_new_agent_options[options]. + +a|`http.AgentOptions, function` - http agent https://nodejs.org/api/http.html#http_new_agent_options[options], or a function that returns an actual http agent instance. + _Default:_ `null` +[source,js] +---- +const client = new Client({ + node: 'http://localhost:9200', + agent: { agent: 'options' } +}) + +const client = new Client({ + node: 'http://localhost:9200', + agent: () => new CustomAgent() +}) +---- |`nodeFilter` a|`function` - Filters which node not to use for a request. + diff --git a/index.d.ts b/index.d.ts index 0fd8d458d..7b8bcc49d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -29,7 +29,7 @@ import Transport, { nodeFilterFn, nodeSelectorFn } from './lib/Transport'; -import Connection, { AgentOptions } from './lib/Connection'; +import Connection, { AgentOptions, agentFn } from './lib/Connection'; import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool'; import Serializer from './lib/Serializer'; import * as RequestParams from './api/requestParams'; @@ -82,7 +82,7 @@ interface ClientOptions { suggestCompression?: boolean; compression?: 'gzip'; ssl?: SecureContextOptions; - agent?: AgentOptions; + agent?: AgentOptions | agentFn; nodeFilter?: nodeFilterFn; nodeSelector?: nodeSelectorFn | string; headers?: anyObject; diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index 99d9a7ffd..a02b6f72a 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -24,12 +24,14 @@ import { inspect, InspectOptions } from 'util'; import * as http from 'http'; import { SecureContextOptions } from 'tls'; +export declare type agentFn = () => any; + interface ConnectionOptions { url: URL; ssl?: SecureContextOptions; id?: string; headers?: any; - agent?: AgentOptions; + agent?: AgentOptions | agentFn; status?: string; roles?: any; } diff --git a/lib/Connection.js b/lib/Connection.js index 4429e8696..e90182453 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -46,18 +46,20 @@ class Connection { throw new ConfigurationError(`Invalid protocol: '${this.url.protocol}'`) } - // Probably there is a bug in Node Core - // see https://github.com/nodejs/node/issues/26357 - const keepAliveFalse = opts.agent && opts.agent.keepAlive === false - const agentOptions = Object.assign({}, { - keepAlive: true, - keepAliveMsecs: 1000, - maxSockets: keepAliveFalse ? Infinity : 256, - maxFreeSockets: 256 - }, opts.agent) - this.agent = this.url.protocol === 'http:' - ? new http.Agent(agentOptions) - : new https.Agent(Object.assign({}, agentOptions, this.ssl)) + if (typeof opts.agent === 'function') { + this.agent = opts.agent() + } else { + const keepAliveFalse = opts.agent && opts.agent.keepAlive === false + const agentOptions = Object.assign({}, { + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: keepAliveFalse ? Infinity : 256, + maxFreeSockets: 256 + }, opts.agent) + this.agent = this.url.protocol === 'http:' + ? new http.Agent(agentOptions) + : new https.Agent(Object.assign({}, agentOptions, this.ssl)) + } this.makeRequest = this.url.protocol === 'http:' ? http.request diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 229e00d04..84068cad5 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -23,6 +23,7 @@ const { test } = require('tap') const { inspect } = require('util') const { createGzip, createDeflate } = require('zlib') const { URL } = require('url') +const { Agent } = require('http') const intoStream = require('into-stream') const { buildServer } = require('../utils') const Connection = require('../../lib/Connection') @@ -149,6 +150,55 @@ test('Basic (https with ssl agent)', t => { }) }) +test('Custom http agent', t => { + t.plan(5) + + function handler (req, res) { + t.match(req.headers, { + 'x-custom-test': 'true', + connection: 'keep-alive' + }) + res.end('ok') + } + + buildServer(handler, ({ port }, server) => { + const agent = new Agent({ + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: 256, + maxFreeSockets: 256 + }) + agent.custom = true + const connection = new Connection({ + url: new URL(`http://localhost:${port}`), + agent: () => agent + }) + t.true(connection.agent.custom) + connection.request({ + path: '/hello', + method: 'GET', + headers: { + 'X-Custom-Test': true + } + }, (err, res) => { + t.error(err) + + t.match(res.headers, { + connection: 'keep-alive' + }) + + var payload = '' + res.setEncoding('utf8') + res.on('data', chunk => { payload += chunk }) + res.on('error', err => t.fail(err)) + res.on('end', () => { + t.strictEqual(payload, 'ok') + server.stop() + }) + }) + }) +}) + test('Disable keep alive', t => { t.plan(3) From a21281fc487bc634c867f3587454815941666033 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 10 Apr 2019 11:40:25 +0200 Subject: [PATCH 17/84] Improve typings (#813) The ApiResponse now accepts a generics that defaults to any, same for every API method that might need a body. --- ...ta_frame.get_data_frame_transform_stats.js | 5 +- api/requestParams.d.ts | 374 +++++++++--------- docs/reference.asciidoc | 6 + docs/typescript.asciidoc | 170 ++++++-- lib/Transport.d.ts | 4 +- scripts/utils/generateRequestTypes.js | 4 +- test/types/index.ts | 35 ++ 7 files changed, 366 insertions(+), 232 deletions(-) diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 1eec92cea..730085eeb 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -29,10 +29,13 @@ function buildDataFrameGetDataFrameTransformStats (opts) { * Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request * * @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms + * @param {number} from - skips a number of transform stats, defaults to 0 + * @param {number} size - specifies a max number of transform stats to get, defaults to 100 */ const acceptedQuerystring = [ - + 'from', + 'size' ] const snakeCase = { diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 7f2cd898d..2e0854f9c 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -27,7 +27,7 @@ export interface Generic { source?: string; } -export interface Bulk extends Generic { +export interface Bulk extends Generic { index?: string; type?: string; wait_for_active_shards?: string; @@ -38,7 +38,7 @@ export interface Bulk extends Generic { _source_excludes?: string | string[]; _source_includes?: string | string[]; pipeline?: string; - body: any; + body: T; } export interface CatAliases extends Generic { @@ -258,15 +258,15 @@ export interface CatThreadPool extends Generic { v?: boolean; } -export interface ClearScroll extends Generic { +export interface ClearScroll extends Generic { scroll_id?: string | string[]; - body?: any; + body?: T; } -export interface ClusterAllocationExplain extends Generic { +export interface ClusterAllocationExplain extends Generic { include_yes_decisions?: boolean; include_disk_info?: boolean; - body?: any; + body?: T; } export interface ClusterGetSettings extends Generic { @@ -296,24 +296,24 @@ export interface ClusterPendingTasks extends Generic { master_timeout?: string; } -export interface ClusterPutSettings extends Generic { +export interface ClusterPutSettings extends Generic { flat_settings?: boolean; master_timeout?: string; timeout?: string; - body: any; + body: T; } export interface ClusterRemoteInfo extends Generic { } -export interface ClusterReroute extends Generic { +export interface ClusterReroute extends Generic { dry_run?: boolean; explain?: boolean; retry_failed?: boolean; metric?: string | string[]; master_timeout?: string; timeout?: string; - body?: any; + body?: T; } export interface ClusterState extends Generic { @@ -335,7 +335,7 @@ export interface ClusterStats extends Generic { timeout?: string; } -export interface Count extends Generic { +export interface Count extends Generic { index?: string | string[]; type?: string | string[]; ignore_unavailable?: boolean; @@ -352,10 +352,10 @@ export interface Count extends Generic { df?: string; lenient?: boolean; terminate_after?: number; - body?: any; + body?: T; } -export interface Create extends Generic { +export interface Create extends Generic { id: string; index: string; type?: string; @@ -367,7 +367,7 @@ export interface Create extends Generic { version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; pipeline?: string; - body: any; + body: T; } export interface Delete extends Generic { @@ -385,7 +385,7 @@ export interface Delete extends Generic { version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } -export interface DeleteByQuery extends Generic { +export interface DeleteByQuery extends Generic { index: string | string[]; type?: string | string[]; analyzer?: string; @@ -420,7 +420,7 @@ export interface DeleteByQuery extends Generic { wait_for_completion?: boolean; requests_per_second?: number; slices?: number; - body: any; + body: T; } export interface DeleteByQueryRethrottle extends Generic { @@ -467,7 +467,7 @@ export interface ExistsSource extends Generic { version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } -export interface Explain extends Generic { +export interface Explain extends Generic { id: string; index: string; type?: string; @@ -484,7 +484,7 @@ export interface Explain extends Generic { _source?: string | string[]; _source_excludes?: string | string[]; _source_includes?: string | string[]; - body?: any; + body?: T; } export interface FieldCaps extends Generic { @@ -535,7 +535,7 @@ export interface GetSource extends Generic { version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } -export interface Index extends Generic { +export interface Index extends Generic { id?: string; index: string; type?: string; @@ -550,12 +550,12 @@ export interface Index extends Generic { if_seq_no?: number; if_primary_term?: number; pipeline?: string; - body: any; + body: T; } -export interface IndicesAnalyze extends Generic { +export interface IndicesAnalyze extends Generic { index?: string; - body?: any; + body?: T; } export interface IndicesClearCache extends Generic { @@ -579,13 +579,13 @@ export interface IndicesClose extends Generic { wait_for_active_shards?: string; } -export interface IndicesCreate extends Generic { +export interface IndicesCreate extends Generic { index: string; include_type_name?: boolean; wait_for_active_shards?: string; timeout?: string; master_timeout?: string; - body?: any; + body?: T; } export interface IndicesDelete extends Generic { @@ -752,15 +752,15 @@ export interface IndicesOpen extends Generic { wait_for_active_shards?: string; } -export interface IndicesPutAlias extends Generic { +export interface IndicesPutAlias extends Generic { index: string | string[]; name: string; timeout?: string; master_timeout?: string; - body?: any; + body?: T; } -export interface IndicesPutMapping extends Generic { +export interface IndicesPutMapping extends Generic { index?: string | string[]; type?: string; include_type_name?: boolean; @@ -769,10 +769,10 @@ export interface IndicesPutMapping extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - body: any; + body: T; } -export interface IndicesPutSettings extends Generic { +export interface IndicesPutSettings extends Generic { index?: string | string[]; master_timeout?: string; timeout?: string; @@ -781,10 +781,10 @@ export interface IndicesPutSettings extends Generic { allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; flat_settings?: boolean; - body: any; + body: T; } -export interface IndicesPutTemplate extends Generic { +export interface IndicesPutTemplate extends Generic { name: string; include_type_name?: boolean; order?: number; @@ -792,7 +792,7 @@ export interface IndicesPutTemplate extends Generic { timeout?: string; master_timeout?: string; flat_settings?: boolean; - body: any; + body: T; } export interface IndicesRecovery extends Generic { @@ -808,7 +808,7 @@ export interface IndicesRefresh extends Generic { expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; } -export interface IndicesRollover extends Generic { +export interface IndicesRollover extends Generic { alias: string; new_index?: string; include_type_name?: boolean; @@ -816,7 +816,7 @@ export interface IndicesRollover extends Generic { dry_run?: boolean; master_timeout?: string; wait_for_active_shards?: string; - body?: any; + body?: T; } export interface IndicesSegments extends Generic { @@ -835,22 +835,22 @@ export interface IndicesShardStores extends Generic { expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; } -export interface IndicesShrink extends Generic { +export interface IndicesShrink extends Generic { index: string; target: string; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; - body?: any; + body?: T; } -export interface IndicesSplit extends Generic { +export interface IndicesSplit extends Generic { index: string; target: string; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; - body?: any; + body?: T; } export interface IndicesStats extends Generic { @@ -868,10 +868,10 @@ export interface IndicesStats extends Generic { forbid_closed_indices?: boolean; } -export interface IndicesUpdateAliases extends Generic { +export interface IndicesUpdateAliases extends Generic { timeout?: string; master_timeout?: string; - body: any; + body: T; } export interface IndicesUpgrade extends Generic { @@ -883,7 +883,7 @@ export interface IndicesUpgrade extends Generic { only_ancient_segments?: boolean; } -export interface IndicesValidateQuery extends Generic { +export interface IndicesValidateQuery extends Generic { index?: string | string[]; type?: string | string[]; explain?: boolean; @@ -898,7 +898,7 @@ export interface IndicesValidateQuery extends Generic { lenient?: boolean; rewrite?: boolean; all_shards?: boolean; - body?: any; + body?: T; } export interface Info extends Generic { @@ -918,20 +918,20 @@ export interface IngestGetPipeline extends Generic { export interface IngestProcessorGrok extends Generic { } -export interface IngestPutPipeline extends Generic { +export interface IngestPutPipeline extends Generic { id: string; master_timeout?: string; timeout?: string; - body: any; + body: T; } -export interface IngestSimulate extends Generic { +export interface IngestSimulate extends Generic { id?: string; verbose?: boolean; - body: any; + body: T; } -export interface Mget extends Generic { +export interface Mget extends Generic { index?: string; type?: string; stored_fields?: string | string[]; @@ -942,10 +942,10 @@ export interface Mget extends Generic { _source?: string | string[]; _source_excludes?: string | string[]; _source_includes?: string | string[]; - body: any; + body: T; } -export interface Msearch extends Generic { +export interface Msearch extends Generic { index?: string | string[]; type?: string | string[]; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; @@ -955,10 +955,10 @@ export interface Msearch extends Generic { max_concurrent_shard_requests?: number; rest_total_hits_as_int?: boolean; ccs_minimize_roundtrips?: boolean; - body: any; + body: T; } -export interface MsearchTemplate extends Generic { +export interface MsearchTemplate extends Generic { index?: string | string[]; type?: string | string[]; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; @@ -966,10 +966,10 @@ export interface MsearchTemplate extends Generic { max_concurrent_searches?: number; rest_total_hits_as_int?: boolean; ccs_minimize_roundtrips?: boolean; - body: any; + body: T; } -export interface Mtermvectors extends Generic { +export interface Mtermvectors extends Generic { index?: string; type?: string; ids?: string | string[]; @@ -985,7 +985,7 @@ export interface Mtermvectors extends Generic { realtime?: boolean; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; - body?: any; + body?: T; } export interface NodesHotThreads extends Generic { @@ -1033,23 +1033,23 @@ export interface NodesUsage extends Generic { export interface Ping extends Generic { } -export interface PutScript extends Generic { +export interface PutScript extends Generic { id: string; context?: string; timeout?: string; master_timeout?: string; - body: any; + body: T; } -export interface RankEval extends Generic { +export interface RankEval extends Generic { index?: string | string[]; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - body: any; + body: T; } -export interface Reindex extends Generic { +export interface Reindex extends Generic { refresh?: boolean; timeout?: string; wait_for_active_shards?: string; @@ -1057,7 +1057,7 @@ export interface Reindex extends Generic { requests_per_second?: number; scroll?: string; slices?: number; - body: any; + body: T; } export interface ReindexRethrottle extends Generic { @@ -1065,27 +1065,27 @@ export interface ReindexRethrottle extends Generic { requests_per_second: number; } -export interface RenderSearchTemplate extends Generic { +export interface RenderSearchTemplate extends Generic { id?: string; - body?: any; + body?: T; } export interface ScriptsPainlessContext extends Generic { context?: string; } -export interface ScriptsPainlessExecute extends Generic { - body?: any; +export interface ScriptsPainlessExecute extends Generic { + body?: T; } -export interface Scroll extends Generic { +export interface Scroll extends Generic { scroll_id?: string; scroll?: string; rest_total_hits_as_int?: boolean; - body?: any; + body?: T; } -export interface Search extends Generic { +export interface Search extends Generic { index?: string | string[]; type?: string | string[]; analyzer?: string; @@ -1130,7 +1130,7 @@ export interface Search extends Generic { max_concurrent_shard_requests?: number; pre_filter_shard_size?: number; rest_total_hits_as_int?: boolean; - body?: any; + body?: T; } export interface SearchShards extends Generic { @@ -1143,7 +1143,7 @@ export interface SearchShards extends Generic { expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; } -export interface SearchTemplate extends Generic { +export interface SearchTemplate extends Generic { index?: string | string[]; type?: string | string[]; ignore_unavailable?: boolean; @@ -1159,23 +1159,23 @@ export interface SearchTemplate extends Generic { typed_keys?: boolean; rest_total_hits_as_int?: boolean; ccs_minimize_roundtrips?: boolean; - body: any; + body: T; } -export interface SnapshotCreate extends Generic { +export interface SnapshotCreate extends Generic { repository: string; snapshot: string; master_timeout?: string; wait_for_completion?: boolean; - body?: any; + body?: T; } -export interface SnapshotCreateRepository extends Generic { +export interface SnapshotCreateRepository extends Generic { repository: string; master_timeout?: string; timeout?: string; verify?: boolean; - body: any; + body: T; } export interface SnapshotDelete extends Generic { @@ -1204,12 +1204,12 @@ export interface SnapshotGetRepository extends Generic { local?: boolean; } -export interface SnapshotRestore extends Generic { +export interface SnapshotRestore extends Generic { repository: string; snapshot: string; master_timeout?: string; wait_for_completion?: boolean; - body?: any; + body?: T; } export interface SnapshotStatus extends Generic { @@ -1248,7 +1248,7 @@ export interface TasksList extends Generic { timeout?: string; } -export interface Termvectors extends Generic { +export interface Termvectors extends Generic { index: string; type?: string; id?: string; @@ -1264,10 +1264,10 @@ export interface Termvectors extends Generic { realtime?: boolean; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; - body?: any; + body?: T; } -export interface Update extends Generic { +export interface Update extends Generic { id: string; index: string; type?: string; @@ -1283,10 +1283,10 @@ export interface Update extends Generic { timeout?: string; if_seq_no?: number; if_primary_term?: number; - body: any; + body: T; } -export interface UpdateByQuery extends Generic { +export interface UpdateByQuery extends Generic { index: string | string[]; type?: string | string[]; analyzer?: string; @@ -1323,7 +1323,7 @@ export interface UpdateByQuery extends Generic { wait_for_completion?: boolean; requests_per_second?: number; slices?: number; - body?: any; + body?: T; } export interface UpdateByQueryRethrottle extends Generic { @@ -1335,10 +1335,10 @@ export interface CcrDeleteAutoFollowPattern extends Generic { name: string; } -export interface CcrFollow extends Generic { +export interface CcrFollow extends Generic { index: string; wait_for_active_shards?: string; - body: any; + body: T; } export interface CcrFollowInfo extends Generic { @@ -1349,9 +1349,9 @@ export interface CcrFollowStats extends Generic { index: string | string[]; } -export interface CcrForgetFollower extends Generic { +export interface CcrForgetFollower extends Generic { index: string; - body: any; + body: T; } export interface CcrGetAutoFollowPattern extends Generic { @@ -1362,14 +1362,14 @@ export interface CcrPauseFollow extends Generic { index: string; } -export interface CcrPutAutoFollowPattern extends Generic { +export interface CcrPutAutoFollowPattern extends Generic { name: string; - body: any; + body: T; } -export interface CcrResumeFollow extends Generic { +export interface CcrResumeFollow extends Generic { index: string; - body?: any; + body?: T; } export interface CcrStats extends Generic { @@ -1391,15 +1391,17 @@ export interface DataFrameGetDataFrameTransform extends Generic { export interface DataFrameGetDataFrameTransformStats extends Generic { transform_id?: string; + from?: number; + size?: number; } -export interface DataFramePreviewDataFrameTransform extends Generic { - body: any; +export interface DataFramePreviewDataFrameTransform extends Generic { + body: T; } -export interface DataFramePutDataFrameTransform extends Generic { +export interface DataFramePutDataFrameTransform extends Generic { transform_id: string; - body: any; + body: T; } export interface DataFrameStartDataFrameTransform extends Generic { @@ -1413,12 +1415,12 @@ export interface DataFrameStopDataFrameTransform extends Generic { timeout?: string; } -export interface GraphExplore extends Generic { +export interface GraphExplore extends Generic { index?: string | string[]; type?: string | string[]; routing?: string; timeout?: string; - body?: any; + body?: T; } export interface IlmDeleteLifecycle extends Generic { @@ -1436,14 +1438,14 @@ export interface IlmGetLifecycle extends Generic { export interface IlmGetStatus extends Generic { } -export interface IlmMoveToStep extends Generic { +export interface IlmMoveToStep extends Generic { index?: string; - body?: any; + body?: T; } -export interface IlmPutLifecycle extends Generic { +export interface IlmPutLifecycle extends Generic { policy?: string; - body?: any; + body?: T; } export interface IlmRemovePolicy extends Generic { @@ -1493,9 +1495,9 @@ export interface LicenseGetBasicStatus extends Generic { export interface LicenseGetTrialStatus extends Generic { } -export interface LicensePost extends Generic { +export interface LicensePost extends Generic { acknowledge?: boolean; - body?: any; + body?: T; } export interface LicensePostStartBasic extends Generic { @@ -1511,12 +1513,12 @@ export interface MigrationDeprecations extends Generic { index?: string; } -export interface MlCloseJob extends Generic { +export interface MlCloseJob extends Generic { job_id: string; allow_no_jobs?: boolean; force?: boolean; timeout?: string; - body?: any; + body?: T; } export interface MlDeleteCalendar extends Generic { @@ -1563,7 +1565,7 @@ export interface MlDeleteModelSnapshot extends Generic { snapshot_id: string; } -export interface MlFindFileStructure extends Generic { +export interface MlFindFileStructure extends Generic { lines_to_sample?: number; timeout?: string; charset?: string; @@ -1577,17 +1579,17 @@ export interface MlFindFileStructure extends Generic { timestamp_field?: string; timestamp_format?: string; explain?: boolean; - body: any; + body: T; } -export interface MlFlushJob extends Generic { +export interface MlFlushJob extends Generic { job_id: string; calc_interim?: boolean; start?: string; end?: string; advance_time?: string; skip_time?: string; - body?: any; + body?: T; } export interface MlForecast extends Generic { @@ -1596,7 +1598,7 @@ export interface MlForecast extends Generic { expires_in?: string; } -export interface MlGetBuckets extends Generic { +export interface MlGetBuckets extends Generic { job_id: string; timestamp?: string; expand?: boolean; @@ -1608,7 +1610,7 @@ export interface MlGetBuckets extends Generic { anomaly_score?: number; sort?: string; desc?: boolean; - body?: any; + body?: T; } export interface MlGetCalendarEvents extends Generic { @@ -1620,19 +1622,19 @@ export interface MlGetCalendarEvents extends Generic { size?: number; } -export interface MlGetCalendars extends Generic { +export interface MlGetCalendars extends Generic { calendar_id?: string; from?: number; size?: number; - body?: any; + body?: T; } -export interface MlGetCategories extends Generic { +export interface MlGetCategories extends Generic { job_id: string; category_id?: number; from?: number; size?: number; - body?: any; + body?: T; } export interface MlGetDatafeedStats extends Generic { @@ -1651,7 +1653,7 @@ export interface MlGetFilters extends Generic { size?: number; } -export interface MlGetInfluencers extends Generic { +export interface MlGetInfluencers extends Generic { job_id: string; exclude_interim?: boolean; from?: number; @@ -1661,7 +1663,7 @@ export interface MlGetInfluencers extends Generic { influencer_score?: number; sort?: string; desc?: boolean; - body?: any; + body?: T; } export interface MlGetJobStats extends Generic { @@ -1674,7 +1676,7 @@ export interface MlGetJobs extends Generic { allow_no_jobs?: boolean; } -export interface MlGetModelSnapshots extends Generic { +export interface MlGetModelSnapshots extends Generic { job_id: string; snapshot_id?: string; from?: number; @@ -1683,10 +1685,10 @@ export interface MlGetModelSnapshots extends Generic { end?: string; sort?: string; desc?: boolean; - body?: any; + body?: T; } -export interface MlGetOverallBuckets extends Generic { +export interface MlGetOverallBuckets extends Generic { job_id: string; top_n?: number; bucket_span?: string; @@ -1695,10 +1697,10 @@ export interface MlGetOverallBuckets extends Generic { start?: string; end?: string; allow_no_jobs?: boolean; - body?: any; + body?: T; } -export interface MlGetRecords extends Generic { +export interface MlGetRecords extends Generic { job_id: string; exclude_interim?: boolean; from?: number; @@ -1708,7 +1710,7 @@ export interface MlGetRecords extends Generic { record_score?: number; sort?: string; desc?: boolean; - body?: any; + body?: T; } export interface MlInfo extends Generic { @@ -1720,25 +1722,25 @@ export interface MlOpenJob extends Generic { timeout?: string; } -export interface MlPostCalendarEvents extends Generic { +export interface MlPostCalendarEvents extends Generic { calendar_id: string; - body: any; + body: T; } -export interface MlPostData extends Generic { +export interface MlPostData extends Generic { job_id: string; reset_start?: string; reset_end?: string; - body: any; + body: T; } export interface MlPreviewDatafeed extends Generic { datafeed_id: string; } -export interface MlPutCalendar extends Generic { +export interface MlPutCalendar extends Generic { calendar_id: string; - body?: any; + body?: T; } export interface MlPutCalendarJob extends Generic { @@ -1746,26 +1748,26 @@ export interface MlPutCalendarJob extends Generic { job_id: string; } -export interface MlPutDatafeed extends Generic { +export interface MlPutDatafeed extends Generic { datafeed_id: string; - body: any; + body: T; } -export interface MlPutFilter extends Generic { +export interface MlPutFilter extends Generic { filter_id: string; - body: any; + body: T; } -export interface MlPutJob extends Generic { +export interface MlPutJob extends Generic { job_id: string; - body: any; + body: T; } -export interface MlRevertModelSnapshot extends Generic { +export interface MlRevertModelSnapshot extends Generic { job_id: string; snapshot_id: string; delete_intervening_results?: boolean; - body?: any; + body?: T; } export interface MlSetUpgradeMode extends Generic { @@ -1773,12 +1775,12 @@ export interface MlSetUpgradeMode extends Generic { timeout?: string; } -export interface MlStartDatafeed extends Generic { +export interface MlStartDatafeed extends Generic { datafeed_id: string; start?: string; end?: string; timeout?: string; - body?: any; + body?: T; } export interface MlStopDatafeed extends Generic { @@ -1788,41 +1790,41 @@ export interface MlStopDatafeed extends Generic { timeout?: string; } -export interface MlUpdateDatafeed extends Generic { +export interface MlUpdateDatafeed extends Generic { datafeed_id: string; - body: any; + body: T; } -export interface MlUpdateFilter extends Generic { +export interface MlUpdateFilter extends Generic { filter_id: string; - body: any; + body: T; } -export interface MlUpdateJob extends Generic { +export interface MlUpdateJob extends Generic { job_id: string; - body: any; + body: T; } -export interface MlUpdateModelSnapshot extends Generic { +export interface MlUpdateModelSnapshot extends Generic { job_id: string; snapshot_id: string; - body: any; + body: T; } -export interface MlValidate extends Generic { - body: any; +export interface MlValidate extends Generic { + body: T; } -export interface MlValidateDetector extends Generic { - body: any; +export interface MlValidateDetector extends Generic { + body: T; } -export interface MonitoringBulk extends Generic { +export interface MonitoringBulk extends Generic { type?: string; system_id?: string; system_api_version?: string; interval?: string; - body: any; + body: T; } export interface RollupDeleteJob extends Generic { @@ -1841,17 +1843,17 @@ export interface RollupGetRollupIndexCaps extends Generic { index: string; } -export interface RollupPutJob extends Generic { +export interface RollupPutJob extends Generic { id: string; - body: any; + body: T; } -export interface RollupRollupSearch extends Generic { +export interface RollupRollupSearch extends Generic { index: string | string[]; type?: string; typed_keys?: boolean; rest_total_hits_as_int?: boolean; - body: any; + body: T; } export interface RollupStartJob extends Generic { @@ -1867,10 +1869,10 @@ export interface RollupStopJob extends Generic { export interface SecurityAuthenticate extends Generic { } -export interface SecurityChangePassword extends Generic { +export interface SecurityChangePassword extends Generic { username?: string; refresh?: 'true' | 'false' | 'wait_for'; - body: any; + body: T; } export interface SecurityClearCachedRealms extends Generic { @@ -1882,9 +1884,9 @@ export interface SecurityClearCachedRoles extends Generic { name: string | string[]; } -export interface SecurityCreateApiKey extends Generic { +export interface SecurityCreateApiKey extends Generic { refresh?: 'true' | 'false' | 'wait_for'; - body: any; + body: T; } export interface SecurityDeletePrivileges extends Generic { @@ -1938,8 +1940,8 @@ export interface SecurityGetRoleMapping extends Generic { name?: string; } -export interface SecurityGetToken extends Generic { - body: any; +export interface SecurityGetToken extends Generic { + body: T; } export interface SecurityGetUser extends Generic { @@ -1949,53 +1951,53 @@ export interface SecurityGetUser extends Generic { export interface SecurityGetUserPrivileges extends Generic { } -export interface SecurityHasPrivileges extends Generic { +export interface SecurityHasPrivileges extends Generic { user?: string; - body: any; + body: T; } -export interface SecurityInvalidateApiKey extends Generic { - body: any; +export interface SecurityInvalidateApiKey extends Generic { + body: T; } -export interface SecurityInvalidateToken extends Generic { - body: any; +export interface SecurityInvalidateToken extends Generic { + body: T; } -export interface SecurityPutPrivileges extends Generic { +export interface SecurityPutPrivileges extends Generic { refresh?: 'true' | 'false' | 'wait_for'; - body: any; + body: T; } -export interface SecurityPutRole extends Generic { +export interface SecurityPutRole extends Generic { name: string; refresh?: 'true' | 'false' | 'wait_for'; - body: any; + body: T; } -export interface SecurityPutRoleMapping extends Generic { +export interface SecurityPutRoleMapping extends Generic { name: string; refresh?: 'true' | 'false' | 'wait_for'; - body: any; + body: T; } -export interface SecurityPutUser extends Generic { +export interface SecurityPutUser extends Generic { username: string; refresh?: 'true' | 'false' | 'wait_for'; - body: any; + body: T; } -export interface SqlClearCursor extends Generic { - body: any; +export interface SqlClearCursor extends Generic { + body: T; } -export interface SqlQuery extends Generic { +export interface SqlQuery extends Generic { format?: string; - body: any; + body: T; } -export interface SqlTranslate extends Generic { - body: any; +export interface SqlTranslate extends Generic { + body: T; } export interface SslCertificates extends Generic { @@ -2018,23 +2020,23 @@ export interface WatcherDeleteWatch extends Generic { id: string; } -export interface WatcherExecuteWatch extends Generic { +export interface WatcherExecuteWatch extends Generic { id?: string; debug?: boolean; - body?: any; + body?: T; } export interface WatcherGetWatch extends Generic { id: string; } -export interface WatcherPutWatch extends Generic { +export interface WatcherPutWatch extends Generic { id: string; active?: boolean; version?: number; if_seq_no?: number; if_primary_term?: number; - body?: any; + body?: T; } export interface WatcherStart extends Generic { diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 1c6fa04c5..ce0bc6875 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -4352,6 +4352,12 @@ link:{ref}/get-data-frame-transform-stats.html[Reference] |`transform_id` or `transformId` |`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms +|`from` +|`number` - skips a number of transform stats, defaults to 0 + +|`size` +|`number` - specifies a max number of transform stats to get, defaults to 100 + |=== === dataFrame.previewDataFrameTransform diff --git a/docs/typescript.asciidoc b/docs/typescript.asciidoc index 4dbe92054..237b27084 100644 --- a/docs/typescript.asciidoc +++ b/docs/typescript.asciidoc @@ -3,58 +3,146 @@ The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API. -While the client offers type definitions for Request parameters, Request bodies and responses are shipped with `any` because there is not an official spec that defines them, so we cannot make guarantees over them (but since they are shipped with `any`, you can easily override them with your own typing definitions). - NOTE: If you are using TypeScript you will be required to use _snake_case_ style to define the API parameters instead of _camelCase_. -=== How to extend the provided typings? -Extend the provided typings is very straightforward, you should declare a custom `.d.ts` file and then write inside your type extensions, following there is an example of how do it. +Other than the types for the surface API, the client offers the types for every request method, via the `RequestParams`, if you need the types for a search request for instance, you can access them via `RequestParams.Search`. +Every API that supports a body, accepts a https://www.typescriptlang.org/docs/handbook/generics.html[generics] which represents the type of the request body, if you don't configure anything, it will default to `any`. + +For example: + [source,ts] ---- -declare module '@elastic/elasticsearch' { - export interface ShardsResponse { - total: number; - successful: number; - failed: number; - skipped: number; +import { RequestParams } from '@elastic/elasticsearch' + +interface SearchBody { + query: { + match: { foo: string } } +} - export interface Explanation { - value: number; - description: string; - details: Explanation[]; +const searchParams: RequestParams.Search = { + index: 'test', + body: { + query: { + match: { foo: 'bar' } + } } +} - export interface SearchResponse { - took: number; - timed_out: boolean; - _scroll_id?: string; - _shards: ShardsResponse; - hits: { - total: number; - max_score: number; - hits: Array<{ - _index: string; - _type: string; - _id: string; - _score: number; - _source: T; - _version?: number; - _explanation?: Explanation; - fields?: any; - highlight?: any; - inner_hits?: any; - matched_queries?: string[]; - sort?: string[]; - }>; - }; - aggregations?: any; +// This is valid as well +const searchParams: RequestParams.Search = { + index: 'test', + body: { + query: { + match: { foo: 'bar' } + } } +} +---- + +You can find the type definiton of a response in `ApiResponse`, which accepts a generics as well if you want to specify the body type, otherwise it defaults to `any`. - export interface MSearchResponse { - responses?: Array>; +[source,ts] +---- +interface SearchResponse { + hits: { + hits: Array<{ + _source: T; + }> } } -export {}; +// Define the intefrace of the source object +interface Source { + foo: string +} + +client.search(searchParams) + .then((response: ApiResponse>) => console.log(response)) + .catch((err: Error) => {}) +---- + +=== A complete example + +[source,ts] +---- +import { + Client, + // Object that contains the type definitions of every API method + RequestParams, + // Interface of the generic API response + ApiResponse, +} from '@elastic/elasticsearch' + +const client = new Client({ node: 'http://localhost:9200' }) + +// Define the type of the body for the Search request +interface SearchBody { + query: { + match: { foo: string } + } +} + +// Complete definition of the Search response +interface ShardsResponse { + total: number; + successful: number; + failed: number; + skipped: number; +} + +interface Explanation { + value: number; + description: string; + details: Explanation[]; +} + +interface SearchResponse { + took: number; + timed_out: boolean; + _scroll_id?: string; + _shards: ShardsResponse; + hits: { + total: number; + max_score: number; + hits: Array<{ + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version?: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + matched_queries?: string[]; + sort?: string[]; + }>; + }; + aggregations?: any; +} + +// Define the intefrace of the source object +interface Source { + foo: string +} + +async function run (): Promise { + // Define the search parameters + const searchParams: RequestParams.Search = { + index: 'test', + body: { + query: { + match: { foo: 'bar' } + } + } + } + + // Craft the final type definition + const response: ApiResponse> = await client.search(searchParams) + console.log(response.body) +} + +run().catch(console.log) ---- diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 28033e292..3a349cbf1 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -49,7 +49,7 @@ interface TransportOptions { headers?: anyObject; } -export interface RequestEvent { +export interface RequestEvent { body: any; statusCode: number | null; headers: anyObject | null; @@ -71,7 +71,7 @@ export interface RequestEvent { // ApiResponse and RequestEvent are the same thing // we are doing this for have more clear names -export interface ApiResponse extends RequestEvent {} +export interface ApiResponse extends RequestEvent {} declare type anyObject = { [key: string]: any; diff --git a/scripts/utils/generateRequestTypes.js b/scripts/utils/generateRequestTypes.js index e457e7e0b..edba2fa68 100644 --- a/scripts/utils/generateRequestTypes.js +++ b/scripts/utils/generateRequestTypes.js @@ -74,10 +74,10 @@ export interface Generic { } const code = ` -export interface ${name[0].toUpperCase() + name.slice(1)} extends Generic { +export interface ${name[0].toUpperCase() + name.slice(1)}${body ? '' : ''} extends Generic { ${partsArr.map(genLine).join('\n ')} ${paramsArr.map(genLine).join('\n ')} - ${body ? `body${body.required ? '' : '?'}: any;` : ''} + ${body ? `body${body.required ? '' : '?'}: T;` : ''} } ` diff --git a/test/types/index.ts b/test/types/index.ts index 20705bad1..6079906e6 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -22,6 +22,7 @@ import { Client, ApiResponse, + RequestParams, RequestEvent, ResurrectEvent, events, @@ -94,6 +95,40 @@ client.index({ .then((result: ApiResponse) => {}) .catch((err: Error) => {}) +// --- Use generics --- +// Define the search parameters +interface SearchBody { + query: { + match: { foo: string } + } +} +const searchParams: RequestParams.Search = { + index: 'test', + body: { + query: { + match: { foo: 'bar' } + } + } +} + +// Dewfine the interface of the search response +interface SearchResponse { + hits: { + hits: Array<{ + _source: T; + }> + } +} + +// Define the intefrace of the source object +interface Source { + foo: string +} + +client.search(searchParams) + .then((response: ApiResponse>) => console.log(response)) + .catch((err: Error) => {}) + // extend client client.extend('namespace.method', (options: ClientExtendsCallbackOptions) => { return function (params: any) { From 28c0f2eeae25ed31628477751617c29282b548da Mon Sep 17 00:00:00 2001 From: Joel Ericsson Date: Thu, 11 Apr 2019 08:27:57 +0200 Subject: [PATCH 18/84] Fix a typo in usage example (#806) --- docs/usage.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usage.asciidoc b/docs/usage.asciidoc index 8065c120b..ed81ef2fc 100644 --- a/docs/usage.asciidoc +++ b/docs/usage.asciidoc @@ -66,7 +66,7 @@ When using the callback style API, the function will also return an object that [source,js] ---- // calback API -const requesty = client.search({ +const request = client.search({ index: 'my-index', body: { foo: 'bar' } }, { @@ -302,4 +302,4 @@ export interface ResurrectEvent { isAlive: boolean; connection: Connection; } ----- \ No newline at end of file +---- From 72fda2bdd58cc37c7eced6152b7e9f877a1ef96f Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 17 Apr 2019 07:55:18 +0200 Subject: [PATCH 19/84] Drop Node.js v6 support (#818) Node.js v6 will go EOL at the end of April 2019, and already two of the production dependencies of the client have already dropped support for it, and soon others will do *(as well as development dependencies)*. Furthermore, since Node.js will go in EOL it will never get security patches, plus, also OpenSSL-1.0.2 will go EOL [this year](https://github.com/nodejs/Release#release-schedule); to avoid risks for the client users it is better to drop support for Node.js v6 right away. --- .ci/test-matrix.yml | 1 - .npmignore | 3 +++ .travis.yml | 2 +- README.md | 8 +++++++- docs/breaking-changes.asciidoc | 2 +- docs/introduction.asciidoc | 3 ++- package.json | 28 ++++++++++++++-------------- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index 8577d7c32..a5e19021e 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -6,6 +6,5 @@ NODE_JS_VERSION: - 11 - 10 - 8 -- 6 exclude: ~ diff --git a/.npmignore b/.npmignore index 08e9fdf23..becc00414 100644 --- a/.npmignore +++ b/.npmignore @@ -67,3 +67,6 @@ scripts .ci .travis.yml certs +.github +CODE_OF_CONDUCT.md +CONTRIBUTING.md diff --git a/.travis.yml b/.travis.yml index 869b3c57d..90248185e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ sudo: required language: node_js node_js: + - "11" - "10" - "8" - - "6" env: global: diff --git a/README.md b/README.md index 7ec2f077a..78b153f96 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ npm install @elastic/elasticsearch ### Compatibility +The minimum supported version of Node.js is `v8`. + The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using. ``` # Elasticsearch 7.x @@ -40,7 +42,9 @@ The library is compatible with all Elasticsearch versions since 5.x, but you sho ``` ## Usage -You can find the full documentation in the [docs](https://github.com/elastic/elasticsearch-js/tree/master/docs) folder. + +You can find the full documentation in our [docs](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html) website. + ```js const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) @@ -70,7 +74,9 @@ The returned value of **every** API call is formed as follows: } ``` ### Client options + The client is designed to be easily configured as you see fit for your needs, following you can see all the possible options that you can use to configure it. + ```ts { // the Elasticsearch endpoint to use diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc index c7ece5ac5..cd2ccbc09 100644 --- a/docs/breaking-changes.asciidoc +++ b/docs/breaking-changes.asciidoc @@ -9,7 +9,7 @@ Every breaking change was carefully weighed, and each is justified. Furthermore, === Breaking changes -* Minimum supported version of Node.js is `v6`. +* Minimum supported version of Node.js is `v8`. * Everything has been rewritten using ES6 classes to help users extend the defaults more easily. diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc index 35bd75b3b..f0e5dc59e 100644 --- a/docs/introduction.asciidoc +++ b/docs/introduction.asciidoc @@ -18,6 +18,7 @@ npm install @elastic/elasticsearch ---- === Compatibility +The minimum supported version of Node.js is `v8`. The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using. ---- @@ -50,4 +51,4 @@ client.search({ }, (err, result) => { if (err) console.log(err) }) ----- \ No newline at end of file +---- diff --git a/package.json b/package.json index d33cd6593..5e9aa3b3c 100644 --- a/package.json +++ b/package.json @@ -36,33 +36,33 @@ "company": "Elasticsearch BV" }, "devDependencies": { - "@types/node": "^10.12.24", - "codecov": "^3.2.0", - "convert-hrtime": "^2.0.0", + "@types/node": "^11.13.4", + "codecov": "^3.3.0", + "convert-hrtime": "^3.0.0", "dedent": "^0.7.0", - "deepmerge": "^3.1.0", + "deepmerge": "^3.2.0", "dezalgo": "^1.0.3", - "js-yaml": "^3.12.1", + "js-yaml": "^3.13.1", "license-checker": "^25.0.1", "lolex": "^3.1.0", "minimist": "^1.2.0", - "ora": "^3.2.0", + "ora": "^3.4.0", "pretty-hrtime": "^1.0.3", "rimraf": "^2.6.3", - "semver": "^5.6.0", - "simple-git": "^1.107.0", + "semver": "^6.0.0", + "simple-git": "^1.110.0", "simple-statistics": "^7.0.2", - "split2": "^3.1.0", + "split2": "^3.1.1", "standard": "^12.0.1", "stoppable": "^1.1.0", - "tap": "^12.6.0", - "typescript": "^3.3.3", + "tap": "^12.6.1", + "typescript": "^3.4.3", "workq": "^2.1.0" }, "dependencies": { "debug": "^4.1.1", - "decompress-response": "^4.0.0", - "into-stream": "^4.0.0", + "decompress-response": "^4.2.0", + "into-stream": "^5.1.0", "ms": "^2.1.1", "once": "^1.4.0", "pump": "^3.0.0" @@ -76,6 +76,6 @@ "url": "https://github.com/elastic/elasticsearch-js/issues" }, "engines": { - "node": ">=6" + "node": ">=8" } } From c6ce0628220b34bf2393ab4fa73cd849ac58f7c7 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 17 Apr 2019 11:23:15 +0200 Subject: [PATCH 20/84] Updated typings (#819) --- index.d.ts | 20 ++++++++++++++------ lib/Transport.d.ts | 7 ++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7b8bcc49d..22e83efe8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -27,7 +27,8 @@ import Transport, { TransportRequestParams, TransportRequestOptions, nodeFilterFn, - nodeSelectorFn + nodeSelectorFn, + TransportRequestCallback } from './lib/Transport'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool'; @@ -38,12 +39,18 @@ import * as errors from './lib/errors'; declare type anyObject = { [key: string]: any; }; -declare type callbackFn = (err: Error | null, result: ApiResponse) => void; -interface ApiMethod { - (callback?: callbackFn): any; - (params: T, callback?: callbackFn): any; - (params: T, options: TransportRequestOptions, callback?: callbackFn): any; +declare type callbackFn = (err: Error | null, result: ApiResponse) => void; + +interface ApiMethod { + // Promise API + (): Promise>; + (params: TParams): Promise>; + (params: TParams, options: TransportRequestOptions): Promise>; + // Callback API + (callback: callbackFn): TransportRequestCallback; + (params: TParams, callback: callbackFn): TransportRequestCallback; + (params: TParams, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; } // Extend API @@ -604,5 +611,6 @@ export { RequestEvent, ResurrectEvent, RequestParams, + ClientOptions, ClientExtendsCallbackOptions }; diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 3a349cbf1..989d02c76 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -96,6 +96,10 @@ export interface TransportRequestOptions { warnings?: [string]; } +export interface TransportRequestCallback { + abort: () => void; +} + export default class Transport { static sniffReasons: { SNIFF_ON_START: string; @@ -117,7 +121,8 @@ export default class Transport { _nextSniff: number; _isSniffing: boolean; constructor(opts: TransportOptions); - request(params: TransportRequestParams, options: TransportRequestOptions, callback: (err: Error | null, result: ApiResponse) => void): any; + request(params: TransportRequestParams, options?: TransportRequestOptions): Promise; + request(params: TransportRequestParams, options?: TransportRequestOptions, callback?: (err: Error | null, result: ApiResponse) => void): TransportRequestCallback; getConnection(): Connection | null; sniff(callback?: (...args: any[]) => void): void; } From 2f665054f18bff9f7090c1573be9ed29aa60b77a Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 17 Apr 2019 11:28:12 +0200 Subject: [PATCH 21/84] API generation --- api/api/ingest.delete_pipeline.js | 2 +- api/api/ingest.get_pipeline.js | 2 +- api/api/ingest.processor_grok.js | 2 +- api/api/ingest.put_pipeline.js | 2 +- api/api/ingest.simulate.js | 2 +- api/api/license.delete.js | 2 +- api/api/license.get.js | 2 +- api/api/license.get_basic_status.js | 2 +- api/api/license.get_trial_status.js | 2 +- api/api/license.post.js | 2 +- api/api/license.post_start_basic.js | 2 +- api/api/license.post_start_trial.js | 2 +- api/api/migration.deprecations.js | 2 +- api/api/ml.find_file_structure.js | 2 +- api/api/monitoring.bulk.js | 2 +- api/api/security.get_user_privileges.js | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index 98377da51..b4b8f63d7 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -26,7 +26,7 @@ function buildIngestDeletePipeline (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [ingest.delete_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.delete_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html) request * * @param {string} id - Pipeline ID * @param {time} master_timeout - Explicit operation timeout for connection to master node diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index c0cd21726..90a82a3e8 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -26,7 +26,7 @@ function buildIngestGetPipeline (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [ingest.get_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.get_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html) request * * @param {string} id - Comma separated list of pipeline ids. Wildcards supported * @param {time} master_timeout - Explicit operation timeout for connection to master node diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index f3c88aa8f..0d05d1c07 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -26,7 +26,7 @@ function buildIngestProcessorGrok (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [ingest.processor_grok](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.processor_grok](https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get) request * */ diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index 1ce8e62b7..7a1296345 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -26,7 +26,7 @@ function buildIngestPutPipeline (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [ingest.put_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.put_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html) request * * @param {string} id - Pipeline ID * @param {time} master_timeout - Explicit operation timeout for connection to master node diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index b157763cb..9a7b790fe 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -26,7 +26,7 @@ function buildIngestSimulate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [ingest.simulate](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.simulate](https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html) request * * @param {string} id - Pipeline ID * @param {boolean} verbose - Verbose mode. Display data output for each processor in executed pipeline diff --git a/api/api/license.delete.js b/api/api/license.delete.js index 520058967..9b77a9c21 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -26,7 +26,7 @@ function buildLicenseDelete (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.delete](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html) request * */ diff --git a/api/api/license.get.js b/api/api/license.get.js index 613d0e827..454a8a8c4 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -26,7 +26,7 @@ function buildLicenseGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html) request * * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) */ diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index 911e60a27..c25cf35d5 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -26,7 +26,7 @@ function buildLicenseGetBasicStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get_basic_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html) request * */ diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index 51d570fa2..a3c1dda69 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -26,7 +26,7 @@ function buildLicenseGetTrialStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get_trial_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html) request * */ diff --git a/api/api/license.post.js b/api/api/license.post.js index fd238e700..c194aa073 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -26,7 +26,7 @@ function buildLicensePost (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post](https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html) request * * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) * @param {object} body - licenses to be installed diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index 72d9bb04d..d71ab0195 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -26,7 +26,7 @@ function buildLicensePostStartBasic (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post_start_basic](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html) request * * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) */ diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index b99569790..339d58dd5 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -26,7 +26,7 @@ function buildLicensePostStartTrial (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post_start_trial](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html) request * * @param {string} type - The type of trial license to generate (default: "trial") * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index cc5de6d85..d9e7b55bc 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -26,7 +26,7 @@ function buildMigrationDeprecations (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request + * Perform a [migration.deprecations](http://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-deprecation.html) request * * @param {string} index - Index pattern */ diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index 37d2db4dd..f48a83c03 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -26,7 +26,7 @@ function buildMlFindFileStructure (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure.html) request + * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html) request * * @param {int} lines_to_sample - How many lines of the file should be included in the analysis * @param {time} timeout - Timeout after which the analysis will be aborted diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index ff488720b..66054b3e4 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -26,7 +26,7 @@ function buildMonitoringBulk (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [monitoring.bulk](http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html) request + * Perform a [monitoring.bulk](https://www.elastic.co/guide/en/elasticsearch/reference/master/es-monitoring.html) request * * @param {string} type - Default document type for items which don't provide one * @param {string} system_id - Identifier of the monitored system diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index 4b489297b..cf2449bd5 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -26,7 +26,7 @@ function buildSecurityGetUserPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [security.get_user_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html) request + * Perform a [security.get_user_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html) request * */ From c35eb421cb376dd29b14b26220fef3f687a109bb Mon Sep 17 00:00:00 2001 From: onehorsetown Date: Fri, 19 Apr 2019 04:06:20 -0400 Subject: [PATCH 22/84] Update RequestEvent to use parameterized type T (#822) Updated `RequestEvent` to use parameterized type `T`. In reference to: https://github.com/elastic/elasticsearch-js/pull/819#issuecomment-484594841 --- lib/Transport.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 989d02c76..89ec11573 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -50,7 +50,7 @@ interface TransportOptions { } export interface RequestEvent { - body: any; + body: T; statusCode: number | null; headers: anyObject | null; warnings: string[] | null; From e3a0e9ed568de4f3efc7a00d308700bf9ab827c5 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 24 Apr 2019 10:22:37 +0200 Subject: [PATCH 23/84] API generation --- api/api/clear_scroll.js | 6 +----- api/api/count.js | 10 +--------- api/api/create.js | 6 +----- api/api/delete.js | 6 +----- api/api/delete_by_query.js | 12 +----------- api/api/exists.js | 6 +----- api/api/exists_source.js | 11 ++--------- api/api/explain.js | 6 +----- api/api/field_caps.js | 3 +++ api/api/get.js | 12 +----------- api/api/get_source.js | 6 +----- api/api/graph.explore.js | 12 +----------- api/api/index.js | 6 +----- api/api/indices.get_field_mapping.js | 6 +----- api/api/indices.get_mapping.js | 6 +----- api/api/indices.put_mapping.js | 18 +----------------- api/api/indices.validate_query.js | 10 +--------- api/api/mget.js | 10 +--------- api/api/monitoring.bulk.js | 6 +----- api/api/msearch.js | 10 +--------- api/api/msearch_template.js | 10 +--------- api/api/mtermvectors.js | 10 +--------- api/api/nodes.hot_threads.js | 8 +------- api/api/rollup.rollup_search.js | 12 +----------- api/api/scroll.js | 6 +----- api/api/search.js | 10 +--------- api/api/search_template.js | 10 +--------- api/api/termvectors.js | 6 +----- api/api/update.js | 6 +----- api/api/update_by_query.js | 12 +----------- api/requestParams.d.ts | 3 +-- docs/reference.asciidoc | 9 +++------ 32 files changed, 37 insertions(+), 233 deletions(-) diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 552ac23cc..de8f52c39 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -78,11 +78,7 @@ function buildClearScroll (opts) { var path = '' - if ((scroll_id || scrollId) != null) { - path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId) - } else { - path = '/' + '_search' + '/' + 'scroll' - } + path = '/' + '_search' + '/' + 'scroll' // build request object const request = { diff --git a/api/api/count.js b/api/api/count.js index ae6816fba..bab8317f9 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -94,12 +94,6 @@ function buildCount (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -121,9 +115,7 @@ function buildCount (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_count' } else { path = '/' + '_count' diff --git a/api/api/create.js b/api/api/create.js index 0ee306e57..48d087528 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -112,11 +112,7 @@ function buildCreate (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/delete.js b/api/api/delete.js index 35ab29398..54806acf4 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -121,11 +121,7 @@ function buildDelete (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 7e3aae9ea..df256abb2 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -147,12 +147,6 @@ function buildDeleteByQuery (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -174,11 +168,7 @@ function buildDeleteByQuery (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' - } + path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' // build request object const request = { diff --git a/api/api/exists.js b/api/api/exists.js index ac6e5db8a..82e3804a5 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -119,11 +119,7 @@ function buildExists (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/exists_source.js b/api/api/exists_source.js index d8111530e..0f18f614b 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -96,10 +96,7 @@ function buildExistsSource (opts) { } // check required url components - if (params['id'] != null && (params['type'] == null || params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: type, index') - return handleError(err, callback) - } else if (params['type'] != null && (params['index'] == null)) { + if (params['id'] != null && (params['index'] == null)) { const err = new ConfigurationError('Missing required parameter of the url: index') return handleError(err, callback) } @@ -125,11 +122,7 @@ function buildExistsSource (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/explain.js b/api/api/explain.js index f59f7a11c..cac9421e0 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -121,11 +121,7 @@ function buildExplain (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/field_caps.js b/api/api/field_caps.js index c8a6dec42..46ba81f07 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -33,6 +33,7 @@ function buildFieldCaps (opts) { * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - 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 {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {boolean} include_unmapped - Indicates whether unmapped fields should be included in the response. */ const acceptedQuerystring = [ @@ -40,6 +41,7 @@ function buildFieldCaps (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'include_unmapped', 'pretty', 'human', 'error_trace', @@ -51,6 +53,7 @@ function buildFieldCaps (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + includeUnmapped: 'include_unmapped', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/get.js b/api/api/get.js index ff8e8b032..61a6fd0dd 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -40,8 +40,6 @@ function buildGet (opts) { * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field * @param {list} _source_includes - A list of fields to extract and return from the _source field - * @param {list} _source_exclude - A list of fields to exclude from the returned _source field - * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type */ @@ -56,8 +54,6 @@ function buildGet (opts) { '_source', '_source_excludes', '_source_includes', - '_source_exclude', - '_source_include', 'version', 'version_type', 'pretty', @@ -71,8 +67,6 @@ function buildGet (opts) { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', - _sourceExclude: '_source_exclude', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -125,11 +119,7 @@ function buildGet (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/get_source.js b/api/api/get_source.js index bcac14deb..87d001ded 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -116,11 +116,7 @@ function buildGetSource (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 19e601a64..1cf1db589 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -56,12 +56,6 @@ function buildGraphExplore (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -83,11 +77,7 @@ function buildGraphExplore (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore' - } + path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore' // build request object const request = { diff --git a/api/api/index.js b/api/api/index.js index 716d8c4cf..c070a08ca 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -123,12 +123,8 @@ function buildIndex (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else if ((index) != null && (id) != null) { + if ((index) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) } else { path = '/' + encodeURIComponent(index) + '/' + '_doc' } diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 78dcfcc0c..2590fdc17 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -106,12 +106,8 @@ function buildIndicesGetFieldMapping (opts) { var path = '' - if ((index) != null && (type) != null && (fields) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields) - } else if ((index) != null && (fields) != null) { + if ((index) != null && (fields) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields) - } else if ((type) != null && (fields) != null) { - path = '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields) } else { path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields) } diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index 5534a5cec..8eb64f6a8 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -101,12 +101,8 @@ function buildIndicesGetMapping (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mapping' - } else if ((type) != null) { - path = '/' + '_mapping' + '/' + encodeURIComponent(type) } else { path = '/' + '_mapping' } diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 491ffd2db..7528ca88d 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -102,23 +102,7 @@ function buildIndicesPutMapping (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mapping' - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings' - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type) - } else if ((type) != null) { - path = '/' + '_mapping' + '/' + encodeURIComponent(type) - } else if ((type) != null) { - path = '/' + '_mappings' + '/' + encodeURIComponent(type) - } else if ((index) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_mappings' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_mapping' - } + path = '/' + encodeURIComponent(index) + '/' + '_mapping' // build request object const request = { diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index fca278548..459c1b37f 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -88,12 +88,6 @@ function buildIndicesValidateQuery (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -115,9 +109,7 @@ function buildIndicesValidateQuery (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query' } else { path = '/' + '_validate' + '/' + 'query' diff --git a/api/api/mget.js b/api/api/mget.js index f01283b20..a043fca04 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -83,12 +83,6 @@ function buildMget (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -110,9 +104,7 @@ function buildMget (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mget' } else { path = '/' + '_mget' diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 66054b3e4..a80dc212d 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -86,11 +86,7 @@ function buildMonitoringBulk (opts) { var path = '' - if ((type) != null) { - path = '/' + '_monitoring' + '/' + encodeURIComponent(type) + '/' + 'bulk' - } else { - path = '/' + '_monitoring' + '/' + 'bulk' - } + path = '/' + '_monitoring' + '/' + 'bulk' // build request object const request = { diff --git a/api/api/msearch.js b/api/api/msearch.js index a4615c4fb..8b3a2b7e0 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -85,12 +85,6 @@ function buildMsearch (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -112,9 +106,7 @@ function buildMsearch (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' } else { path = '/' + '_msearch' diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 1692f567f..0ce7de6ba 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -79,12 +79,6 @@ function buildMsearchTemplate (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -106,9 +100,7 @@ function buildMsearchTemplate (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template' } else { path = '/' + '_msearch' + '/' + 'template' diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index fe4c49a6e..b4b691c1e 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -87,12 +87,6 @@ function buildMtermvectors (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -114,9 +108,7 @@ function buildMtermvectors (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors' } else { path = '/' + '_mtermvectors' diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 12f59399c..f98655a9e 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -97,15 +97,9 @@ function buildNodesHotThreads (opts) { var path = '' if ((node_id || nodeId) != null) { - path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads' - } else if ((node_id || nodeId) != null) { - path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads' - } else if ((node_id || nodeId) != null) { - path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads' - } else if ((node_id || nodeId) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads' } else { - path = '/' + '_cluster' + '/' + 'nodes' + '/' + 'hotthreads' + path = '/' + '_nodes' + '/' + 'hot_threads' } // build request object diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 78094e181..5d0018276 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -67,12 +67,6 @@ function buildRollupRollupSearch (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -94,11 +88,7 @@ function buildRollupRollupSearch (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_rollup_search' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_rollup_search' - } + path = '/' + encodeURIComponent(index) + '/' + '_rollup_search' // build request object const request = { diff --git a/api/api/scroll.js b/api/api/scroll.js index 0bfd11aff..f5599f17a 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -86,11 +86,7 @@ function buildScroll (opts) { var path = '' - if ((scroll_id || scrollId) != null) { - path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId) - } else { - path = '/' + '_search' + '/' + 'scroll' - } + path = '/' + '_search' + '/' + 'scroll' // build request object const request = { diff --git a/api/api/search.js b/api/api/search.js index c7c08cd8d..924a059e0 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -169,12 +169,6 @@ function buildSearch (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -196,9 +190,7 @@ function buildSearch (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' } else { path = '/' + '_search' diff --git a/api/api/search_template.js b/api/api/search_template.js index aadc63aaf..17d56bec2 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -98,12 +98,6 @@ function buildSearchTemplate (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -125,9 +119,7 @@ function buildSearchTemplate (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template' } else { path = '/' + '_search' + '/' + 'template' diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 2571b64fd..5dc9600ba 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -113,12 +113,8 @@ function buildTermvectors (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors' - } else if ((index) != null && (id) != null) { + if ((index) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id) - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' } else { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' } diff --git a/api/api/update.js b/api/api/update.js index 3a4f6120d..aeff9b454 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -124,11 +124,7 @@ function buildUpdate (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_update' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index ab41dcf72..573a27a2a 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -148,12 +148,6 @@ function buildUpdateByQuery (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -175,11 +169,7 @@ function buildUpdateByQuery (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' - } + path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' // build request object const request = { diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 2e0854f9c..5f1134da4 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -493,6 +493,7 @@ export interface FieldCaps extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + include_unmapped?: boolean; } export interface Get extends Generic { @@ -508,8 +509,6 @@ export interface Get extends Generic { _source?: string | string[]; _source_excludes?: string | string[]; _source_includes?: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index ce0bc6875..3e2029d82 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1492,6 +1492,9 @@ link:{ref}/search-field-caps.html[Reference] |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` +|`include_unmapped` or `includeUnmapped` +|`boolean` - Indicates whether unmapped fields should be included in the response. + |=== === get @@ -1538,12 +1541,6 @@ link:{ref}/docs-get.html[Reference] |`_source_includes` or `_sourceIncludes` |`string, string[]` - A list of fields to extract and return from the _source field -|`_source_exclude` or `_sourceExclude` -|`string, string[]` - A list of fields to exclude from the returned _source field - -|`_source_include` or `_sourceInclude` -|`string, string[]` - A list of fields to extract and return from the _source field - |`version` |`number` - Explicit version number for concurrency control From 928746d19ff8432ce7a7c79eb15b444c23457609 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 24 Apr 2019 10:55:14 +0200 Subject: [PATCH 24/84] Updated test --- test/unit/api.test.js | 14 ++------------ test/unit/events.test.js | 9 +++------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/test/unit/api.test.js b/test/unit/api.test.js index cf8feb77f..3a0192cd8 100644 --- a/test/unit/api.test.js +++ b/test/unit/api.test.js @@ -38,7 +38,6 @@ test('Basic (callback)', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, (err, { body }) => { t.error(err) @@ -64,7 +63,6 @@ test('Basic (promises)', t => { client .search({ index: 'test', - type: 'doc', q: 'foo:bar' }) .then(({ body }) => { @@ -91,7 +89,6 @@ test('Error (callback)', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, (err, { body }) => { t.ok(err) @@ -117,7 +114,6 @@ test('Error (promises)', t => { client .search({ index: 'test', - type: 'doc', q: 'foo:bar' }) .then(t.fail) @@ -143,7 +139,6 @@ test('Abort method (callback)', t => { const request = client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, (err, { body }) => { t.error(err) @@ -170,7 +165,6 @@ test('Abort is not supported in promises', t => { const request = client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }) @@ -200,7 +194,6 @@ test('Basic (options and callback)', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, { requestTimeout: 10000 @@ -228,7 +221,6 @@ test('Basic (options and promises)', t => { client .search({ index: 'test', - type: 'doc', q: 'foo:bar' }, { requestTimeout: 10000 @@ -245,7 +237,7 @@ test('Pass unknown parameters as query parameters (and get a warning)', t => { t.plan(4) function handler (req, res) { - t.strictEqual(req.url, '/test/doc/_search?q=foo%3Abar&winter=is%20coming') + t.strictEqual(req.url, '/test/_search?q=foo%3Abar&winter=is%20coming') res.setHeader('Content-Type', 'application/json;utf=8') res.end(JSON.stringify({ hello: 'world' })) } @@ -257,7 +249,6 @@ test('Pass unknown parameters as query parameters (and get a warning)', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar', winter: 'is coming' }, (err, { body, warnings }) => { @@ -273,7 +264,7 @@ test('If the API uses the same key for both url and query parameter, the url sho t.plan(2) function handler (req, res) { - t.strictEqual(req.url, '/index/type/_bulk') + t.strictEqual(req.url, '/index/_bulk') res.setHeader('Content-Type', 'application/json;utf=8') res.end(JSON.stringify({ hello: 'world' })) } @@ -286,7 +277,6 @@ test('If the API uses the same key for both url and query parameter, the url sho // bulk has two `type` parameters client.bulk({ index: 'index', - type: 'type', body: [] }, (err, { body, warnings }) => { t.error(err) diff --git a/test/unit/events.test.js b/test/unit/events.test.js index 432194a29..a40f72386 100644 --- a/test/unit/events.test.js +++ b/test/unit/events.test.js @@ -43,7 +43,7 @@ test('Should emit a request event when a request is performed', t => { request: { params: { method: 'GET', - path: '/test/doc/_search', + path: '/test/_search', body: '', querystring: 'q=foo%3Abar', headers: { @@ -72,7 +72,6 @@ test('Should emit a request event when a request is performed', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, (err, result) => { t.error(err) @@ -101,7 +100,7 @@ test('Should emit a response event in case of a successful response', t => { request: { params: { method: 'GET', - path: '/test/doc/_search', + path: '/test/_search', body: '', querystring: 'q=foo%3Abar', headers: { @@ -130,7 +129,6 @@ test('Should emit a response event in case of a successful response', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, (err, result) => { t.error(err) @@ -157,7 +155,7 @@ test('Should emit a response event with the error set', t => { request: { params: { method: 'GET', - path: '/test/doc/_search', + path: '/test/_search', body: '', querystring: 'q=foo%3Abar', headers: { @@ -186,7 +184,6 @@ test('Should emit a response event with the error set', t => { client.search({ index: 'test', - type: 'doc', q: 'foo:bar' }, { requestTimeout: 500 From 349b832d2b2444cf14389b4fd6587dad571e942e Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 26 Apr 2019 09:25:34 +0200 Subject: [PATCH 25/84] Support for deprecated paths (#828) * Updated code generation * API generation * Updated test --- api/api/clear_scroll.js | 6 +++++- api/api/count.js | 10 +++++++++- api/api/create.js | 6 +++++- api/api/delete.js | 12 +++++------- api/api/delete_by_query.js | 12 +++++++++++- api/api/exists.js | 6 +++++- api/api/exists_source.js | 11 +++++++++-- api/api/explain.js | 6 +++++- api/api/get.js | 6 +++++- api/api/get_source.js | 6 +++++- api/api/graph.explore.js | 12 +++++++++++- api/api/index.js | 12 +++++------- api/api/indices.get_field_mapping.js | 6 +++++- api/api/indices.get_mapping.js | 6 +++++- api/api/indices.put_mapping.js | 18 +++++++++++++++++- api/api/indices.validate_query.js | 10 +++++++++- api/api/mget.js | 10 +++++++++- api/api/monitoring.bulk.js | 6 +++++- api/api/msearch.js | 10 +++++++++- api/api/msearch_template.js | 10 +++++++++- api/api/mtermvectors.js | 10 +++++++++- api/api/nodes.hot_threads.js | 6 ++++++ api/api/rollup.rollup_search.js | 12 +++++++++++- api/api/scroll.js | 6 +++++- api/api/search.js | 10 +++++++++- api/api/search_template.js | 10 +++++++++- api/api/termvectors.js | 6 +++++- api/api/update.js | 6 +++++- api/api/update_by_query.js | 12 +++++++++++- scripts/utils/generateApis.js | 12 +++++++++++- test/integration/index.js | 3 +++ 31 files changed, 232 insertions(+), 42 deletions(-) diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index de8f52c39..552ac23cc 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -78,7 +78,11 @@ function buildClearScroll (opts) { var path = '' - path = '/' + '_search' + '/' + 'scroll' + if ((scroll_id || scrollId) != null) { + path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId) + } else { + path = '/' + '_search' + '/' + 'scroll' + } // build request object const request = { diff --git a/api/api/count.js b/api/api/count.js index bab8317f9..ae6816fba 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -94,6 +94,12 @@ function buildCount (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -115,7 +121,9 @@ function buildCount (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_count' } else { path = '/' + '_count' diff --git a/api/api/create.js b/api/api/create.js index 48d087528..0ee306e57 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -112,7 +112,11 @@ function buildCreate (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/delete.js b/api/api/delete.js index 54806acf4..6f835dcc8 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -94,12 +94,6 @@ function buildDelete (opts) { return handleError(err, callback) } - // check required url components - if (params['id'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -121,7 +115,11 @@ function buildDelete (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + } else { + path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index df256abb2..7e3aae9ea 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -147,6 +147,12 @@ function buildDeleteByQuery (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -168,7 +174,11 @@ function buildDeleteByQuery (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' + } // build request object const request = { diff --git a/api/api/exists.js b/api/api/exists.js index 82e3804a5..ac6e5db8a 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -119,7 +119,11 @@ function buildExists (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + } else { + path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 0f18f614b..d8111530e 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -96,7 +96,10 @@ function buildExistsSource (opts) { } // check required url components - if (params['id'] != null && (params['index'] == null)) { + if (params['id'] != null && (params['type'] == null || params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: type, index') + return handleError(err, callback) + } else if (params['type'] != null && (params['index'] == null)) { const err = new ConfigurationError('Missing required parameter of the url: index') return handleError(err, callback) } @@ -122,7 +125,11 @@ function buildExistsSource (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/explain.js b/api/api/explain.js index cac9421e0..f59f7a11c 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -121,7 +121,11 @@ function buildExplain (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/get.js b/api/api/get.js index 61a6fd0dd..b9a5c192e 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -119,7 +119,11 @@ function buildGet (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + } else { + path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/get_source.js b/api/api/get_source.js index 87d001ded..bcac14deb 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -116,7 +116,11 @@ function buildGetSource (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 1cf1db589..19e601a64 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -56,6 +56,12 @@ function buildGraphExplore (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -77,7 +83,11 @@ function buildGraphExplore (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore' + } // build request object const request = { diff --git a/api/api/index.js b/api/api/index.js index c070a08ca..07e1a09c3 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -96,12 +96,6 @@ function buildIndex (opts) { return handleError(err, callback) } - // check required url components - if (params['id'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -123,8 +117,12 @@ function buildIndex (opts) { var path = '' - if ((index) != null && (id) != null) { + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + } else if ((index) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) + } else if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) } else { path = '/' + encodeURIComponent(index) + '/' + '_doc' } diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 2590fdc17..78dcfcc0c 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -106,8 +106,12 @@ function buildIndicesGetFieldMapping (opts) { var path = '' - if ((index) != null && (fields) != null) { + if ((index) != null && (type) != null && (fields) != null) { + path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields) + } else if ((index) != null && (fields) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields) + } else if ((type) != null && (fields) != null) { + path = '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields) } else { path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields) } diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index 8eb64f6a8..5534a5cec 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -101,8 +101,12 @@ function buildIndicesGetMapping (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mapping' + } else if ((type) != null) { + path = '/' + '_mapping' + '/' + encodeURIComponent(type) } else { path = '/' + '_mapping' } diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 7528ca88d..20dee2bf8 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -102,7 +102,23 @@ function buildIndicesPutMapping (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_mapping' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mapping' + } else if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + } else if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings' + } else if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type) + } else if ((type) != null) { + path = '/' + '_mappings' + '/' + encodeURIComponent(type) + } else if ((type) != null) { + path = '/' + '_mapping' + '/' + encodeURIComponent(type) + } else if ((index) != null) { + path = '/' + encodeURIComponent(index) + '/' + '_mapping' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_mappings' + } // build request object const request = { diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 459c1b37f..fca278548 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -88,6 +88,12 @@ function buildIndicesValidateQuery (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -109,7 +115,9 @@ function buildIndicesValidateQuery (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query' } else { path = '/' + '_validate' + '/' + 'query' diff --git a/api/api/mget.js b/api/api/mget.js index a043fca04..f01283b20 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -83,6 +83,12 @@ function buildMget (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -104,7 +110,9 @@ function buildMget (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mget' } else { path = '/' + '_mget' diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index a80dc212d..66054b3e4 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -86,7 +86,11 @@ function buildMonitoringBulk (opts) { var path = '' - path = '/' + '_monitoring' + '/' + 'bulk' + if ((type) != null) { + path = '/' + '_monitoring' + '/' + encodeURIComponent(type) + '/' + 'bulk' + } else { + path = '/' + '_monitoring' + '/' + 'bulk' + } // build request object const request = { diff --git a/api/api/msearch.js b/api/api/msearch.js index 8b3a2b7e0..a4615c4fb 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -85,6 +85,12 @@ function buildMsearch (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -106,7 +112,9 @@ function buildMsearch (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' } else { path = '/' + '_msearch' diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 0ce7de6ba..1692f567f 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -79,6 +79,12 @@ function buildMsearchTemplate (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -100,7 +106,9 @@ function buildMsearchTemplate (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template' } else { path = '/' + '_msearch' + '/' + 'template' diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index b4b691c1e..fe4c49a6e 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -87,6 +87,12 @@ function buildMtermvectors (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -108,7 +114,9 @@ function buildMtermvectors (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors' } else { path = '/' + '_mtermvectors' diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index f98655a9e..08512b148 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -97,7 +97,13 @@ function buildNodesHotThreads (opts) { var path = '' if ((node_id || nodeId) != null) { + path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads' + } else if ((node_id || nodeId) != null) { + path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads' + } else if ((node_id || nodeId) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads' + } else if ((node_id || nodeId) != null) { + path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads' } else { path = '/' + '_nodes' + '/' + 'hot_threads' } diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 5d0018276..78094e181 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -67,6 +67,12 @@ function buildRollupRollupSearch (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -88,7 +94,11 @@ function buildRollupRollupSearch (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_rollup_search' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_rollup_search' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_rollup_search' + } // build request object const request = { diff --git a/api/api/scroll.js b/api/api/scroll.js index f5599f17a..0bfd11aff 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -86,7 +86,11 @@ function buildScroll (opts) { var path = '' - path = '/' + '_search' + '/' + 'scroll' + if ((scroll_id || scrollId) != null) { + path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId) + } else { + path = '/' + '_search' + '/' + 'scroll' + } // build request object const request = { diff --git a/api/api/search.js b/api/api/search.js index 924a059e0..c7c08cd8d 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -169,6 +169,12 @@ function buildSearch (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -190,7 +196,9 @@ function buildSearch (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' } else { path = '/' + '_search' diff --git a/api/api/search_template.js b/api/api/search_template.js index 17d56bec2..aadc63aaf 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -98,6 +98,12 @@ function buildSearchTemplate (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -119,7 +125,9 @@ function buildSearchTemplate (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template' } else { path = '/' + '_search' + '/' + 'template' diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 5dc9600ba..2571b64fd 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -113,8 +113,12 @@ function buildTermvectors (opts) { var path = '' - if ((index) != null && (id) != null) { + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors' + } else if ((index) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id) + } else if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' } else { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' } diff --git a/api/api/update.js b/api/api/update.js index aeff9b454..3a4f6120d 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -124,7 +124,11 @@ function buildUpdate (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id) + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_update' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id) + } // build request object const request = { diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 573a27a2a..ab41dcf72 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -148,6 +148,12 @@ function buildUpdateByQuery (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -169,7 +175,11 @@ function buildUpdateByQuery (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' + } // build request object const request = { diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index 33fd4eded..9dbeb04b3 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -17,6 +17,8 @@ * under the License. */ +/* eslint camelcase: 0 */ + 'use strict' const dedent = require('dedent') @@ -33,6 +35,7 @@ const noPathValidation = [ 'explain', 'get', 'get_source', + 'index', 'indices.get_alias', 'indices.exists_alias', 'indices.get_field_mapping', @@ -40,6 +43,7 @@ const noPathValidation = [ 'indices.get_settings', 'indices.put_mapping', 'indices.stats', + 'delete', 'nodes.info', 'nodes.stats', 'nodes.usage', @@ -66,10 +70,16 @@ function generate (spec, common) { .replace(/_([a-z])/g, k => k[1].toUpperCase()) const methods = spec[api].methods - const { paths, parts, params } = spec[api].url + const { paths, deprecated_paths, parts, params } = spec[api].url const acceptedQuerystring = [] const required = [] + if (deprecated_paths) { + for (const p of deprecated_paths) { + paths.push(p.path) + } + } + for (const key in parts) { if (parts[key].required) { required.push(key) diff --git a/test/integration/index.js b/test/integration/index.js index 328d83b7e..13b0b7648 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -34,6 +34,9 @@ const esFolder = join(__dirname, '..', '..', 'elasticsearch') const yamlFolder = join(esFolder, 'rest-api-spec', 'src', 'main', 'resources', 'rest-api-spec', 'test') const xPackYamlFolder = join(esFolder, 'x-pack', 'plugin', 'src', 'test', 'resources', 'rest-api-spec', 'test') const customSkips = [ + // TODO: remove this once 'arbitrary_key' is implemented + // https://github.com/elastic/elasticsearch/pull/41492 + 'indices.split/30_copy_settings.yml', // skipping because we are booting ES with `discovery.type=single-node` // and this test will fail because of this configuration 'nodes.stats/30_discovery.yml', From 2f76b366ce8bcdea15ade39610e2c596c95c085a Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 26 Apr 2019 15:01:14 +0200 Subject: [PATCH 26/84] Updated .travis.yml (#831) --- .travis.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90248185e..32a8686d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,21 +9,11 @@ node_js: - "10" - "8" -env: - global: - - ELASTICSEARCH_VERSION=8.0.0-SNAPSHOT - - QUIET=true - -before_install: - - wget https://snapshots.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz - - tar -xzf elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz - - ./elasticsearch-${ELASTICSEARCH_VERSION}/bin/elasticsearch -Enode.attr.testattr=test -Epath.repo=/tmp -Erepositories.url.allowed_urls='http://snapshot.*' &> /dev/null & - install: - npm install script: - - npm run ci + - npm run license-checker && npm run test notifications: email: From 8e8b7fbdee7c3779ecffcb144d537634e38a08e8 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 26 Apr 2019 17:24:54 +0200 Subject: [PATCH 27/84] Node v12 and bumped dependencies (#832) * Node v12 * Bumped dependencies * Disable automatic code coverage --- .ci/test-matrix.yml | 8 ++++---- .travis.yml | 2 +- package.json | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index a5e19021e..13940738f 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -1,10 +1,10 @@ --- ELASTICSEARCH_VERSION: -- 8.0.0-SNAPSHOT + - 8.0.0-SNAPSHOT NODE_JS_VERSION: -- 11 -- 10 -- 8 + - 12 + - 10 + - 8 exclude: ~ diff --git a/.travis.yml b/.travis.yml index 32a8686d7..49778bef5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ sudo: required language: node_js node_js: - - "11" + - "12" - "10" - "8" diff --git a/package.json b/package.json index 5e9aa3b3c..cd88d16eb 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,9 @@ ], "scripts": { "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types", - "test:unit": "tap test/unit/*.test.js -J -t 300", - "test:behavior": "tap test/behavior/*.test.js -J -t 300", - "test:integration": "tap test/integration/index.js -T --harmony --no-esm", + "test:unit": "tap test/unit/*.test.js -t 300 --no-coverage", + "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage", + "test:integration": "tap test/integration/index.js -T --harmony --no-esm --no-coverage", "test:types": "tsc --project ./test/types/tsconfig.json", "test:coverage": "nyc npm run test:unit && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", @@ -36,7 +36,7 @@ "company": "Elasticsearch BV" }, "devDependencies": { - "@types/node": "^11.13.4", + "@types/node": "^11.13.7", "codecov": "^3.3.0", "convert-hrtime": "^3.0.0", "dedent": "^0.7.0", @@ -44,7 +44,7 @@ "dezalgo": "^1.0.3", "js-yaml": "^3.13.1", "license-checker": "^25.0.1", - "lolex": "^3.1.0", + "lolex": "^4.0.1", "minimist": "^1.2.0", "ora": "^3.4.0", "pretty-hrtime": "^1.0.3", @@ -55,8 +55,8 @@ "split2": "^3.1.1", "standard": "^12.0.1", "stoppable": "^1.1.0", - "tap": "^12.6.1", - "typescript": "^3.4.3", + "tap": "^13.0.1", + "typescript": "^3.4.5", "workq": "^2.1.0" }, "dependencies": { From 9320ef939d52546b5082b967e40711c92da4a51f Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 29 Apr 2019 09:18:38 +0200 Subject: [PATCH 28/84] Fix resurrect timeout formula (#833) * Fixes #827 * Updated test --- lib/ConnectionPool.js | 18 ++++-------------- test/behavior/resurrect.test.js | 8 ++++---- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index b4b396ac8..fe116b442 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -34,11 +34,7 @@ class ConnectionPool { this._ssl = opts.ssl this._agent = opts.agent // the resurrect timeout is 60s - // we multiply it by 2 because the resurrect formula is - // `Math.pow(resurrectTimeout * 2, deadCount -1)` - // and we don't need to multiply by 2 - // the resurrectTimeout every time - this.resurrectTimeout = 1000 * 60 * 2 + this.resurrectTimeout = 1000 * 60 // number of consecutive failures after which // the timeout doesn't increase this.resurrectTimeoutCutoff = 5 @@ -94,15 +90,9 @@ class ConnectionPool { connection.status = Connection.statuses.DEAD connection.deadCount++ // resurrectTimeout formula: - // `Math.pow(resurrectTimeout * 2, deadCount -1)` - // we don't need to multiply the resurrectTimeout by 2 - // every time, it is cached during the initialization - connection.resurrectTimeout = Date.now() + Math.pow( - this.resurrectTimeout, - Math.min( - connection.deadCount - 1, - this.resurrectTimeoutCutoff - ) + // `resurrectTimeout * 2 ** min(deadCount - 1, resurrectTimeoutCutoff)` + connection.resurrectTimeout = Date.now() + this.resurrectTimeout * Math.pow( + 2, Math.min(connection.deadCount - 1, this.resurrectTimeoutCutoff) ) // sort the dead list in ascending order diff --git a/test/behavior/resurrect.test.js b/test/behavior/resurrect.test.js index a57be54e3..68aba8353 100644 --- a/test/behavior/resurrect.test.js +++ b/test/behavior/resurrect.test.js @@ -74,7 +74,7 @@ test('Should execute the recurrect API with the ping strategy', t => { }) q.add((q, done) => { - clock.tick(10) + clock.tick(1000 * 61) client.info((err, result) => { t.error(err) done() @@ -133,7 +133,7 @@ test('Resurrect a node and handle 502/3/4 status code', t => { }) q.add((q, done) => { - clock.tick(10) + clock.tick(1000 * 61) client.info((err, result) => { t.error(err) done() @@ -141,7 +141,7 @@ test('Resurrect a node and handle 502/3/4 status code', t => { }) q.add((q, done) => { - clock.tick(150000) + clock.tick(1000 * 10 * 60) client.info((err, result) => { t.error(err) done() @@ -194,7 +194,7 @@ test('Should execute the recurrect API with the optimistic strategy', t => { }) q.add((q, done) => { - clock.tick(10) + clock.tick(1000 * 61) client.info((err, result) => { t.error(err) done() From 6f4fb16200a2ffaee963848e2c737cacd9c29032 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 2 May 2019 11:59:06 +0200 Subject: [PATCH 29/84] Updated installation instructions (#835) * Updated installation instructions * Added a note about Elasticsearch master --- docs/introduction.asciidoc | 57 ++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc index f0e5dc59e..4bdd7083a 100644 --- a/docs/introduction.asciidoc +++ b/docs/introduction.asciidoc @@ -32,23 +32,50 @@ The library is compatible with all Elasticsearch versions since 5.x, but you sho @elastic/elasticsearch@5 ---- -=== Usage +==== Install multiple versions +If you are using multiple versions of Elasticsearch, you need to use multiple versions of the client. + +In the past, install multiple versions of the same package was not possible, but with `npm v6.9`, you can do that via aliasing. + +The command you must run to install different version of the client is: + +[source,sh] +---- +npm install @npm:@elastic/elasticsearch@ +---- + +So for example if you need to install `7.x` and `6.x`, you will run +[source,sh] +---- +npm install es6@npm:@elastic/elasticsearch@6 +npm install es7@npm:@elastic/elasticsearch@7 +---- + +And your `package.json` will look like the following: +[source,json] +---- +"dependencies": { + "es6": "npm:@elastic/elasticsearch@^6.7.0", + "es7": "npm:@elastic/elasticsearch@^7.0.0" +} +---- + +And finally, you will require the packages from your code by using the alias you have defined. + [source,js] ---- -const { Client } = require('@elastic/elasticsearch') -const client = new Client({ node: 'http://localhost:9200' }) +const { Client: Client6 } = require('es6') +const { Client: Client7 } = require('es7') -// promise API -const result = await client.search({ - index: 'my-index', - body: { foo: 'bar' } -}) +const client6 = new Client6({ node: 'http://localhost:9200' }) +const client7 = new Client7({ node: 'http://localhost:9201' }) -// callback API -client.search({ - index: 'my-index', - body: { foo: 'bar' } -}, (err, result) => { - if (err) console.log(err) -}) +client6.info(console.log) +client7.info(console.log) +---- + +Finally, if you want to install the client for the next version of Elasticsearch (the one that lives in Elasticsearch's master branch), you can use the following command: +[source,sh] +---- +npm install esmaster@github:elastic/elasticsearch-js ---- +WARNING: This command will install the master branch of the client, which is not considered stable. From 1261e60d41699bb83c4fd10c8f3a6b2e3a76940e Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 3 May 2019 14:36:17 +0200 Subject: [PATCH 30/84] Better handling of hostname/ip:port format (#837) * Better handling of hostname/ip:port format * Updated test --- lib/ConnectionPool.js | 14 +++-- test/unit/connection-pool.test.js | 88 ++++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 10 deletions(-) diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index fe116b442..6a164d4ae 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -336,16 +336,14 @@ class ConnectionPool { // if we encounter the second case, we should // use the hostname instead of the ip var address = node.http.publish_address - const hostAndIpRegex = /^[a-z0-9_.-]*\/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/gi - const match = address.match(hostAndIpRegex) - if (match !== null) { - const ipRegex = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/ - const ip = address.match(ipRegex)[0] - // extract the hostname, the -1 at the end removes the final / - const hostname = address.slice(0, address.indexOf(ip) - 1) - const port = address.split(':')[1] + const parts = address.split('/') + // the url is in the form of hostname/ip:port + if (parts.length > 1) { + const hostname = parts[0] + const port = parts[1].match(/((?::))(?:[0-9]+)$/g)[0].slice(1) address = `${hostname}:${port}` } + address = address.slice(0, 4) === 'http' ? address : `${protocol}//${address}` diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index d5ef6320e..b288a6a43 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -282,7 +282,7 @@ test('API', t => { }) t.test('nodesToHost', t => { - t.test('publish_address as ip address', t => { + t.test('publish_address as ip address (IPv4)', t => { const pool = new ConnectionPool({ Connection }) const nodes = { a1: { @@ -324,7 +324,49 @@ test('API', t => { t.end() }) - t.test('publish_address as host/ip', t => { + t.test('publish_address as ip address (IPv6)', t => { + const pool = new ConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: '[::1]:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: '[::1]:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://[::1]:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://[::1]:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, '[::1]:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, '[::1]:9201') + t.end() + }) + + t.test('publish_address as host/ip (IPv4)', t => { const pool = new ConnectionPool({ Connection }) const nodes = { a1: { @@ -366,6 +408,48 @@ test('API', t => { t.end() }) + t.test('publish_address as host/ip (IPv6)', t => { + const pool = new ConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: 'example.com/[::1]:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: 'example.com/[::1]:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://example.com:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://example.com:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, 'example.com:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, 'example.com:9201') + t.end() + }) + t.test('Should use the configure protocol', t => { const pool = new ConnectionPool({ Connection }) const nodes = { From 269c0fc96a7a1535e88479eaa814ea5a45c188a1 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 3 May 2019 17:23:40 +0200 Subject: [PATCH 31/84] Improve observability (#834) * API generation * Added correlation id support * Updated docs * Updated test * Updated code generation * API generation * Updated code generation * Added support for client name and custom context object * Updated docs * Updated test * Fix docs * Updated docs * Added id support also for sniffing * Updated test * Update docs/observability.asciidoc Co-Authored-By: delvedor * Update docs/observability.asciidoc Co-Authored-By: delvedor * Apply suggestions * Update docs/configuration.asciidoc Co-Authored-By: delvedor * Update docs/configuration.asciidoc Co-Authored-By: delvedor * Update docs/observability.asciidoc Co-Authored-By: delvedor * Update docs/observability.asciidoc Co-Authored-By: delvedor * Update docs/observability.asciidoc Co-Authored-By: delvedor * Apply suggestions * Updated README.md * Fixed test * Addressed suggestions --- README.md | 8 +- api/api/bulk.js | 2 + api/api/cat.aliases.js | 2 + api/api/cat.allocation.js | 2 + api/api/cat.count.js | 2 + api/api/cat.fielddata.js | 2 + api/api/cat.health.js | 2 + api/api/cat.help.js | 2 + api/api/cat.indices.js | 2 + api/api/cat.master.js | 2 + api/api/cat.nodeattrs.js | 2 + api/api/cat.nodes.js | 2 + api/api/cat.pending_tasks.js | 2 + api/api/cat.plugins.js | 2 + api/api/cat.recovery.js | 2 + api/api/cat.repositories.js | 2 + api/api/cat.segments.js | 2 + api/api/cat.shards.js | 2 + api/api/cat.snapshots.js | 2 + api/api/cat.tasks.js | 2 + api/api/cat.templates.js | 2 + api/api/cat.thread_pool.js | 2 + api/api/ccr.delete_auto_follow_pattern.js | 2 + api/api/ccr.follow.js | 2 + api/api/ccr.follow_info.js | 2 + api/api/ccr.follow_stats.js | 2 + api/api/ccr.forget_follower.js | 2 + api/api/ccr.get_auto_follow_pattern.js | 2 + api/api/ccr.pause_follow.js | 2 + api/api/ccr.put_auto_follow_pattern.js | 2 + api/api/ccr.resume_follow.js | 2 + api/api/ccr.stats.js | 2 + api/api/ccr.unfollow.js | 2 + api/api/clear_scroll.js | 2 + api/api/cluster.allocation_explain.js | 2 + api/api/cluster.get_settings.js | 2 + api/api/cluster.health.js | 2 + api/api/cluster.pending_tasks.js | 2 + api/api/cluster.put_settings.js | 2 + api/api/cluster.remote_info.js | 2 + api/api/cluster.reroute.js | 2 + api/api/cluster.state.js | 2 + api/api/cluster.stats.js | 2 + api/api/count.js | 2 + api/api/create.js | 2 + .../data_frame.delete_data_frame_transform.js | 2 + .../data_frame.get_data_frame_transform.js | 2 + ...ta_frame.get_data_frame_transform_stats.js | 2 + ...data_frame.preview_data_frame_transform.js | 2 + .../data_frame.put_data_frame_transform.js | 2 + .../data_frame.start_data_frame_transform.js | 2 + .../data_frame.stop_data_frame_transform.js | 2 + api/api/delete.js | 2 + api/api/delete_by_query.js | 2 + api/api/delete_by_query_rethrottle.js | 2 + api/api/delete_script.js | 2 + api/api/exists.js | 2 + api/api/exists_source.js | 2 + api/api/explain.js | 2 + api/api/field_caps.js | 2 + api/api/get.js | 2 + api/api/get_script.js | 2 + api/api/get_source.js | 2 + api/api/graph.explore.js | 2 + api/api/ilm.delete_lifecycle.js | 2 + api/api/ilm.explain_lifecycle.js | 2 + api/api/ilm.get_lifecycle.js | 2 + api/api/ilm.get_status.js | 2 + api/api/ilm.move_to_step.js | 2 + api/api/ilm.put_lifecycle.js | 2 + api/api/ilm.remove_policy.js | 2 + api/api/ilm.retry.js | 2 + api/api/ilm.start.js | 2 + api/api/ilm.stop.js | 2 + api/api/index.js | 2 + api/api/indices.analyze.js | 2 + api/api/indices.clear_cache.js | 2 + api/api/indices.close.js | 2 + api/api/indices.create.js | 2 + api/api/indices.delete.js | 2 + api/api/indices.delete_alias.js | 2 + api/api/indices.delete_template.js | 2 + api/api/indices.exists.js | 2 + api/api/indices.exists_alias.js | 2 + api/api/indices.exists_template.js | 2 + api/api/indices.exists_type.js | 2 + api/api/indices.flush.js | 2 + api/api/indices.flush_synced.js | 2 + api/api/indices.forcemerge.js | 2 + api/api/indices.freeze.js | 2 + api/api/indices.get.js | 2 + api/api/indices.get_alias.js | 2 + api/api/indices.get_field_mapping.js | 2 + api/api/indices.get_mapping.js | 2 + api/api/indices.get_settings.js | 2 + api/api/indices.get_template.js | 2 + api/api/indices.get_upgrade.js | 2 + api/api/indices.open.js | 2 + api/api/indices.put_alias.js | 2 + api/api/indices.put_mapping.js | 2 + api/api/indices.put_settings.js | 2 + api/api/indices.put_template.js | 2 + api/api/indices.recovery.js | 2 + api/api/indices.refresh.js | 2 + api/api/indices.rollover.js | 2 + api/api/indices.segments.js | 2 + api/api/indices.shard_stores.js | 2 + api/api/indices.shrink.js | 2 + api/api/indices.split.js | 2 + api/api/indices.stats.js | 2 + api/api/indices.unfreeze.js | 2 + api/api/indices.update_aliases.js | 2 + api/api/indices.upgrade.js | 2 + api/api/indices.validate_query.js | 2 + api/api/info.js | 2 + api/api/ingest.delete_pipeline.js | 2 + api/api/ingest.get_pipeline.js | 2 + api/api/ingest.processor_grok.js | 2 + api/api/ingest.put_pipeline.js | 2 + api/api/ingest.simulate.js | 2 + api/api/license.delete.js | 2 + api/api/license.get.js | 2 + api/api/license.get_basic_status.js | 2 + api/api/license.get_trial_status.js | 2 + api/api/license.post.js | 2 + api/api/license.post_start_basic.js | 2 + api/api/license.post_start_trial.js | 2 + api/api/mget.js | 2 + api/api/migration.deprecations.js | 2 + api/api/ml.close_job.js | 2 + api/api/ml.delete_calendar.js | 2 + api/api/ml.delete_calendar_event.js | 2 + api/api/ml.delete_calendar_job.js | 2 + api/api/ml.delete_datafeed.js | 2 + api/api/ml.delete_expired_data.js | 2 + api/api/ml.delete_filter.js | 2 + api/api/ml.delete_forecast.js | 2 + api/api/ml.delete_job.js | 2 + api/api/ml.delete_model_snapshot.js | 2 + api/api/ml.find_file_structure.js | 2 + api/api/ml.flush_job.js | 2 + api/api/ml.forecast.js | 2 + api/api/ml.get_buckets.js | 2 + api/api/ml.get_calendar_events.js | 2 + api/api/ml.get_calendars.js | 2 + api/api/ml.get_categories.js | 2 + api/api/ml.get_datafeed_stats.js | 2 + api/api/ml.get_datafeeds.js | 2 + api/api/ml.get_filters.js | 2 + api/api/ml.get_influencers.js | 2 + api/api/ml.get_job_stats.js | 2 + api/api/ml.get_jobs.js | 2 + api/api/ml.get_model_snapshots.js | 2 + api/api/ml.get_overall_buckets.js | 2 + api/api/ml.get_records.js | 2 + api/api/ml.info.js | 2 + api/api/ml.open_job.js | 2 + api/api/ml.post_calendar_events.js | 2 + api/api/ml.post_data.js | 2 + api/api/ml.preview_datafeed.js | 2 + api/api/ml.put_calendar.js | 2 + api/api/ml.put_calendar_job.js | 2 + api/api/ml.put_datafeed.js | 2 + api/api/ml.put_filter.js | 2 + api/api/ml.put_job.js | 2 + api/api/ml.revert_model_snapshot.js | 2 + api/api/ml.set_upgrade_mode.js | 2 + api/api/ml.start_datafeed.js | 2 + api/api/ml.stop_datafeed.js | 2 + api/api/ml.update_datafeed.js | 2 + api/api/ml.update_filter.js | 2 + api/api/ml.update_job.js | 2 + api/api/ml.update_model_snapshot.js | 2 + api/api/ml.validate.js | 2 + api/api/ml.validate_detector.js | 2 + api/api/monitoring.bulk.js | 2 + api/api/msearch.js | 2 + api/api/msearch_template.js | 2 + api/api/mtermvectors.js | 2 + api/api/nodes.hot_threads.js | 2 + api/api/nodes.info.js | 2 + api/api/nodes.reload_secure_settings.js | 2 + api/api/nodes.stats.js | 2 + api/api/nodes.usage.js | 2 + api/api/ping.js | 2 + api/api/put_script.js | 2 + api/api/rank_eval.js | 2 + api/api/reindex.js | 2 + api/api/reindex_rethrottle.js | 2 + api/api/render_search_template.js | 2 + api/api/rollup.delete_job.js | 2 + api/api/rollup.get_jobs.js | 2 + api/api/rollup.get_rollup_caps.js | 2 + api/api/rollup.get_rollup_index_caps.js | 2 + api/api/rollup.put_job.js | 2 + api/api/rollup.rollup_search.js | 2 + api/api/rollup.start_job.js | 2 + api/api/rollup.stop_job.js | 2 + api/api/scripts_painless_context.js | 2 + api/api/scripts_painless_execute.js | 2 + api/api/scroll.js | 2 + api/api/search.js | 2 + api/api/search_shards.js | 2 + api/api/search_template.js | 2 + api/api/security.authenticate.js | 2 + api/api/security.change_password.js | 2 + api/api/security.clear_cached_realms.js | 2 + api/api/security.clear_cached_roles.js | 2 + api/api/security.create_api_key.js | 2 + api/api/security.delete_privileges.js | 2 + api/api/security.delete_role.js | 2 + api/api/security.delete_role_mapping.js | 2 + api/api/security.delete_user.js | 2 + api/api/security.disable_user.js | 2 + api/api/security.enable_user.js | 2 + api/api/security.get_api_key.js | 2 + api/api/security.get_privileges.js | 2 + api/api/security.get_role.js | 2 + api/api/security.get_role_mapping.js | 2 + api/api/security.get_token.js | 2 + api/api/security.get_user.js | 2 + api/api/security.get_user_privileges.js | 2 + api/api/security.has_privileges.js | 2 + api/api/security.invalidate_api_key.js | 2 + api/api/security.invalidate_token.js | 2 + api/api/security.put_privileges.js | 2 + api/api/security.put_role.js | 2 + api/api/security.put_role_mapping.js | 2 + api/api/security.put_user.js | 2 + api/api/snapshot.create.js | 2 + api/api/snapshot.create_repository.js | 2 + api/api/snapshot.delete.js | 2 + api/api/snapshot.delete_repository.js | 2 + api/api/snapshot.get.js | 2 + api/api/snapshot.get_repository.js | 2 + api/api/snapshot.restore.js | 2 + api/api/snapshot.status.js | 2 + api/api/snapshot.verify_repository.js | 2 + api/api/sql.clear_cursor.js | 2 + api/api/sql.query.js | 2 + api/api/sql.translate.js | 2 + api/api/ssl.certificates.js | 2 + api/api/tasks.cancel.js | 2 + api/api/tasks.get.js | 2 + api/api/tasks.list.js | 2 + api/api/termvectors.js | 2 + api/api/update.js | 2 + api/api/update_by_query.js | 2 + api/api/update_by_query_rethrottle.js | 2 + api/api/watcher.ack_watch.js | 2 + api/api/watcher.activate_watch.js | 2 + api/api/watcher.deactivate_watch.js | 2 + api/api/watcher.delete_watch.js | 2 + api/api/watcher.execute_watch.js | 2 + api/api/watcher.get_watch.js | 2 + api/api/watcher.put_watch.js | 2 + api/api/watcher.start.js | 2 + api/api/watcher.stats.js | 2 + api/api/watcher.stop.js | 2 + api/api/xpack.info.js | 2 + api/api/xpack.usage.js | 2 + docs/configuration.asciidoc | 19 +- docs/index.asciidoc | 1 + docs/observability.asciidoc | 250 +++++++++++++ docs/usage.asciidoc | 108 +----- index.d.ts | 3 + index.js | 9 +- lib/ConnectionPool.d.ts | 14 +- lib/ConnectionPool.js | 22 +- lib/Transport.d.ts | 28 +- lib/Transport.js | 43 ++- scripts/utils/generateApis.js | 2 + test/behavior/observability.test.js | 334 ++++++++++++++++++ test/behavior/resurrect.test.js | 13 +- test/unit/child.test.js | 69 ++++ test/unit/connection-pool.test.js | 28 +- test/unit/events.test.js | 15 +- test/unit/transport.test.js | 36 +- test/utils/MockConnection.js | 48 ++- 279 files changed, 1428 insertions(+), 142 deletions(-) create mode 100644 docs/observability.asciidoc create mode 100644 test/behavior/observability.test.js diff --git a/README.md b/README.md index 78b153f96..5d707fb60 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,10 @@ The client is designed to be easily configured as you see fit for your needs, fo nodeFilter: nodeFilterFn; // custom selection strategy, defaults `round-robin` nodeSelector: nodeSelectorFn | string; + // function to generate the request id for every request + generateRequestId: generateRequestIdFn; + // name to identify the client instance in the events + name: string; } ``` @@ -143,7 +147,9 @@ The supported *request specific options* are: asStream: boolean, // default `false` compression: string, // default `false` headers: object, // default `null` - querystring: object // default `null` + querystring: object // default `null`, + context: object // default `null`, + id: any // default incr. integer } ``` diff --git a/api/api/bulk.js b/api/api/bulk.js index 5322898dc..15b660683 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -136,6 +136,8 @@ function buildBulk (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index e5738e038..2b7ef3bc3 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -120,6 +120,8 @@ function buildCatAliases (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index 561c02ddb..f7118efea 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -122,6 +122,8 @@ function buildCatAllocation (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.count.js b/api/api/cat.count.js index 2be151d71..cdb1c2ccd 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -120,6 +120,8 @@ function buildCatCount (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index 1685acd80..d1e22cf0a 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -124,6 +124,8 @@ function buildCatFielddata (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.health.js b/api/api/cat.health.js index 6badc3a80..827ebd276 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -117,6 +117,8 @@ function buildCatHealth (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.help.js b/api/api/cat.help.js index d776803de..2f744f49d 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -104,6 +104,8 @@ function buildCatHelp (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index f3469eb26..d731c372a 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -129,6 +129,8 @@ function buildCatIndices (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.master.js b/api/api/cat.master.js index 08528e146..6ea1ef531 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -115,6 +115,8 @@ function buildCatMaster (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index 65a36356a..66995d45c 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -115,6 +115,8 @@ function buildCatNodeattrs (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index d539438c5..21f27a517 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -118,6 +118,8 @@ function buildCatNodes (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index b13a3d306..920a77e47 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -115,6 +115,8 @@ function buildCatPendingTasks (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index 1f3b6cdf3..e254ddb3b 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -115,6 +115,8 @@ function buildCatPlugins (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index 7e631fab3..27938674a 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -120,6 +120,8 @@ function buildCatRecovery (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index 9e229bfd8..d4801efc9 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -115,6 +115,8 @@ function buildCatRepositories (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index adc48ee61..9e2415c34 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -117,6 +117,8 @@ function buildCatSegments (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index 4de59a7c9..15031236f 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -122,6 +122,8 @@ function buildCatShards (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index 4db252fe9..94ead6ac4 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -121,6 +121,8 @@ function buildCatSnapshots (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index b00e20496..e478ccc7e 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -120,6 +120,8 @@ function buildCatTasks (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index 2f0b6beca..432e1d28d 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -120,6 +120,8 @@ function buildCatTemplates (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index fddeb9256..49d7078f8 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -122,6 +122,8 @@ function buildCatThreadPool (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index af0f01987..f5241c473 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -96,6 +96,8 @@ function buildCcrDeleteAutoFollowPattern (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index ab8d8e255..9ee3158c6 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -102,6 +102,8 @@ function buildCcrFollow (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js index 209521757..1e8040461 100644 --- a/api/api/ccr.follow_info.js +++ b/api/api/ccr.follow_info.js @@ -90,6 +90,8 @@ function buildCcrFollowInfo (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 5d455b480..52373f123 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -96,6 +96,8 @@ function buildCcrFollowStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index 1e2504cee..db17668a5 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -101,6 +101,8 @@ function buildCcrForgetFollower (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 83b3cbfc8..577e229ac 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -94,6 +94,8 @@ function buildCcrGetAutoFollowPattern (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 2862163f1..462e30be4 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -96,6 +96,8 @@ function buildCcrPauseFollow (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index 6338da352..0f2691714 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -101,6 +101,8 @@ function buildCcrPutAutoFollowPattern (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index 3c857a84a..36c666531 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -97,6 +97,8 @@ function buildCcrResumeFollow (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index 81f544210..3f1d9bc39 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -89,6 +89,8 @@ function buildCcrStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index 2163e6ad7..43c1ba4b1 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -96,6 +96,8 @@ function buildCcrUnfollow (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 552ac23cc..8f17c4dc3 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -100,6 +100,8 @@ function buildClearScroll (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index 3ce754e73..4e7155e30 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -101,6 +101,8 @@ function buildClusterAllocationExplain (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index 8e215e750..f9722e0b9 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -111,6 +111,8 @@ function buildClusterGetSettings (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 0127efecb..9c764b9fe 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -135,6 +135,8 @@ function buildClusterHealth (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index cc132b7a7..32802c975 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -105,6 +105,8 @@ function buildClusterPendingTasks (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index 9064e1670..230714ce7 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -109,6 +109,8 @@ function buildClusterPutSettings (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 22a2ca142..62122e6ac 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -100,6 +100,8 @@ function buildClusterRemoteInfo (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index 5a29ea54d..9173b8b36 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -110,6 +110,8 @@ function buildClusterReroute (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index 7d6b7c303..002097761 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -137,6 +137,8 @@ function buildClusterState (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index 77f634146..b57e67c56 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -110,6 +110,8 @@ function buildClusterStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/count.js b/api/api/count.js index ae6816fba..ac504f2e5 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -145,6 +145,8 @@ function buildCount (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/create.js b/api/api/create.js index 0ee306e57..3e14db497 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -134,6 +134,8 @@ function buildCreate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 6d4656451..469f2c6d9 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -100,6 +100,8 @@ function buildDataFrameDeleteDataFrameTransform (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index a54947560..7c58b2a92 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -103,6 +103,8 @@ function buildDataFrameGetDataFrameTransform (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 730085eeb..40264ccd5 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -99,6 +99,8 @@ function buildDataFrameGetDataFrameTransformStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index 761c8ad2f..85bd668a0 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -96,6 +96,8 @@ function buildDataFramePreviewDataFrameTransform (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index a7e29105b..9514f7895 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -101,6 +101,8 @@ function buildDataFramePutDataFrameTransform (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index b75264fda..6f2218cca 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -101,6 +101,8 @@ function buildDataFrameStartDataFrameTransform (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index 2ae878753..be3919984 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -104,6 +104,8 @@ function buildDataFrameStopDataFrameTransform (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/delete.js b/api/api/delete.js index 6f835dcc8..727747be5 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -137,6 +137,8 @@ function buildDelete (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 7e3aae9ea..2b95a02e6 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -196,6 +196,8 @@ function buildDeleteByQuery (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index bbeb5094a..8cc90e6ab 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -112,6 +112,8 @@ function buildDeleteByQueryRethrottle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/delete_script.js b/api/api/delete_script.js index 6165361bf..9ab6c4460 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -110,6 +110,8 @@ function buildDeleteScript (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/exists.js b/api/api/exists.js index ac6e5db8a..0bc2eead2 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -141,6 +141,8 @@ function buildExists (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/exists_source.js b/api/api/exists_source.js index d8111530e..7309e7a9d 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -147,6 +147,8 @@ function buildExistsSource (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/explain.js b/api/api/explain.js index f59f7a11c..26482fa00 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -143,6 +143,8 @@ function buildExplain (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/field_caps.js b/api/api/field_caps.js index 46ba81f07..1771404cd 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -119,6 +119,8 @@ function buildFieldCaps (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/get.js b/api/api/get.js index b9a5c192e..923732178 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -141,6 +141,8 @@ function buildGet (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/get_script.js b/api/api/get_script.js index b6659841f..aae577d34 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -108,6 +108,8 @@ function buildGetScript (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/get_source.js b/api/api/get_source.js index bcac14deb..88bab3b77 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -138,6 +138,8 @@ function buildGetSource (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 19e601a64..44da987fb 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -105,6 +105,8 @@ function buildGraphExplore (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index 7e09289af..57ced77cc 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -96,6 +96,8 @@ function buildIlmDeleteLifecycle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index e5638c16d..62362c7ec 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -96,6 +96,8 @@ function buildIlmExplainLifecycle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index a01952fa5..1145c399a 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -100,6 +100,8 @@ function buildIlmGetLifecycle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index 30c135900..f27b964e3 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -95,6 +95,8 @@ function buildIlmGetStatus (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index 49f82a8c5..c450a083a 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -91,6 +91,8 @@ function buildIlmMoveToStep (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index 28955b0fe..b8d58d5f3 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -91,6 +91,8 @@ function buildIlmPutLifecycle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index ccfbc8c81..ca37399d2 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -96,6 +96,8 @@ function buildIlmRemovePolicy (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 5ea000327..1fbcdd1da 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -96,6 +96,8 @@ function buildIlmRetry (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index f2461f3ef..8c907d91d 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -95,6 +95,8 @@ function buildIlmStart (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index ad1607579..b056fa599 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -95,6 +95,8 @@ function buildIlmStop (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/index.js b/api/api/index.js index 07e1a09c3..508e1f6cf 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -143,6 +143,8 @@ function buildIndex (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index 4d819f7c0..a9d6e886f 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -102,6 +102,8 @@ function buildIndicesAnalyze (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index fa2739c6b..629b97f2b 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -124,6 +124,8 @@ function buildIndicesClearCache (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.close.js b/api/api/indices.close.js index a19790e32..cdfefec47 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -122,6 +122,8 @@ function buildIndicesClose (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.create.js b/api/api/indices.create.js index 355a7a370..61933d059 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -113,6 +113,8 @@ function buildIndicesCreate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index bb46902fd..ced4e48e2 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -119,6 +119,8 @@ function buildIndicesDelete (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index db5091854..f7f37523d 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -125,6 +125,8 @@ function buildIndicesDeleteAlias (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index 623ba6933..4f969efe0 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -110,6 +110,8 @@ function buildIndicesDeleteTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index 85cc737a4..629725623 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -122,6 +122,8 @@ function buildIndicesExists (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index d25ddb733..7531e6fb0 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -121,6 +121,8 @@ function buildIndicesExistsAlias (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index ea3fb9d35..83273b91d 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -113,6 +113,8 @@ function buildIndicesExistsTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index 4c2573419..585c2d325 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -127,6 +127,8 @@ function buildIndicesExistsType (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index 1099650fa..94d64e23e 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -119,6 +119,8 @@ function buildIndicesFlush (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index df404cee0..f4c69b758 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -114,6 +114,8 @@ function buildIndicesFlushSynced (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index 5bf900cc6..b5249ecfc 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -122,6 +122,8 @@ function buildIndicesForcemerge (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index 944a9b00a..0400b00d5 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -115,6 +115,8 @@ function buildIndicesFreeze (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get.js b/api/api/indices.get.js index 6a4047c83..3e909ecc4 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -128,6 +128,8 @@ function buildIndicesGet (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index fc2f508ef..d016d5741 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -121,6 +121,8 @@ function buildIndicesGetAlias (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 78dcfcc0c..70a9efaa0 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -132,6 +132,8 @@ function buildIndicesGetFieldMapping (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index 5534a5cec..c7eb7160c 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -127,6 +127,8 @@ function buildIndicesGetMapping (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index 5af0ba622..79d82cbee 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -130,6 +130,8 @@ function buildIndicesGetSettings (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index 315c9d9ad..68d6a6b51 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -116,6 +116,8 @@ function buildIndicesGetTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index c5acf2611..06781bda7 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -114,6 +114,8 @@ function buildIndicesGetUpgrade (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.open.js b/api/api/indices.open.js index ba585f805..742cb028d 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -122,6 +122,8 @@ function buildIndicesOpen (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index 68710d615..c6d2df4a3 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -122,6 +122,8 @@ function buildIndicesPutAlias (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 20dee2bf8..b477739c0 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -136,6 +136,8 @@ function buildIndicesPutMapping (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index c12a1a47d..ba394a719 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -126,6 +126,8 @@ function buildIndicesPutSettings (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index 2ccc9a5a6..931a2ab85 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -121,6 +121,8 @@ function buildIndicesPutTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index 226637439..7362561b7 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -110,6 +110,8 @@ function buildIndicesRecovery (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index e246af298..1a263c834 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -114,6 +114,8 @@ function buildIndicesRefresh (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index 73ad046be..8b7fecb73 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -127,6 +127,8 @@ function buildIndicesRollover (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index d571c8c65..a9feb67f5 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -116,6 +116,8 @@ function buildIndicesSegments (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index f835b5975..35d5924b8 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -116,6 +116,8 @@ function buildIndicesShardStores (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index 9316b53a8..c746add6b 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -121,6 +121,8 @@ function buildIndicesShrink (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.split.js b/api/api/indices.split.js index 1dad6769d..50f2501a0 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -121,6 +121,8 @@ function buildIndicesSplit (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index d630947f9..bc0524bc8 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -136,6 +136,8 @@ function buildIndicesStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index cac430b25..81a55968f 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -115,6 +115,8 @@ function buildIndicesUnfreeze (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index 869bd1e42..5c83d0798 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -106,6 +106,8 @@ function buildIndicesUpdateAliases (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index a2b5e25b6..bae33c59a 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -120,6 +120,8 @@ function buildIndicesUpgrade (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index fca278548..3dea50479 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -139,6 +139,8 @@ function buildIndicesValidateQuery (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/info.js b/api/api/info.js index 681d465a4..0d5eb79e1 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -100,6 +100,8 @@ function buildInfo (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index b4b8f63d7..68a8479c4 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -110,6 +110,8 @@ function buildIngestDeletePipeline (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index 90a82a3e8..29a01d7ab 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -108,6 +108,8 @@ function buildIngestGetPipeline (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index 0d05d1c07..679fbadbc 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -100,6 +100,8 @@ function buildIngestProcessorGrok (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index 7a1296345..6e2940b7b 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -111,6 +111,8 @@ function buildIngestPutPipeline (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index 9a7b790fe..c8f83721e 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -108,6 +108,8 @@ function buildIngestSimulate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.delete.js b/api/api/license.delete.js index 9b77a9c21..fdf2efbc6 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -95,6 +95,8 @@ function buildLicenseDelete (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.get.js b/api/api/license.get.js index 454a8a8c4..57266aa82 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -96,6 +96,8 @@ function buildLicenseGet (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index c25cf35d5..cccf3ffef 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -95,6 +95,8 @@ function buildLicenseGetBasicStatus (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index a3c1dda69..dcc9091cc 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -95,6 +95,8 @@ function buildLicenseGetTrialStatus (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.post.js b/api/api/license.post.js index c194aa073..b29cb4d32 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -91,6 +91,8 @@ function buildLicensePost (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index d71ab0195..272e61fc4 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -96,6 +96,8 @@ function buildLicensePostStartBasic (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index 339d58dd5..79207341f 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -98,6 +98,8 @@ function buildLicensePostStartTrial (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/mget.js b/api/api/mget.js index f01283b20..14b29eaf4 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -134,6 +134,8 @@ function buildMget (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index d9e7b55bc..727d3a5ba 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -100,6 +100,8 @@ function buildMigrationDeprecations (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.close_job.js b/api/api/ml.close_job.js index c5b2fb379..ec61d7008 100644 --- a/api/api/ml.close_job.js +++ b/api/api/ml.close_job.js @@ -103,6 +103,8 @@ function buildMlCloseJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js index 4d2cd5920..dc94d6b92 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/ml.delete_calendar.js @@ -100,6 +100,8 @@ function buildMlDeleteCalendar (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js index 4470e735f..4846c13fe 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/ml.delete_calendar_event.js @@ -111,6 +111,8 @@ function buildMlDeleteCalendarEvent (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js index 3bf8d33b8..27ebb4341 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/ml.delete_calendar_job.js @@ -111,6 +111,8 @@ function buildMlDeleteCalendarJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js index 1cee977d0..5350874cb 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/ml.delete_datafeed.js @@ -101,6 +101,8 @@ function buildMlDeleteDatafeed (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js index cf21a2e86..d28a54756 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/ml.delete_expired_data.js @@ -95,6 +95,8 @@ function buildMlDeleteExpiredData (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js index cdf204830..e14c6004a 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/ml.delete_filter.js @@ -100,6 +100,8 @@ function buildMlDeleteFilter (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js index bb112a9ce..61578af3c 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/ml.delete_forecast.js @@ -115,6 +115,8 @@ function buildMlDeleteForecast (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js index 7a63de2b5..2dab49868 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/ml.delete_job.js @@ -103,6 +103,8 @@ function buildMlDeleteJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js index 62a071ec1..ee7e86377 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/ml.delete_model_snapshot.js @@ -111,6 +111,8 @@ function buildMlDeleteModelSnapshot (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index f48a83c03..1e6de545e 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -128,6 +128,8 @@ function buildMlFindFileStructure (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js index a2e1dae52..f2b062ee2 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/ml.flush_job.js @@ -108,6 +108,8 @@ function buildMlFlushJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js index b623627fb..065d17c6c 100644 --- a/api/api/ml.forecast.js +++ b/api/api/ml.forecast.js @@ -103,6 +103,8 @@ function buildMlForecast (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js index 80873c653..f00ae7a47 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/ml.get_buckets.js @@ -127,6 +127,8 @@ function buildMlGetBuckets (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js index c7aa2d77a..85540eb2a 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/ml.get_calendar_events.js @@ -110,6 +110,8 @@ function buildMlGetCalendarEvents (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 2792f7e50..71d9b2771 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -98,6 +98,8 @@ function buildMlGetCalendars (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js index 4ab14462f..8ee43bac5 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/ml.get_categories.js @@ -105,6 +105,8 @@ function buildMlGetCategories (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js index e1e61aa33..d7dd811aa 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/ml.get_datafeed_stats.js @@ -101,6 +101,8 @@ function buildMlGetDatafeedStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js index 4f7fb7d66..6135237cb 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/ml.get_datafeeds.js @@ -101,6 +101,8 @@ function buildMlGetDatafeeds (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js index f3f4a74e9..3c83a37f8 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/ml.get_filters.js @@ -103,6 +103,8 @@ function buildMlGetFilters (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js index 591d40e85..6ce303a12 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/ml.get_influencers.js @@ -114,6 +114,8 @@ function buildMlGetInfluencers (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js index c0855dc08..8b5a68e27 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/ml.get_job_stats.js @@ -101,6 +101,8 @@ function buildMlGetJobStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js index 17d83fec9..688334416 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/ml.get_jobs.js @@ -101,6 +101,8 @@ function buildMlGetJobs (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js index 466c6829d..7bfa74eb3 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/ml.get_model_snapshots.js @@ -119,6 +119,8 @@ function buildMlGetModelSnapshots (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js index ba1c7c9ac..e6ee6338c 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/ml.get_overall_buckets.js @@ -114,6 +114,8 @@ function buildMlGetOverallBuckets (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js index 3a3e5335f..5bcfbe7b0 100644 --- a/api/api/ml.get_records.js +++ b/api/api/ml.get_records.js @@ -114,6 +114,8 @@ function buildMlGetRecords (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.info.js b/api/api/ml.info.js index 3e0b95328..b53019e0e 100644 --- a/api/api/ml.info.js +++ b/api/api/ml.info.js @@ -89,6 +89,8 @@ function buildMlInfo (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js index 72b4ab402..ec9a3268f 100644 --- a/api/api/ml.open_job.js +++ b/api/api/ml.open_job.js @@ -102,6 +102,8 @@ function buildMlOpenJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js index 8ad6e683d..e671d27f9 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/ml.post_calendar_events.js @@ -101,6 +101,8 @@ function buildMlPostCalendarEvents (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js index 4661fc231..5f500c989 100644 --- a/api/api/ml.post_data.js +++ b/api/api/ml.post_data.js @@ -105,6 +105,8 @@ function buildMlPostData (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js index 0f78bc7dd..4a09368a1 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/ml.preview_datafeed.js @@ -100,6 +100,8 @@ function buildMlPreviewDatafeed (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js index bcd5d40ac..5f469ac85 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/ml.put_calendar.js @@ -97,6 +97,8 @@ function buildMlPutCalendar (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js index 3f160c47d..4af04e926 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/ml.put_calendar_job.js @@ -111,6 +111,8 @@ function buildMlPutCalendarJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js index 2de0baa75..d7da534fe 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/ml.put_datafeed.js @@ -101,6 +101,8 @@ function buildMlPutDatafeed (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js index 057f71e1e..6f423c071 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/ml.put_filter.js @@ -101,6 +101,8 @@ function buildMlPutFilter (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js index 0aa4a256e..fa78d3239 100644 --- a/api/api/ml.put_job.js +++ b/api/api/ml.put_job.js @@ -101,6 +101,8 @@ function buildMlPutJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js index 41ff3c13b..162a2682c 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/ml.revert_model_snapshot.js @@ -109,6 +109,8 @@ function buildMlRevertModelSnapshot (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js index 57a4df4d1..d095c71f0 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/ml.set_upgrade_mode.js @@ -98,6 +98,8 @@ function buildMlSetUpgradeMode (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js index 1c11f9f31..9ae986cf7 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/ml.start_datafeed.js @@ -102,6 +102,8 @@ function buildMlStartDatafeed (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js index f845de47a..8e684ae2c 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/ml.stop_datafeed.js @@ -102,6 +102,8 @@ function buildMlStopDatafeed (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js index 486a2b881..7e5447521 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/ml.update_datafeed.js @@ -101,6 +101,8 @@ function buildMlUpdateDatafeed (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js index 0b203684d..f8de4abc7 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/ml.update_filter.js @@ -101,6 +101,8 @@ function buildMlUpdateFilter (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js index 2e9617666..c34144cd3 100644 --- a/api/api/ml.update_job.js +++ b/api/api/ml.update_job.js @@ -101,6 +101,8 @@ function buildMlUpdateJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js index 7e80fa05b..e0dc3043f 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/ml.update_model_snapshot.js @@ -112,6 +112,8 @@ function buildMlUpdateModelSnapshot (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js index 61b6da7c7..256da469a 100644 --- a/api/api/ml.validate.js +++ b/api/api/ml.validate.js @@ -96,6 +96,8 @@ function buildMlValidate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js index 8b00f4597..4540ff1d5 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/ml.validate_detector.js @@ -96,6 +96,8 @@ function buildMlValidateDetector (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 66054b3e4..96a7caba3 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -108,6 +108,8 @@ function buildMonitoringBulk (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/msearch.js b/api/api/msearch.js index a4615c4fb..1bf456a67 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -136,6 +136,8 @@ function buildMsearch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 1692f567f..7d877463d 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -130,6 +130,8 @@ function buildMsearchTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index fe4c49a6e..a46362de3 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -138,6 +138,8 @@ function buildMtermvectors (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 08512b148..330bc47ba 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -124,6 +124,8 @@ function buildNodesHotThreads (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index 4179dd155..4e27f08ff 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -115,6 +115,8 @@ function buildNodesInfo (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index 53f6a6a1a..7753eb77e 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -107,6 +107,8 @@ function buildNodesReloadSecureSettings (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index 4553511fd..04425a8fb 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -134,6 +134,8 @@ function buildNodesStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index 308a6645b..1d62545be 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -112,6 +112,8 @@ function buildNodesUsage (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ping.js b/api/api/ping.js index 71192c360..71a0dc79e 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -100,6 +100,8 @@ function buildPing (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/put_script.js b/api/api/put_script.js index bad10957b..9ffd1db70 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -124,6 +124,8 @@ function buildPutScript (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index a32132466..df81a0385 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -115,6 +115,8 @@ function buildRankEval (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/reindex.js b/api/api/reindex.js index 44949d112..c1286f6af 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -118,6 +118,8 @@ function buildReindex (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 605a2ea83..2a24b921b 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -112,6 +112,8 @@ function buildReindexRethrottle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 59bcab0b1..0564ba781 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -100,6 +100,8 @@ function buildRenderSearchTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index 353c35094..b0a06fdb5 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -96,6 +96,8 @@ function buildRollupDeleteJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index e88e8a8ef..cb1da9051 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -94,6 +94,8 @@ function buildRollupGetJobs (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index aec85ccfa..3d24fbbaf 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -94,6 +94,8 @@ function buildRollupGetRollupCaps (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index 1cf85f7c3..54f161dc9 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -96,6 +96,8 @@ function buildRollupGetRollupIndexCaps (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index 5db700e80..cc8701e7f 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -101,6 +101,8 @@ function buildRollupPutJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 78094e181..4329cd2d9 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -116,6 +116,8 @@ function buildRollupRollupSearch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index 48abec711..ced1af7fa 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -96,6 +96,8 @@ function buildRollupStartJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index 1aa07fa2d..856bdfe09 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -100,6 +100,8 @@ function buildRollupStopJob (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js index 65e4fdac8..0ef7d852a 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/scripts_painless_context.js @@ -96,6 +96,8 @@ function buildScriptsPainlessContext (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index 3a2785063..231a3e461 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -95,6 +95,8 @@ function buildScriptsPainlessExecute (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/scroll.js b/api/api/scroll.js index 0bfd11aff..565b0925b 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -108,6 +108,8 @@ function buildScroll (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/search.js b/api/api/search.js index c7c08cd8d..a4c73501e 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -220,6 +220,8 @@ function buildSearch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/search_shards.js b/api/api/search_shards.js index 43eed2ed8..bae036cef 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -120,6 +120,8 @@ function buildSearchShards (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/search_template.js b/api/api/search_template.js index aadc63aaf..3a81eeba3 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -149,6 +149,8 @@ function buildSearchTemplate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js index 747b7718c..0a144693a 100644 --- a/api/api/security.authenticate.js +++ b/api/api/security.authenticate.js @@ -95,6 +95,8 @@ function buildSecurityAuthenticate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js index b0a9ed5d0..3a78e5825 100644 --- a/api/api/security.change_password.js +++ b/api/api/security.change_password.js @@ -102,6 +102,8 @@ function buildSecurityChangePassword (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js index 8cd3bf99b..aab70cec5 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/security.clear_cached_realms.js @@ -101,6 +101,8 @@ function buildSecurityClearCachedRealms (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js index 41de57377..c23b1c66e 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/security.clear_cached_roles.js @@ -100,6 +100,8 @@ function buildSecurityClearCachedRoles (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js index bb5e69379..a2e0cd315 100644 --- a/api/api/security.create_api_key.js +++ b/api/api/security.create_api_key.js @@ -97,6 +97,8 @@ function buildSecurityCreateApiKey (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.delete_privileges.js b/api/api/security.delete_privileges.js index 9cfd26d1c..e64714740 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/security.delete_privileges.js @@ -112,6 +112,8 @@ function buildSecurityDeletePrivileges (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js index 6fb2d0496..96ea78039 100644 --- a/api/api/security.delete_role.js +++ b/api/api/security.delete_role.js @@ -101,6 +101,8 @@ function buildSecurityDeleteRole (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js index 700d76f4f..208c950fa 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/security.delete_role_mapping.js @@ -101,6 +101,8 @@ function buildSecurityDeleteRoleMapping (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js index 7fb437fe2..3e176ea8d 100644 --- a/api/api/security.delete_user.js +++ b/api/api/security.delete_user.js @@ -101,6 +101,8 @@ function buildSecurityDeleteUser (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index a15e13b2a..3c7d3c000 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -101,6 +101,8 @@ function buildSecurityDisableUser (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index f13274d71..2b044b3a5 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -101,6 +101,8 @@ function buildSecurityEnableUser (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js index 9a82ec39e..eb8af6ea9 100644 --- a/api/api/security.get_api_key.js +++ b/api/api/security.get_api_key.js @@ -102,6 +102,8 @@ function buildSecurityGetApiKey (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index ef4045ff1..f7e697124 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -109,6 +109,8 @@ function buildSecurityGetPrivileges (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js index d2b433f1d..ca9e9a542 100644 --- a/api/api/security.get_role.js +++ b/api/api/security.get_role.js @@ -100,6 +100,8 @@ function buildSecurityGetRole (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js index 1c3e2287c..77c43e053 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/security.get_role_mapping.js @@ -100,6 +100,8 @@ function buildSecurityGetRoleMapping (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js index 6e3245b62..b397e77cd 100644 --- a/api/api/security.get_token.js +++ b/api/api/security.get_token.js @@ -96,6 +96,8 @@ function buildSecurityGetToken (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js index abedf7cc5..d8bb47568 100644 --- a/api/api/security.get_user.js +++ b/api/api/security.get_user.js @@ -100,6 +100,8 @@ function buildSecurityGetUser (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index cf2449bd5..fdf7e5168 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -95,6 +95,8 @@ function buildSecurityGetUserPrivileges (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js index ba46e6fde..22c4c6cf1 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/security.has_privileges.js @@ -101,6 +101,8 @@ function buildSecurityHasPrivileges (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js index f32685f97..983ef2ac8 100644 --- a/api/api/security.invalidate_api_key.js +++ b/api/api/security.invalidate_api_key.js @@ -96,6 +96,8 @@ function buildSecurityInvalidateApiKey (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.invalidate_token.js b/api/api/security.invalidate_token.js index 0e891bf38..98e6eb702 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/security.invalidate_token.js @@ -96,6 +96,8 @@ function buildSecurityInvalidateToken (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js index c20c25a91..4de0d967f 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/security.put_privileges.js @@ -97,6 +97,8 @@ function buildSecurityPutPrivileges (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js index 3becd8b55..388ff9709 100644 --- a/api/api/security.put_role.js +++ b/api/api/security.put_role.js @@ -102,6 +102,8 @@ function buildSecurityPutRole (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index 612bdb873..8b3847096 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -102,6 +102,8 @@ function buildSecurityPutRoleMapping (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js index 73e1e6722..9703b86fd 100644 --- a/api/api/security.put_user.js +++ b/api/api/security.put_user.js @@ -102,6 +102,8 @@ function buildSecurityPutUser (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index e1aa00e93..a54cc4b8e 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -119,6 +119,8 @@ function buildSnapshotCreate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index ff1c1f80c..7d06c4135 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -113,6 +113,8 @@ function buildSnapshotCreateRepository (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index 22f309ae7..86e090012 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -119,6 +119,8 @@ function buildSnapshotDelete (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index 0316765cd..48aa929e1 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -110,6 +110,8 @@ function buildSnapshotDeleteRepository (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index f3b4243f6..621f7417c 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -124,6 +124,8 @@ function buildSnapshotGet (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index f825b04a0..ae7d9fcdc 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -110,6 +110,8 @@ function buildSnapshotGetRepository (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 7df0ac952..217bb7fef 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -119,6 +119,8 @@ function buildSnapshotRestore (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index d0820b6c6..bf15fa342 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -120,6 +120,8 @@ function buildSnapshotStatus (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index ea23febc8..0bb67a727 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -110,6 +110,8 @@ function buildSnapshotVerifyRepository (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index 0dac8e9b5..fccf6ba8d 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -96,6 +96,8 @@ function buildSqlClearCursor (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 0eb23acc2..2bcd7f6e7 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -97,6 +97,8 @@ function buildSqlQuery (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index be1325763..6b5147bb4 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -96,6 +96,8 @@ function buildSqlTranslate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/ssl.certificates.js b/api/api/ssl.certificates.js index 28f8fc9f7..8bf875df8 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/ssl.certificates.js @@ -95,6 +95,8 @@ function buildSslCertificates (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 3d3dd5d3e..6e674b2b2 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -112,6 +112,8 @@ function buildTasksCancel (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index 426fe46af..c3435158f 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -110,6 +110,8 @@ function buildTasksGet (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index 57f170927..9d74e774d 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -117,6 +117,8 @@ function buildTasksList (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 2571b64fd..d2942bc23 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -139,6 +139,8 @@ function buildTermvectors (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/update.js b/api/api/update.js index 3a4f6120d..6584905ca 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -146,6 +146,8 @@ function buildUpdate (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index ab41dcf72..ac34e44db 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -197,6 +197,8 @@ function buildUpdateByQuery (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index 2937a00d1..050feed99 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -112,6 +112,8 @@ function buildUpdateByQueryRethrottle (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index d7158969f..cc385c644 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -111,6 +111,8 @@ function buildWatcherAckWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index 8012179d2..6823f734b 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -100,6 +100,8 @@ function buildWatcherActivateWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index cd7cfa9bf..5d089ca4b 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -100,6 +100,8 @@ function buildWatcherDeactivateWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index c126fea0c..21d41e1c9 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -100,6 +100,8 @@ function buildWatcherDeleteWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 633797a5d..8b5cf89d2 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -96,6 +96,8 @@ function buildWatcherExecuteWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index 807ec2643..587089f94 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -100,6 +100,8 @@ function buildWatcherGetWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index 4f6d1d701..695f6eb19 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -105,6 +105,8 @@ function buildWatcherPutWatch (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 5cd32357c..1053693f5 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -95,6 +95,8 @@ function buildWatcherStart (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index efdae5e0d..ffa6b9bd9 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -103,6 +103,8 @@ function buildWatcherStats (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index 18cb40f9e..d7873de19 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -95,6 +95,8 @@ function buildWatcherStop (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index 13cefe3b2..22d1f9f18 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -96,6 +96,8 @@ function buildXpackInfo (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index 50cd02732..1885f4d93 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -96,6 +96,8 @@ function buildXpackUsage (opts) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 45f186fd4..3d52ad5a5 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -133,6 +133,23 @@ function nodeSelector (connections) { return connections[index] } ---- + +|`generateRequestId` +a|`function` - function to generate the request id for every request, it takes two parameters, the request parameters and options. + +By default it generates an incremental integer for every request. + +_Custom function example:_ +[source,js] +---- +function generateRequestId (params, options) { + // your id generation logic + // must be syncronous + return 'id' +} +---- + +|`name` +|`string` - The name to identify the client instance in the events. + +_Default:_ `elasticsearch-js` |=== === Advanced configuration @@ -229,4 +246,4 @@ class MySerializer extends Serializer { const client = new Client({ Serializer: MySerializer }) ----- \ No newline at end of file +---- diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 8569a45b3..c0527c567 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -9,6 +9,7 @@ include::configuration.asciidoc[] include::reference.asciidoc[] include::breaking-changes.asciidoc[] include::authentication.asciidoc[] +include::observability.asciidoc[] include::child.asciidoc[] include::extend.asciidoc[] include::typescript.asciidoc[] diff --git a/docs/observability.asciidoc b/docs/observability.asciidoc new file mode 100644 index 000000000..c72c340e1 --- /dev/null +++ b/docs/observability.asciidoc @@ -0,0 +1,250 @@ +[[observability]] +== Observability + +The client does not provide a default logger, but instead it offers an event emitter interfaces to hook into internal events, such as `request` and `response`. + +Correlating those events can be quite hard, especially if your applications have a large codebase with many events happening at the same time. + +To help you with this, the client offers you a correlation id system and other features, let's see them in action. + +=== Events +The client is an event emitter, this means that you can listen for its event and add additional logic to your code, without need to change the client internals or your normal usage. + +You can find the events names by access the `events` key of the client. + +[source,js] +---- +const { events } = require('@elastic/elasticsearch') +console.log(events) +---- + +The event emitter functionality can be useful if you want to log every request, response and error that is happening during the use of the client. + +[source,js] +---- +const logger = require('my-logger')() +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) + +client.on('response', (err, result) => { + if (err) { + logger.error(err) + } else { + logger.info(result) + } +}) +---- + +The client emits the following events: +[cols=2*] +|=== +|`request` +a|Emitted before sending the actual request to Elasticsearch _(emitted multiple times in case of retries)_. +[source,js] +---- +client.on('request', (err, result) => { + console.log(err, result) +}) +---- + +|`response` +a|Emitted once Elasticsearch response has been received and parsed. +[source,js] +---- +client.on('response', (err, result) => { + console.log(err, result) +}) +---- + +|`sniff` +a|Emitted when the client ends a sniffing request. +[source,js] +---- +client.on('sniff', (err, result) => { + console.log(err, result) +}) +---- + +|`resurrect` +a|Emitted if the client is able to resurrect a dead node. +[source,js] +---- +client.on('resurrect', (err, result) => { + console.log(err, result) +}) +---- + +|=== + +The values of `result` in `request`, `response` and `sniff` will be: +[source,ts] +---- +body: any; +statusCode: number | null; +headers: anyObject | null; +warnings: string[] | null; +meta: { + context: any; + name: string; + request: { + params: TransportRequestParams; + options: TransportRequestOptions; + id: any; + }; + connection: Connection; + attempts: number; + aborted: boolean; + sniff?: { + hosts: any[]; + reason: string; + }; +}; +---- + +While the `result` value in `resurrect` will be: +[source,ts] +---- +strategy: string; +isAlive: boolean; +connection: Connection; +name: string; +request: { + id: any; +}; +---- + +=== Correlation id +Correlating events can be quite hard, especially if there are many events at the same time. The client offers you an automatic (and configurable) system to help you handle this problem. +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) + +client.on('request', (err, result) => { + const { id } = result.meta.request + if (err) { + console.log({ error: err, reqId: id }) + } +}) + +client.on('response', (err, result) => { + const { id } = result.meta.request + if (err) { + console.log({ error: err, reqId: id }) + } +}) + +client.search({ + index: 'my-index', + body: { foo: 'bar' } +}, (err, result) => { + if (err) console.log(err) +}) +---- + +By default the id is an incremental integer, but you can easily configure that with the `generateRequestId` option: +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ + node: 'http://localhost:9200', + // it takes two parameters, the request parameters and options + generateRequestId: function (params, options) { + // your id generation logic + // must be syncronous + return 'id' + } +}) +---- + +You can also specify a custom id per request: +[source,js] +---- +client.search({ + index: 'my-index', + body: { foo: 'bar' } +}, { + id: 'custom-id' +}, (err, result) => { + if (err) console.log(err) +}) +---- + +=== Context object +Sometimes, you might need to make some custom data available in your events, you can do that via the `context` option of a request: +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) + +client.on('request', (err, result) => { + const { id } = result.meta.request + const { context } = result.meta + if (err) { + console.log({ error: err, reqId: id, context }) + } +}) + +client.on('response', (err, result) => { + const { id } = result.meta.request + const { winter } = result.meta.context + if (err) { + console.log({ error: err, reqId: id, winter }) + } +}) + +client.search({ + index: 'my-index', + body: { foo: 'bar' } +}, { + context: { winter: 'is coming' } +}, (err, result) => { + if (err) console.log(err) +}) +---- + +=== Client name +If you are using multiple instances of the client or if you are using multiple child clients _(which is the recommended way to have multiple instances of the client)_, you might need to recognize which client you are using, the `name` options will help you in this regard: +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ + node: 'http://localhost:9200', + name: 'parent-client' // default to 'elasticsearch-js' +}) + +const child = client.child({ + name: 'child-client' +}) + +console.log(client.name, child.name) + +client.on('request', (err, result) => { + const { id } = result.meta.request + const { name } = result.meta + if (err) { + console.log({ error: err, reqId: id, name }) + } +}) + +client.on('response', (err, result) => { + const { id } = result.meta.request + const { name } = result.meta + if (err) { + console.log({ error: err, reqId: id, name }) + } +}) + +client.search({ + index: 'my-index', + body: { foo: 'bar' } +}, (err, result) => { + if (err) console.log(err) +}) + +child.search({ + index: 'my-index', + body: { foo: 'bar' } +}, (err, result) => { + if (err) console.log(err) +}) +---- diff --git a/docs/usage.asciidoc b/docs/usage.asciidoc index ed81ef2fc..bc1eeb60f 100644 --- a/docs/usage.asciidoc +++ b/docs/usage.asciidoc @@ -164,6 +164,14 @@ _Default:_ `null` |`querystring` |`object` - Custom querystring for the request. + _Default:_ `null` + +|`id` +|`any` - Custom request id. _(overrides the top level request id generator)_ + +_Default:_ `null` + +|`context` +|`any` - Custom object per request. _(you can use it to pass some data to the clients events)_ + +_Default:_ `null` |=== === Error handling @@ -203,103 +211,3 @@ Following you can find the errors exported by the client. |`ResponseError` |Generated when in case of a `4xx` or `5xx` response. |=== - -=== Events -The client is an event emitter, this means that you can listen for its event and add additional logic to your code, without need to change the client internals or your normal usage. + -You can find the events names by access the `events` key of the client. - -[source,js] ----- -const { events } = require('@elastic/elasticsearch') -console.log(events) ----- - -The event emitter functionality can be useful if you want to log every request, response and error that is happening during the use of the client. - -[source,js] ----- -const logger = require('my-logger')() -const { Client } = require('@elastic/elasticsearch') -const client = new Client({ node: 'http://localhost:9200' }) - -client.on('response', (err, req) => { - if (err) { - logger.error(err) - } else { - logger.info(req) - } -}) ----- - -The client emits the following events: -[cols=2*] -|=== -|`request` -a|Emitted before to send the actual request to Elasticsearch. -[source,js] ----- -client.on('request', (err, req) => { - console.log(err, req) -}) ----- - -|`response` -a|Emitted before to send the actual request to Elasticsearch. -[source,js] ----- -client.on('response', (err, req) => { - console.log(err, req) -}) ----- - -|`sniff` -a|Emitted before to send the actual request to Elasticsearch. -[source,js] ----- -client.on('sniff', (err, req) => { - console.log(err, req) -}) ----- - -|`resurrect` -a|Emitted before to send the actual request to Elasticsearch. -[source,js] ----- -client.on('resurrect', (err, req) => { - console.log(err, req) -}) ----- - -|=== - -The values of `req` in `request`, `response` and `sniff` will be: -[source,ts] ----- - body: any; - statusCode: number | null; - headers: anyObject | null; - warnings: string[] | null; - meta: { - request: { - params: TransportRequestParams; - options: TransportRequestOptions; - }; - connection: Connection; - attempts: number; - aborted: boolean; - sniff?: { - hosts: any[]; - reason: string; - }; - }; ----- - -While the `req` value in `resurrect` will be: -[source,ts] ----- -export interface ResurrectEvent { - strategy: string; - isAlive: boolean; - connection: Connection; -} ----- diff --git a/index.d.ts b/index.d.ts index 22e83efe8..5bce05610 100644 --- a/index.d.ts +++ b/index.d.ts @@ -28,6 +28,7 @@ import Transport, { TransportRequestOptions, nodeFilterFn, nodeSelectorFn, + generateRequestIdFn, TransportRequestCallback } from './lib/Transport'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; @@ -93,6 +94,8 @@ interface ClientOptions { nodeFilter?: nodeFilterFn; nodeSelector?: nodeSelectorFn | string; headers?: anyObject; + generateRequestId?: generateRequestIdFn; + name?: string; cloud?: { id: string; username: string; diff --git a/index.js b/index.js index 27a77a9ac..7f5b3c1c3 100644 --- a/index.js +++ b/index.js @@ -80,12 +80,15 @@ class Client extends EventEmitter { agent: null, headers: {}, nodeFilter: null, - nodeSelector: 'round-robin' + nodeSelector: 'round-robin', + generateRequestId: null, + name: 'elasticsearch-js' }, opts) this[kInitialOptions] = options this[kExtensions] = [] + this.name = options.name this.serializer = new options.Serializer() this.connectionPool = new options.ConnectionPool({ pingTimeout: options.pingTimeout, @@ -118,7 +121,9 @@ class Client extends EventEmitter { compression: options.compression, headers: options.headers, nodeFilter: options.nodeFilter, - nodeSelector: options.nodeSelector + nodeSelector: options.nodeSelector, + generateRequestId: options.generateRequestId, + name: options.name }) const apis = buildApi({ diff --git a/lib/ConnectionPool.d.ts b/lib/ConnectionPool.d.ts index 9acbb7d01..5b68d7d36 100644 --- a/lib/ConnectionPool.d.ts +++ b/lib/ConnectionPool.d.ts @@ -36,10 +36,20 @@ export interface getConnectionOptions { selector?: nodeSelectorFn; } +export interface resurrectOptions { + now?: number; + requestId: string; + name: string; +} + export interface ResurrectEvent { strategy: string; isAlive: boolean; connection: Connection; + name: string; + request: { + id: any; + }; } export default class ConnectionPool { @@ -79,10 +89,10 @@ export default class ConnectionPool { * If enabled, tries to resurrect a connection with the given * resurrect strategy ('ping', 'optimistic', 'none'). * - * @param {number} epoch + * @param {object} { now, requestId, name } * @param {function} callback (isAlive, connection) */ - resurrect(now?: number, callback?: (isAlive: boolean | null, connection: Connection | null) => void): void; + resurrect(opts: resurrectOptions, callback?: (isAlive: boolean | null, connection: Connection | null) => void): void; /** * Returns an alive connection if present, * otherwise returns null. diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index 6a164d4ae..3f12a64a4 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -108,10 +108,10 @@ class ConnectionPool { * If enabled, tries to resurrect a connection with the given * resurrect strategy ('ping', 'optimistic', 'none'). * - * @param {number} epoch + * @param {object} { now, requestId } * @param {function} callback (isAlive, connection) */ - resurrect (now = Date.now(), callback = noop) { + resurrect (opts, callback = noop) { if (this.resurrectStrategy === 0 || this.dead.length === 0) { debug('Nothing to resurrect') callback(null, null) @@ -121,7 +121,7 @@ class ConnectionPool { // the dead list is sorted in ascending order based on the timeout // so the first element will always be the one with the smaller timeout const connection = this.connections.get(this.dead[0]) - if (now < connection.resurrectTimeout) { + if ((opts.now || Date.now()) < connection.resurrectTimeout) { debug('Nothing to resurrect') callback(null, null) return @@ -147,7 +147,13 @@ class ConnectionPool { debug(`Resurrect: connection '${id}' is now alive`) this.markAlive(connection) } - this.emit('resurrect', null, { strategy: 'ping', isAlive, connection }) + this.emit('resurrect', null, { + strategy: 'ping', + name: opts.name, + request: { id: opts.requestId }, + isAlive, + connection + }) callback(isAlive, connection) }) // optimistic strategy @@ -155,7 +161,13 @@ class ConnectionPool { debug(`Resurrect: optimistic resurrection for connection '${id}'`) this.dead.splice(this.dead.indexOf(id), 1) connection.status = Connection.statuses.ALIVE - this.emit('resurrect', null, { strategy: 'optimistic', isAlive: true, connection }) + this.emit('resurrect', null, { + strategy: 'optimistic', + name: opts.name, + request: { id: opts.requestId }, + isAlive: true, + connection + }) // eslint-disable-next-line standard/no-callback-literal callback(true, connection) } diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 89ec11573..83981cf32 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -29,6 +29,10 @@ export interface nodeFilterFn { (connection: Connection): boolean; } +export interface generateRequestIdFn { + (params: TransportRequestParams, options: TransportRequestOptions): any; +} + declare type noopFn = (...args: any[]) => void; declare type emitFn = (event: string | symbol, ...args: any[]) => boolean; @@ -47,17 +51,22 @@ interface TransportOptions { nodeFilter?: nodeFilterFn; nodeSelector?: string | nodeSelectorFn; headers?: anyObject; + generateRequestId?: generateRequestIdFn; + name: string; } -export interface RequestEvent { +export interface RequestEvent { body: T; statusCode: number | null; headers: anyObject | null; warnings: string[] | null; meta: { + context: C; + name: string; request: { params: TransportRequestParams; options: TransportRequestOptions; + id: any; }; connection: Connection; attempts: number; @@ -71,7 +80,7 @@ export interface RequestEvent { // ApiResponse and RequestEvent are the same thing // we are doing this for have more clear names -export interface ApiResponse extends RequestEvent {} +export interface ApiResponse extends RequestEvent {} declare type anyObject = { [key: string]: any; @@ -93,6 +102,8 @@ export interface TransportRequestOptions { headers?: anyObject; querystring?: anyObject; compression?: string; + id?: any; + context?: any; warnings?: [string]; } @@ -100,6 +111,15 @@ export interface TransportRequestCallback { abort: () => void; } +export interface TransportGetConnectionOptions { + requestId: string; +} + +export interface TransportSniffOptions { + reason: string; + requestId?: string; +} + export default class Transport { static sniffReasons: { SNIFF_ON_START: string; @@ -123,8 +143,8 @@ export default class Transport { constructor(opts: TransportOptions); request(params: TransportRequestParams, options?: TransportRequestOptions): Promise; request(params: TransportRequestParams, options?: TransportRequestOptions, callback?: (err: Error | null, result: ApiResponse) => void): TransportRequestCallback; - getConnection(): Connection | null; - sniff(callback?: (...args: any[]) => void): void; + getConnection(opts: TransportGetConnectionOptions): Connection | null; + sniff(opts?: TransportSniffOptions, callback?: (...args: any[]) => void): void; } export {}; diff --git a/lib/Transport.js b/lib/Transport.js index f9ff4f092..3ea692b3a 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -50,6 +50,8 @@ class Transport { this.sniffInterval = opts.sniffInterval this.sniffOnConnectionFault = opts.sniffOnConnectionFault this.sniffEndpoint = opts.sniffEndpoint + this.generateRequestId = opts.generateRequestId || generateRequestId() + this.name = opts.name this.nodeFilter = opts.nodeFilter || defaultNodeFilter if (typeof opts.nodeSelector === 'function') { @@ -67,7 +69,7 @@ class Transport { this._isSniffing = false if (opts.sniffOnStart === true) { - this.sniff(Transport.sniffReasons.SNIFF_ON_START) + this.sniff({ reason: Transport.sniffReasons.SNIFF_ON_START }) } } @@ -89,10 +91,13 @@ class Transport { callback = once(callback) const meta = { + context: options.context || null, request: { params: null, - options: null + options: null, + id: options.id || this.generateRequestId(params, options) }, + name: this.name, connection: null, attempts: 0, aborted: false @@ -112,7 +117,7 @@ class Transport { const makeRequest = () => { if (meta.aborted === true) return - meta.connection = this.getConnection() + meta.connection = this.getConnection({ requestId: meta.request.id }) if (meta.connection === null) { return callback(new NoLivingConnectionsError('There are not living connections'), result) } @@ -192,7 +197,10 @@ class Transport { this.connectionPool.markDead(meta.connection) if (this.sniffOnConnectionFault === true) { - this.sniff(Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT) + this.sniff({ + reason: Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT, + requestId: meta.request.id + }) } // retry logic @@ -312,34 +320,36 @@ class Transport { } } - getConnection () { + getConnection (opts) { const now = Date.now() if (this._sniffEnabled === true && now > this._nextSniff) { - this.sniff(Transport.sniffReasons.SNIFF_INTERVAL) + this.sniff({ reason: Transport.sniffReasons.SNIFF_INTERVAL, requestId: opts.requestId }) } - this.connectionPool.resurrect(now) + this.connectionPool.resurrect({ now, requestId: opts.requestId, name: this.name }) return this.connectionPool.getConnection({ filter: this.nodeFilter, selector: this.nodeSelector }) } - sniff (reason = Transport.sniffReasons.DEFAULT, callback = noop) { + sniff (opts, callback = noop) { if (this._isSniffing === true) return this._isSniffing = true debug('Started sniffing request') - if (typeof reason === 'function') { - callback = reason - reason = Transport.sniffReasons.DEFAULT + if (typeof opts === 'function') { + callback = opts + opts = { reason: Transport.sniffReasons.DEFAULT } } + const { reason } = opts + const request = { method: 'GET', path: this.sniffEndpoint } - this.request(request, (err, result) => { + this.request(request, { id: opts.requestId }, (err, result) => { this._isSniffing = false if (this._sniffEnabled === true) { this._nextSniff = Date.now() + this.sniffInterval @@ -414,5 +424,12 @@ function randomSelector (connections) { return connections[index] } +function generateRequestId () { + var maxInt = 2147483647 + var nextReqId = 0 + return function genReqId (params, options) { + return (nextReqId = (nextReqId + 1) & maxInt) + } +} module.exports = Transport -module.exports.internals = { defaultNodeFilter, roundRobinSelector, randomSelector } +module.exports.internals = { defaultNodeFilter, roundRobinSelector, randomSelector, generateRequestId } diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index 9dbeb04b3..f00d49dc8 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -161,6 +161,8 @@ function generate (spec, common) { headers: options.headers || null, querystring: options.querystring || null, compression: options.compression || false, + id: options.id || null, + context: options.context || null, warnings } diff --git a/test/behavior/observability.test.js b/test/behavior/observability.test.js new file mode 100644 index 000000000..65c16ca6d --- /dev/null +++ b/test/behavior/observability.test.js @@ -0,0 +1,334 @@ +'use strict' + +const { test } = require('tap') +const lolex = require('lolex') +const { Client, Transport } = require('../../index') +const { + connection: { MockConnection, MockConnectionSniff } +} = require('../utils') +const noop = () => {} + +test('Request id', t => { + t.test('Default generateRequestId', t => { + const { generateRequestId } = Transport.internals + t.type(generateRequestId, 'function') + + const genReqId = generateRequestId() + t.type(genReqId, 'function') + + for (var i = 1; i <= 10; i++) { + t.strictEqual(genReqId(), i) + } + + t.end() + }) + + t.test('Custom generateRequestId', t => { + t.plan(7) + + const options = { context: { winter: 'is coming' } } + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + generateRequestId: function (requestParams, requestOptions) { + t.match(requestParams, { method: 'GET', path: '/' }) + t.match(requestOptions, options) + return 'custom-id' + } + }) + + client.on('request', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.request.id, 'custom-id') + }) + + client.on('response', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.request.id, 'custom-id') + }) + + client.info({}, options, t.error) + }) + + t.test('Custom request id in method options', t => { + t.plan(5) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + client.on('request', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.request.id, 'custom-id') + }) + + client.on('response', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.request.id, 'custom-id') + }) + + client.info({}, { id: 'custom-id' }, t.error) + }) + + t.test('Sniff and correlation id', t => { + t.test('sniffOnStart - should autogenerate the id', t => { + t.plan(2) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnectionSniff, + sniffOnStart: true + }) + + client.on('sniff', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.request.id, 1) + }) + }) + + t.test('sniffOnConnectionFault - should use the request id', t => { + t.plan(5) + + const client = new Client({ + nodes: ['http://localhost:9200', 'http://localhost:9201'], + Connection: MockConnectionSniff, + sniffOnConnectionFault: true, + maxRetries: 0 + }) + + client.on('request', (e, { meta }) => { + t.strictEqual(meta.request.id, 'custom') + }) + + client.on('response', (e, { meta }) => { + t.strictEqual(meta.request.id, 'custom') + }) + + client.on('sniff', (e, { meta }) => { + t.strictEqual(meta.request.id, 'custom') + }) + + client.transport.request({ + path: '/500', + method: 'GET' + }, { + id: 'custom', + headers: { timeout: 'true' } + }, noop) + }) + + t.end() + }) + + t.test('Resurrect should use the same request id of the request that starts it', t => { + t.plan(2) + + const clock = lolex.install({ toFake: ['Date'] }) + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + sniffOnConnectionFault: true, + maxRetries: 0 + }) + + const conn = client.connectionPool.getConnection() + client.connectionPool.markDead(conn) + clock.tick(1000 * 61) + + client.on('resurrect', (err, meta) => { + t.error(err) + t.strictEqual(meta.request.id, 'custom') + clock.uninstall() + }) + + client.info({}, { id: 'custom' }, noop) + }) + + t.end() +}) + +test('Request context', t => { + t.test('no value', t => { + t.plan(5) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + client.on('request', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.context, null) + }) + + client.on('response', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.context, null) + }) + + client.info(t.error) + }) + + t.test('custom value', t => { + t.plan(5) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + client.on('request', (err, { meta }) => { + t.error(err) + t.deepEqual(meta.context, { winter: 'is coming' }) + }) + + client.on('response', (err, { meta }) => { + t.error(err) + t.deepEqual(meta.context, { winter: 'is coming' }) + }) + + client.info({}, { context: { winter: 'is coming' } }, t.error) + }) + + t.end() +}) + +test('Client name', t => { + t.test('Property of the client instance', t => { + const client = new Client({ + node: 'http://localhost:9200', + name: 'cluster' + }) + t.strictEqual(client.name, 'cluster') + t.end() + }) + + t.test('Is present in the event metadata', t => { + t.plan(6) + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + name: 'cluster' + }) + + client.on('request', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.name, 'cluster') + }) + + client.on('response', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.name, 'cluster') + }) + + client.info((err, { meta }) => { + t.error(err) + t.strictEqual(meta.name, 'cluster') + }) + }) + + t.test('Sniff and client name', t => { + t.test('sniffOnStart', t => { + t.plan(2) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnectionSniff, + sniffOnStart: true + }) + + client.on('sniff', (err, { meta }) => { + t.error(err) + t.strictEqual(meta.name, 'elasticsearch-js') + }) + }) + + t.test('sniffOnConnectionFault', t => { + t.plan(5) + + const client = new Client({ + nodes: ['http://localhost:9200', 'http://localhost:9201'], + Connection: MockConnectionSniff, + sniffOnConnectionFault: true, + maxRetries: 0 + }) + + client.on('request', (e, { meta }) => { + t.strictEqual(meta.name, 'elasticsearch-js') + }) + + client.on('response', (e, { meta }) => { + t.strictEqual(meta.name, 'elasticsearch-js') + }) + + client.on('sniff', (e, { meta }) => { + t.strictEqual(meta.name, 'elasticsearch-js') + }) + + client.transport.request({ + path: '/500', + method: 'GET' + }, { + headers: { timeout: 'true' } + }, noop) + }) + + t.end() + }) + + t.test('Resurrect should have the client name configured', t => { + t.plan(2) + + const clock = lolex.install({ toFake: ['Date'] }) + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + sniffOnConnectionFault: true, + maxRetries: 0 + }) + + const conn = client.connectionPool.getConnection() + client.connectionPool.markDead(conn) + clock.tick(1000 * 61) + + client.on('resurrect', (err, meta) => { + t.error(err) + t.strictEqual(meta.name, 'elasticsearch-js') + clock.uninstall() + }) + + client.info({}, { id: 'custom' }, noop) + }) + + t.test('Resurrect should have the client name configured (child client)', t => { + t.plan(2) + + const clock = lolex.install({ toFake: ['Date'] }) + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + sniffOnConnectionFault: true, + maxRetries: 0 + }) + + const child = client.child({ + name: 'child-client' + }) + + const conn = client.connectionPool.getConnection() + client.connectionPool.markDead(conn) + clock.tick(1000 * 61) + + client.on('resurrect', (err, meta) => { + t.error(err) + t.strictEqual(meta.name, 'child-client') + clock.uninstall() + }) + + child.info({}, { id: 'custom' }, noop) + }) + + t.end() +}) diff --git a/test/behavior/resurrect.test.js b/test/behavior/resurrect.test.js index 68aba8353..8c4d38ba2 100644 --- a/test/behavior/resurrect.test.js +++ b/test/behavior/resurrect.test.js @@ -37,7 +37,7 @@ const { Client, events } = require('../../index') */ test('Should execute the recurrect API with the ping strategy', t => { - t.plan(6) + t.plan(8) const clock = lolex.install({ toFake: ['Date'] }) const q = workq() @@ -59,6 +59,8 @@ test('Should execute the recurrect API with the ping strategy', t => { t.strictEqual(meta.strategy, 'ping') t.false(meta.isAlive) t.strictEqual(meta.connection.id, 'node0') + t.strictEqual(meta.name, 'elasticsearch-js') + t.deepEqual(meta.request, { id: 2 }) }) q.add((q, done) => { @@ -89,7 +91,7 @@ test('Should execute the recurrect API with the ping strategy', t => { }) test('Resurrect a node and handle 502/3/4 status code', t => { - t.plan(11) + t.plan(15) const clock = lolex.install({ toFake: ['Date'] }) const q = workq() @@ -114,10 +116,13 @@ test('Resurrect a node and handle 502/3/4 status code', t => { maxRetries: 0 }) + var idCount = 2 client.on(events.RESURRECT, (err, meta) => { t.error(err) t.strictEqual(meta.strategy, 'ping') t.strictEqual(meta.connection.id, 'node0') + t.strictEqual(meta.name, 'elasticsearch-js') + t.deepEqual(meta.request, { id: idCount++ }) if (count < 3) { t.false(meta.isAlive) } else { @@ -156,7 +161,7 @@ test('Resurrect a node and handle 502/3/4 status code', t => { }) test('Should execute the recurrect API with the optimistic strategy', t => { - t.plan(6) + t.plan(8) const clock = lolex.install({ toFake: ['Date'] }) const q = workq() @@ -179,6 +184,8 @@ test('Should execute the recurrect API with the optimistic strategy', t => { t.strictEqual(meta.strategy, 'optimistic') t.true(meta.isAlive) t.strictEqual(meta.connection.id, 'node0') + t.strictEqual(meta.name, 'elasticsearch-js') + t.deepEqual(meta.request, { id: 2 }) }) q.add((q, done) => { diff --git a/test/unit/child.test.js b/test/unit/child.test.js index 2e8ea1554..110a7e866 100644 --- a/test/unit/child.test.js +++ b/test/unit/child.test.js @@ -211,3 +211,72 @@ test('Should share the event emitter', t => { t.end() }) + +test('Should create a child client (generateRequestId check)', t => { + t.plan(6) + + function generateRequestId1 () { + var id = 0 + return () => `trace-1-${id++}` + } + + function generateRequestId2 () { + var id = 0 + return () => `trace-2-${id++}` + } + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + generateRequestId: generateRequestId1() + }) + const child = client.child({ + Connection: MockConnection, + generateRequestId: generateRequestId2() + }) + + var count = 0 + client.on('request', (err, { meta }) => { + t.error(err) + t.strictEqual( + meta.request.id, + count++ === 0 ? 'trace-1-0' : 'trace-2-0' + ) + }) + + client.info(err => { + t.error(err) + child.info(t.error) + }) +}) + +test('Should create a child client (name check)', t => { + t.plan(8) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection, + name: 'parent' + }) + const child = client.child({ + Connection: MockConnection, + name: 'child' + }) + + t.strictEqual(client.name, 'parent') + t.strictEqual(child.name, 'child') + + var count = 0 + client.on('request', (err, { meta }) => { + t.error(err) + t.strictEqual( + meta.name, + count++ === 0 ? 'parent' : 'child' + ) + }) + + client.info(err => { + t.error(err) + child.info(t.error) + }) +}) diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index b288a6a43..fc9495766 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -118,7 +118,12 @@ test('API', t => { const href = 'http://localhost:9200/' var connection = pool.addConnection(href) pool.markDead(connection) - pool.resurrect(Date.now() + 1000 * 60 * 3, (isAlive, connection) => { + const opts = { + now: Date.now() + 1000 * 60 * 3, + requestId: 1, + name: 'elasticsearch-js' + } + pool.resurrect(opts, (isAlive, connection) => { t.true(isAlive) connection = pool.connections.get(connection.id) t.strictEqual(connection.deadCount, 0) @@ -139,7 +144,12 @@ test('API', t => { const href = 'http://localhost:9200/' var connection = pool.addConnection(href) pool.markDead(connection) - pool.resurrect(Date.now() + 1000 * 60 * 3, (isAlive, connection) => { + const opts = { + now: Date.now() + 1000 * 60 * 3, + requestId: 1, + name: 'elasticsearch-js' + } + pool.resurrect(opts, (isAlive, connection) => { t.false(isAlive) connection = pool.connections.get(connection.id) t.strictEqual(connection.deadCount, 2) @@ -162,7 +172,12 @@ test('API', t => { const href = 'http://localhost:9200/' var connection = pool.addConnection(href) pool.markDead(connection) - pool.resurrect(Date.now() + 1000 * 60 * 3, (isAlive, connection) => { + const opts = { + now: Date.now() + 1000 * 60 * 3, + requestId: 1, + name: 'elasticsearch-js' + } + pool.resurrect(opts, (isAlive, connection) => { t.true(isAlive) connection = pool.connections.get(connection.id) t.strictEqual(connection.deadCount, 1) @@ -182,7 +197,12 @@ test('API', t => { const href = 'http://localhost:9200/' var connection = pool.addConnection(href) pool.markDead(connection) - pool.resurrect(Date.now() + 1000 * 60 * 3, (isAlive, connection) => { + const opts = { + now: Date.now() + 1000 * 60 * 3, + requestId: 1, + name: 'elasticsearch-js' + } + pool.resurrect(opts, (isAlive, connection) => { t.ok(isAlive === null) t.ok(connection === null) connection = pool.connections.get(href) diff --git a/test/unit/events.test.js b/test/unit/events.test.js index a40f72386..d8029f2d5 100644 --- a/test/unit/events.test.js +++ b/test/unit/events.test.js @@ -40,6 +40,8 @@ test('Should emit a request event when a request is performed', t => { headers: null, warnings: null, meta: { + context: null, + name: 'elasticsearch-js', request: { params: { method: 'GET', @@ -59,7 +61,8 @@ test('Should emit a request event when a request is performed', t => { headers: null, compression: false, warnings: null - } + }, + id: 1 }, connection: { id: 'http://localhost:9200' @@ -97,6 +100,8 @@ test('Should emit a response event in case of a successful response', t => { }, warnings: null, meta: { + context: null, + name: 'elasticsearch-js', request: { params: { method: 'GET', @@ -116,7 +121,8 @@ test('Should emit a response event in case of a successful response', t => { headers: null, compression: false, warnings: null - } + }, + id: 1 }, connection: { id: 'http://localhost:9200' @@ -152,6 +158,8 @@ test('Should emit a response event with the error set', t => { headers: null, warnings: null, meta: { + context: null, + name: 'elasticsearch-js', request: { params: { method: 'GET', @@ -171,7 +179,8 @@ test('Should emit a response event with the error set', t => { headers: null, compression: false, warnings: null - } + }, + id: 1 }, connection: { id: 'http://localhost:9200' diff --git a/test/unit/transport.test.js b/test/unit/transport.test.js index c7c789950..b9e079dc3 100644 --- a/test/unit/transport.test.js +++ b/test/unit/transport.test.js @@ -704,11 +704,13 @@ test('Should call markAlive with a successful response', t => { }) test('Should call resurrect on every request', t => { - t.plan(3) + t.plan(5) class CustomConnectionPool extends ConnectionPool { - resurrect (now) { + resurrect ({ now, requestId, name }) { t.type(now, 'number') + t.type(requestId, 'number') + t.type(name, 'string') } } @@ -725,7 +727,8 @@ test('Should call resurrect on every request', t => { maxRetries: 3, requestTimeout: 30000, sniffInterval: false, - sniffOnStart: false + sniffOnStart: false, + name: 'elasticsearch-js' }) transport.request({ @@ -2107,3 +2110,30 @@ test('Should accept custom querystring in the optons object', t => { t.end() }) + +test('Should pass request params and options to generateRequestId', t => { + t.plan(3) + + const pool = new ConnectionPool({ Connection: MockConnection }) + pool.addConnection('http://localhost:9200') + + const params = { method: 'GET', path: '/hello' } + const options = { context: { winter: 'is coming' } } + + const transport = new Transport({ + emit: () => {}, + connectionPool: pool, + serializer: new Serializer(), + maxRetries: 3, + requestTimeout: 30000, + sniffInterval: false, + sniffOnStart: false, + generateRequestId: function (requestParams, requestOptions) { + t.deepEqual(requestParams, params) + t.deepEqual(requestOptions, options) + return 'id' + } + }) + + transport.request(params, options, t.error) +}) diff --git a/test/utils/MockConnection.js b/test/utils/MockConnection.js index 938bfd47a..7f16e27d4 100644 --- a/test/utils/MockConnection.js +++ b/test/utils/MockConnection.js @@ -73,6 +73,47 @@ class MockConnectionError extends Connection { } } +class MockConnectionSniff extends Connection { + request (params, callback) { + var aborted = false + const sniffResult = { + nodes: { + 'node-1': { + http: { + publish_address: 'localhost:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + 'node-2': { + http: { + publish_address: 'localhost:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + } + const stream = intoStream(JSON.stringify(sniffResult)) + stream.statusCode = setStatusCode(params.path) + stream.headers = { + 'content-type': 'application/json;utf=8', + 'date': new Date().toISOString(), + 'connection': 'keep-alive', + 'content-length': '205' + } + process.nextTick(() => { + if (!aborted) { + if (params.headers.timeout) { + callback(new TimeoutError('Request timed out', params), null) + } else { + callback(null, stream) + } + } + }) + return { + abort: () => { aborted = true } + } + } +} function setStatusCode (path) { const statusCode = Number(path.slice(1)) if (Number.isInteger(statusCode)) { @@ -81,4 +122,9 @@ function setStatusCode (path) { return 200 } -module.exports = { MockConnection, MockConnectionTimeout, MockConnectionError } +module.exports = { + MockConnection, + MockConnectionTimeout, + MockConnectionError, + MockConnectionSniff +} From 215cc036c31315409a5cc821fc34d24d78c3c164 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 3 May 2019 19:02:10 +0200 Subject: [PATCH 32/84] Simplify API wrappers (#839) * Updated code generation * API generation * Updated test * Updated code generation * API generation * API generation --- api/api/bulk.js | 44 ++++--------------- api/api/cat.aliases.js | 44 ++++--------------- api/api/cat.allocation.js | 44 ++++--------------- api/api/cat.count.js | 44 ++++--------------- api/api/cat.fielddata.js | 44 ++++--------------- api/api/cat.health.js | 44 ++++--------------- api/api/cat.help.js | 44 ++++--------------- api/api/cat.indices.js | 44 ++++--------------- api/api/cat.master.js | 44 ++++--------------- api/api/cat.nodeattrs.js | 44 ++++--------------- api/api/cat.nodes.js | 44 ++++--------------- api/api/cat.pending_tasks.js | 44 ++++--------------- api/api/cat.plugins.js | 44 ++++--------------- api/api/cat.recovery.js | 44 ++++--------------- api/api/cat.repositories.js | 44 ++++--------------- api/api/cat.segments.js | 44 ++++--------------- api/api/cat.shards.js | 44 ++++--------------- api/api/cat.snapshots.js | 44 ++++--------------- api/api/cat.tasks.js | 44 ++++--------------- api/api/cat.templates.js | 44 ++++--------------- api/api/cat.thread_pool.js | 44 ++++--------------- api/api/ccr.delete_auto_follow_pattern.js | 44 ++++--------------- api/api/ccr.follow.js | 44 ++++--------------- api/api/ccr.follow_info.js | 44 ++++--------------- api/api/ccr.follow_stats.js | 44 ++++--------------- api/api/ccr.forget_follower.js | 44 ++++--------------- api/api/ccr.get_auto_follow_pattern.js | 44 ++++--------------- api/api/ccr.pause_follow.js | 44 ++++--------------- api/api/ccr.put_auto_follow_pattern.js | 44 ++++--------------- api/api/ccr.resume_follow.js | 44 ++++--------------- api/api/ccr.stats.js | 44 ++++--------------- api/api/ccr.unfollow.js | 44 ++++--------------- api/api/clear_scroll.js | 44 ++++--------------- api/api/cluster.allocation_explain.js | 44 ++++--------------- api/api/cluster.get_settings.js | 44 ++++--------------- api/api/cluster.health.js | 44 ++++--------------- api/api/cluster.pending_tasks.js | 44 ++++--------------- api/api/cluster.put_settings.js | 44 ++++--------------- api/api/cluster.remote_info.js | 44 ++++--------------- api/api/cluster.reroute.js | 44 ++++--------------- api/api/cluster.state.js | 44 ++++--------------- api/api/cluster.stats.js | 44 ++++--------------- api/api/count.js | 44 ++++--------------- api/api/create.js | 44 ++++--------------- .../data_frame.delete_data_frame_transform.js | 44 ++++--------------- .../data_frame.get_data_frame_transform.js | 44 ++++--------------- ...ta_frame.get_data_frame_transform_stats.js | 44 ++++--------------- ...data_frame.preview_data_frame_transform.js | 44 ++++--------------- .../data_frame.put_data_frame_transform.js | 44 ++++--------------- .../data_frame.start_data_frame_transform.js | 44 ++++--------------- .../data_frame.stop_data_frame_transform.js | 44 ++++--------------- api/api/delete.js | 44 ++++--------------- api/api/delete_by_query.js | 44 ++++--------------- api/api/delete_by_query_rethrottle.js | 44 ++++--------------- api/api/delete_script.js | 44 ++++--------------- api/api/exists.js | 44 ++++--------------- api/api/exists_source.js | 44 ++++--------------- api/api/explain.js | 44 ++++--------------- api/api/field_caps.js | 44 ++++--------------- api/api/get.js | 44 ++++--------------- api/api/get_script.js | 44 ++++--------------- api/api/get_source.js | 44 ++++--------------- api/api/graph.explore.js | 44 ++++--------------- api/api/ilm.delete_lifecycle.js | 44 ++++--------------- api/api/ilm.explain_lifecycle.js | 44 ++++--------------- api/api/ilm.get_lifecycle.js | 44 ++++--------------- api/api/ilm.get_status.js | 44 ++++--------------- api/api/ilm.move_to_step.js | 44 ++++--------------- api/api/ilm.put_lifecycle.js | 44 ++++--------------- api/api/ilm.remove_policy.js | 44 ++++--------------- api/api/ilm.retry.js | 44 ++++--------------- api/api/ilm.start.js | 44 ++++--------------- api/api/ilm.stop.js | 44 ++++--------------- api/api/index.js | 44 ++++--------------- api/api/indices.analyze.js | 44 ++++--------------- api/api/indices.clear_cache.js | 44 ++++--------------- api/api/indices.close.js | 44 ++++--------------- api/api/indices.create.js | 44 ++++--------------- api/api/indices.delete.js | 44 ++++--------------- api/api/indices.delete_alias.js | 44 ++++--------------- api/api/indices.delete_template.js | 44 ++++--------------- api/api/indices.exists.js | 44 ++++--------------- api/api/indices.exists_alias.js | 44 ++++--------------- api/api/indices.exists_template.js | 44 ++++--------------- api/api/indices.exists_type.js | 44 ++++--------------- api/api/indices.flush.js | 44 ++++--------------- api/api/indices.flush_synced.js | 44 ++++--------------- api/api/indices.forcemerge.js | 44 ++++--------------- api/api/indices.freeze.js | 44 ++++--------------- api/api/indices.get.js | 44 ++++--------------- api/api/indices.get_alias.js | 44 ++++--------------- api/api/indices.get_field_mapping.js | 44 ++++--------------- api/api/indices.get_mapping.js | 44 ++++--------------- api/api/indices.get_settings.js | 44 ++++--------------- api/api/indices.get_template.js | 44 ++++--------------- api/api/indices.get_upgrade.js | 44 ++++--------------- api/api/indices.open.js | 44 ++++--------------- api/api/indices.put_alias.js | 44 ++++--------------- api/api/indices.put_mapping.js | 44 ++++--------------- api/api/indices.put_settings.js | 44 ++++--------------- api/api/indices.put_template.js | 44 ++++--------------- api/api/indices.recovery.js | 44 ++++--------------- api/api/indices.refresh.js | 44 ++++--------------- api/api/indices.rollover.js | 44 ++++--------------- api/api/indices.segments.js | 44 ++++--------------- api/api/indices.shard_stores.js | 44 ++++--------------- api/api/indices.shrink.js | 44 ++++--------------- api/api/indices.split.js | 44 ++++--------------- api/api/indices.stats.js | 44 ++++--------------- api/api/indices.unfreeze.js | 44 ++++--------------- api/api/indices.update_aliases.js | 44 ++++--------------- api/api/indices.upgrade.js | 44 ++++--------------- api/api/indices.validate_query.js | 44 ++++--------------- api/api/info.js | 44 ++++--------------- api/api/ingest.delete_pipeline.js | 44 ++++--------------- api/api/ingest.get_pipeline.js | 44 ++++--------------- api/api/ingest.processor_grok.js | 44 ++++--------------- api/api/ingest.put_pipeline.js | 44 ++++--------------- api/api/ingest.simulate.js | 44 ++++--------------- api/api/license.delete.js | 44 ++++--------------- api/api/license.get.js | 44 ++++--------------- api/api/license.get_basic_status.js | 44 ++++--------------- api/api/license.get_trial_status.js | 44 ++++--------------- api/api/license.post.js | 44 ++++--------------- api/api/license.post_start_basic.js | 44 ++++--------------- api/api/license.post_start_trial.js | 44 ++++--------------- api/api/mget.js | 44 ++++--------------- api/api/migration.deprecations.js | 44 ++++--------------- api/api/ml.close_job.js | 44 ++++--------------- api/api/ml.delete_calendar.js | 44 ++++--------------- api/api/ml.delete_calendar_event.js | 44 ++++--------------- api/api/ml.delete_calendar_job.js | 44 ++++--------------- api/api/ml.delete_datafeed.js | 44 ++++--------------- api/api/ml.delete_expired_data.js | 44 ++++--------------- api/api/ml.delete_filter.js | 44 ++++--------------- api/api/ml.delete_forecast.js | 44 ++++--------------- api/api/ml.delete_job.js | 44 ++++--------------- api/api/ml.delete_model_snapshot.js | 44 ++++--------------- api/api/ml.find_file_structure.js | 44 ++++--------------- api/api/ml.flush_job.js | 44 ++++--------------- api/api/ml.forecast.js | 44 ++++--------------- api/api/ml.get_buckets.js | 44 ++++--------------- api/api/ml.get_calendar_events.js | 44 ++++--------------- api/api/ml.get_calendars.js | 44 ++++--------------- api/api/ml.get_categories.js | 44 ++++--------------- api/api/ml.get_datafeed_stats.js | 44 ++++--------------- api/api/ml.get_datafeeds.js | 44 ++++--------------- api/api/ml.get_filters.js | 44 ++++--------------- api/api/ml.get_influencers.js | 44 ++++--------------- api/api/ml.get_job_stats.js | 44 ++++--------------- api/api/ml.get_jobs.js | 44 ++++--------------- api/api/ml.get_model_snapshots.js | 44 ++++--------------- api/api/ml.get_overall_buckets.js | 44 ++++--------------- api/api/ml.get_records.js | 44 ++++--------------- api/api/ml.info.js | 44 ++++--------------- api/api/ml.open_job.js | 44 ++++--------------- api/api/ml.post_calendar_events.js | 44 ++++--------------- api/api/ml.post_data.js | 44 ++++--------------- api/api/ml.preview_datafeed.js | 44 ++++--------------- api/api/ml.put_calendar.js | 44 ++++--------------- api/api/ml.put_calendar_job.js | 44 ++++--------------- api/api/ml.put_datafeed.js | 44 ++++--------------- api/api/ml.put_filter.js | 44 ++++--------------- api/api/ml.put_job.js | 44 ++++--------------- api/api/ml.revert_model_snapshot.js | 44 ++++--------------- api/api/ml.set_upgrade_mode.js | 44 ++++--------------- api/api/ml.start_datafeed.js | 44 ++++--------------- api/api/ml.stop_datafeed.js | 44 ++++--------------- api/api/ml.update_datafeed.js | 44 ++++--------------- api/api/ml.update_filter.js | 44 ++++--------------- api/api/ml.update_job.js | 44 ++++--------------- api/api/ml.update_model_snapshot.js | 44 ++++--------------- api/api/ml.validate.js | 44 ++++--------------- api/api/ml.validate_detector.js | 44 ++++--------------- api/api/monitoring.bulk.js | 44 ++++--------------- api/api/msearch.js | 44 ++++--------------- api/api/msearch_template.js | 44 ++++--------------- api/api/mtermvectors.js | 44 ++++--------------- api/api/nodes.hot_threads.js | 44 ++++--------------- api/api/nodes.info.js | 44 ++++--------------- api/api/nodes.reload_secure_settings.js | 44 ++++--------------- api/api/nodes.stats.js | 44 ++++--------------- api/api/nodes.usage.js | 44 ++++--------------- api/api/ping.js | 44 ++++--------------- api/api/put_script.js | 44 ++++--------------- api/api/rank_eval.js | 44 ++++--------------- api/api/reindex.js | 44 ++++--------------- api/api/reindex_rethrottle.js | 44 ++++--------------- api/api/render_search_template.js | 44 ++++--------------- api/api/rollup.delete_job.js | 44 ++++--------------- api/api/rollup.get_jobs.js | 44 ++++--------------- api/api/rollup.get_rollup_caps.js | 44 ++++--------------- api/api/rollup.get_rollup_index_caps.js | 44 ++++--------------- api/api/rollup.put_job.js | 44 ++++--------------- api/api/rollup.rollup_search.js | 44 ++++--------------- api/api/rollup.start_job.js | 44 ++++--------------- api/api/rollup.stop_job.js | 44 ++++--------------- api/api/scripts_painless_context.js | 44 ++++--------------- api/api/scripts_painless_execute.js | 44 ++++--------------- api/api/scroll.js | 44 ++++--------------- api/api/search.js | 44 ++++--------------- api/api/search_shards.js | 44 ++++--------------- api/api/search_template.js | 44 ++++--------------- api/api/security.authenticate.js | 44 ++++--------------- api/api/security.change_password.js | 44 ++++--------------- api/api/security.clear_cached_realms.js | 44 ++++--------------- api/api/security.clear_cached_roles.js | 44 ++++--------------- api/api/security.create_api_key.js | 44 ++++--------------- api/api/security.delete_privileges.js | 44 ++++--------------- api/api/security.delete_role.js | 44 ++++--------------- api/api/security.delete_role_mapping.js | 44 ++++--------------- api/api/security.delete_user.js | 44 ++++--------------- api/api/security.disable_user.js | 44 ++++--------------- api/api/security.enable_user.js | 44 ++++--------------- api/api/security.get_api_key.js | 44 ++++--------------- api/api/security.get_privileges.js | 44 ++++--------------- api/api/security.get_role.js | 44 ++++--------------- api/api/security.get_role_mapping.js | 44 ++++--------------- api/api/security.get_token.js | 44 ++++--------------- api/api/security.get_user.js | 44 ++++--------------- api/api/security.get_user_privileges.js | 44 ++++--------------- api/api/security.has_privileges.js | 44 ++++--------------- api/api/security.invalidate_api_key.js | 44 ++++--------------- api/api/security.invalidate_token.js | 44 ++++--------------- api/api/security.put_privileges.js | 44 ++++--------------- api/api/security.put_role.js | 44 ++++--------------- api/api/security.put_role_mapping.js | 44 ++++--------------- api/api/security.put_user.js | 44 ++++--------------- api/api/snapshot.create.js | 44 ++++--------------- api/api/snapshot.create_repository.js | 44 ++++--------------- api/api/snapshot.delete.js | 44 ++++--------------- api/api/snapshot.delete_repository.js | 44 ++++--------------- api/api/snapshot.get.js | 44 ++++--------------- api/api/snapshot.get_repository.js | 44 ++++--------------- api/api/snapshot.restore.js | 44 ++++--------------- api/api/snapshot.status.js | 44 ++++--------------- api/api/snapshot.verify_repository.js | 44 ++++--------------- api/api/sql.clear_cursor.js | 44 ++++--------------- api/api/sql.query.js | 44 ++++--------------- api/api/sql.translate.js | 44 ++++--------------- api/api/ssl.certificates.js | 44 ++++--------------- api/api/tasks.cancel.js | 44 ++++--------------- api/api/tasks.get.js | 44 ++++--------------- api/api/tasks.list.js | 44 ++++--------------- api/api/termvectors.js | 44 ++++--------------- api/api/update.js | 44 ++++--------------- api/api/update_by_query.js | 44 ++++--------------- api/api/update_by_query_rethrottle.js | 44 ++++--------------- api/api/watcher.ack_watch.js | 44 ++++--------------- api/api/watcher.activate_watch.js | 44 ++++--------------- api/api/watcher.deactivate_watch.js | 44 ++++--------------- api/api/watcher.delete_watch.js | 44 ++++--------------- api/api/watcher.execute_watch.js | 44 ++++--------------- api/api/watcher.get_watch.js | 44 ++++--------------- api/api/watcher.put_watch.js | 44 ++++--------------- api/api/watcher.start.js | 44 ++++--------------- api/api/watcher.stats.js | 44 ++++--------------- api/api/watcher.stop.js | 44 ++++--------------- api/api/xpack.info.js | 44 ++++--------------- api/api/xpack.usage.js | 44 ++++--------------- api/index.js | 14 ++++++ scripts/utils/generateApis.js | 44 ++++--------------- scripts/utils/generateMain.js | 14 ++++++ test/unit/events.test.js | 28 ++---------- 264 files changed, 2119 insertions(+), 9421 deletions(-) diff --git a/api/api/bulk.js b/api/api/bulk.js index 15b660683..cf09dbbdd 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -24,7 +24,7 @@ function buildBulk (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request * @@ -97,17 +97,17 @@ function buildBulk (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,36 +128,8 @@ function buildBulk (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index 2b7ef3bc3..c5dd54002 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -24,7 +24,7 @@ function buildCatAliases (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request * @@ -83,17 +83,17 @@ function buildCatAliases (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildCatAliases (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index f7118efea..0813c9adf 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -24,7 +24,7 @@ function buildCatAllocation (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.allocation](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request * @@ -85,17 +85,17 @@ function buildCatAllocation (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildCatAllocation (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.count.js b/api/api/cat.count.js index cdb1c2ccd..79e6ba665 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -24,7 +24,7 @@ function buildCatCount (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.count](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request * @@ -83,17 +83,17 @@ function buildCatCount (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildCatCount (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index d1e22cf0a..2871e8276 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -24,7 +24,7 @@ function buildCatFielddata (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.fielddata](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request * @@ -87,17 +87,17 @@ function buildCatFielddata (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, fields } = params - var querystring = semicopy(params, ['method', 'body', 'fields']) + var warnings = [] + var { method, body, fields, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,36 +116,8 @@ function buildCatFielddata (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.health.js b/api/api/cat.health.js index 827ebd276..ee9088774 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -24,7 +24,7 @@ function buildCatHealth (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request * @@ -84,17 +84,17 @@ function buildCatHealth (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -109,36 +109,8 @@ function buildCatHealth (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.help.js b/api/api/cat.help.js index 2f744f49d..3129b9892 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -24,7 +24,7 @@ function buildCatHelp (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.help](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html) request * @@ -71,17 +71,17 @@ function buildCatHelp (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -96,36 +96,8 @@ function buildCatHelp (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index d731c372a..b262476a7 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -24,7 +24,7 @@ function buildCatIndices (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.indices](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html) request * @@ -92,17 +92,17 @@ function buildCatIndices (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -121,36 +121,8 @@ function buildCatIndices (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.master.js b/api/api/cat.master.js index 6ea1ef531..859eaa3a0 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -24,7 +24,7 @@ function buildCatMaster (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.master](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html) request * @@ -82,17 +82,17 @@ function buildCatMaster (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildCatMaster (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index 66995d45c..94b6c5a03 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -24,7 +24,7 @@ function buildCatNodeattrs (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.nodeattrs](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html) request * @@ -82,17 +82,17 @@ function buildCatNodeattrs (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildCatNodeattrs (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index 21f27a517..024a85d9c 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -24,7 +24,7 @@ function buildCatNodes (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.nodes](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html) request * @@ -85,17 +85,17 @@ function buildCatNodes (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -110,36 +110,8 @@ function buildCatNodes (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index 920a77e47..399fa8df0 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -24,7 +24,7 @@ function buildCatPendingTasks (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html) request * @@ -82,17 +82,17 @@ function buildCatPendingTasks (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildCatPendingTasks (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index e254ddb3b..accfcd225 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -24,7 +24,7 @@ function buildCatPlugins (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.plugins](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html) request * @@ -82,17 +82,17 @@ function buildCatPlugins (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildCatPlugins (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index 27938674a..1e2673d45 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -24,7 +24,7 @@ function buildCatRecovery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html) request * @@ -83,17 +83,17 @@ function buildCatRecovery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildCatRecovery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index d4801efc9..a5fccaf72 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -24,7 +24,7 @@ function buildCatRepositories (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.repositories](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html) request * @@ -82,17 +82,17 @@ function buildCatRepositories (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildCatRepositories (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index 9e2415c34..80289fab2 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -24,7 +24,7 @@ function buildCatSegments (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html) request * @@ -80,17 +80,17 @@ function buildCatSegments (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -109,36 +109,8 @@ function buildCatSegments (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index 15031236f..8a558a3f6 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -24,7 +24,7 @@ function buildCatShards (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html) request * @@ -85,17 +85,17 @@ function buildCatShards (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildCatShards (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index 94ead6ac4..dd13a1a3b 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -24,7 +24,7 @@ function buildCatSnapshots (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html) request * @@ -84,17 +84,17 @@ function buildCatSnapshots (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,36 +113,8 @@ function buildCatSnapshots (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index e478ccc7e..7de46c56a 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -24,7 +24,7 @@ function buildCatTasks (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -87,17 +87,17 @@ function buildCatTasks (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildCatTasks (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index 432e1d28d..13ab47f23 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -24,7 +24,7 @@ function buildCatTemplates (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.templates](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html) request * @@ -83,17 +83,17 @@ function buildCatTemplates (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildCatTemplates (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index 49d7078f8..d1dcde6f1 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -24,7 +24,7 @@ function buildCatThreadPool (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.thread_pool](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request * @@ -85,17 +85,17 @@ function buildCatThreadPool (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, threadPoolPatterns, thread_pool_patterns } = params - var querystring = semicopy(params, ['method', 'body', 'threadPoolPatterns', 'thread_pool_patterns']) + var warnings = [] + var { method, body, threadPoolPatterns, thread_pool_patterns, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildCatThreadPool (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index f5241c473..d9d8dbf8c 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -24,7 +24,7 @@ function buildCcrDeleteAutoFollowPattern (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.delete_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html) request * @@ -63,17 +63,17 @@ function buildCcrDeleteAutoFollowPattern (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildCcrDeleteAutoFollowPattern (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index 9ee3158c6..f98f46dab 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -24,7 +24,7 @@ function buildCcrFollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html) request * @@ -69,17 +69,17 @@ function buildCcrFollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildCcrFollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js index 1e8040461..2599c47eb 100644 --- a/api/api/ccr.follow_info.js +++ b/api/api/ccr.follow_info.js @@ -24,7 +24,7 @@ function buildCcrFollowInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.follow_info](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html) request * @@ -57,17 +57,17 @@ function buildCcrFollowInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -82,36 +82,8 @@ function buildCcrFollowInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 52373f123..6d4b118d7 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -24,7 +24,7 @@ function buildCcrFollowStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.follow_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html) request * @@ -63,17 +63,17 @@ function buildCcrFollowStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildCcrFollowStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index db17668a5..a13fed2f7 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -24,7 +24,7 @@ function buildCcrForgetFollower (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.forget_follower](http://www.elastic.co/guide/en/elasticsearch/reference/current) request * @@ -68,17 +68,17 @@ function buildCcrForgetFollower (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildCcrForgetFollower (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 577e229ac..4408c4fc9 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -24,7 +24,7 @@ function buildCcrGetAutoFollowPattern (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.get_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html) request * @@ -57,17 +57,17 @@ function buildCcrGetAutoFollowPattern (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -86,36 +86,8 @@ function buildCcrGetAutoFollowPattern (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 462e30be4..36038853a 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -24,7 +24,7 @@ function buildCcrPauseFollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.pause_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html) request * @@ -63,17 +63,17 @@ function buildCcrPauseFollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildCcrPauseFollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index 0f2691714..c01ceeeae 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -24,7 +24,7 @@ function buildCcrPutAutoFollowPattern (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.put_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html) request * @@ -68,17 +68,17 @@ function buildCcrPutAutoFollowPattern (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildCcrPutAutoFollowPattern (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index 36c666531..6a55c779d 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -24,7 +24,7 @@ function buildCcrResumeFollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.resume_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html) request * @@ -64,17 +64,17 @@ function buildCcrResumeFollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,36 +89,8 @@ function buildCcrResumeFollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index 3f1d9bc39..4297da6c7 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -24,7 +24,7 @@ function buildCcrStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request * @@ -56,17 +56,17 @@ function buildCcrStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -81,36 +81,8 @@ function buildCcrStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index 43c1ba4b1..50601072b 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -24,7 +24,7 @@ function buildCcrUnfollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.unfollow](http://www.elastic.co/guide/en/elasticsearch/reference/current) request * @@ -63,17 +63,17 @@ function buildCcrUnfollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildCcrUnfollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 8f17c4dc3..7d02162ad 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -24,7 +24,7 @@ function buildClearScroll (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request * @@ -63,17 +63,17 @@ function buildClearScroll (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, scrollId, scroll_id } = params - var querystring = semicopy(params, ['method', 'body', 'scrollId', 'scroll_id']) + var warnings = [] + var { method, body, scrollId, scroll_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildClearScroll (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index 4e7155e30..f7d18de2c 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -24,7 +24,7 @@ function buildClusterAllocationExplain (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.allocation_explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) request * @@ -68,17 +68,17 @@ function buildClusterAllocationExplain (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildClusterAllocationExplain (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index f9722e0b9..7bf393d80 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -24,7 +24,7 @@ function buildClusterGetSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request * @@ -78,17 +78,17 @@ function buildClusterGetSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildClusterGetSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 9c764b9fe..12e495377 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -24,7 +24,7 @@ function buildClusterHealth (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request * @@ -98,17 +98,17 @@ function buildClusterHealth (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -127,36 +127,8 @@ function buildClusterHealth (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index 32802c975..c8bdd8ca3 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -24,7 +24,7 @@ function buildClusterPendingTasks (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html) request * @@ -72,17 +72,17 @@ function buildClusterPendingTasks (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,36 +97,8 @@ function buildClusterPendingTasks (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index 230714ce7..06a07efa0 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -24,7 +24,7 @@ function buildClusterPutSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request * @@ -76,17 +76,17 @@ function buildClusterPutSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -101,36 +101,8 @@ function buildClusterPutSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 62122e6ac..5c3b65f54 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -24,7 +24,7 @@ function buildClusterRemoteInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request * @@ -67,17 +67,17 @@ function buildClusterRemoteInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildClusterRemoteInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index 9173b8b36..c7e083bf8 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -24,7 +24,7 @@ function buildClusterReroute (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.reroute](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html) request * @@ -77,17 +77,17 @@ function buildClusterReroute (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildClusterReroute (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index 002097761..b4eaa7995 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -24,7 +24,7 @@ function buildClusterState (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request * @@ -98,17 +98,17 @@ function buildClusterState (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, metric } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'metric']) + var warnings = [] + var { method, body, index, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -129,36 +129,8 @@ function buildClusterState (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index b57e67c56..f90bdd11f 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -24,7 +24,7 @@ function buildClusterStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html) request * @@ -73,17 +73,17 @@ function buildClusterStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildClusterStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/count.js b/api/api/count.js index ac504f2e5..c4559bcd3 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -24,7 +24,7 @@ function buildCount (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [count](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html) request * @@ -106,17 +106,17 @@ function buildCount (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -137,36 +137,8 @@ function buildCount (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/create.js b/api/api/create.js index 3e14db497..2c5c20dbd 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -24,7 +24,7 @@ function buildCreate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [create](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request * @@ -97,17 +97,17 @@ function buildCreate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -126,36 +126,8 @@ function buildCreate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 469f2c6d9..68fb7118d 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameDeleteDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.delete_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html) request * @@ -67,17 +67,17 @@ function buildDataFrameDeleteDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildDataFrameDeleteDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index 7c58b2a92..160f75c7e 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameGetDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.get_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html) request * @@ -66,17 +66,17 @@ function buildDataFrameGetDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,36 +95,8 @@ function buildDataFrameGetDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 40264ccd5..c11e1e94b 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -24,7 +24,7 @@ function buildDataFrameGetDataFrameTransformStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request * @@ -66,17 +66,17 @@ function buildDataFrameGetDataFrameTransformStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -91,36 +91,8 @@ function buildDataFrameGetDataFrameTransformStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index 85bd668a0..c51772d8f 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFramePreviewDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.preview_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html) request * @@ -63,17 +63,17 @@ function buildDataFramePreviewDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildDataFramePreviewDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index 9514f7895..30993de05 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFramePutDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.put_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html) request * @@ -68,17 +68,17 @@ function buildDataFramePutDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildDataFramePutDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index 6f2218cca..2bffd5d50 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameStartDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.start_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html) request * @@ -68,17 +68,17 @@ function buildDataFrameStartDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildDataFrameStartDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index be3919984..87ee0929f 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameStopDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.stop_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html) request * @@ -71,17 +71,17 @@ function buildDataFrameStopDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -96,36 +96,8 @@ function buildDataFrameStopDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/delete.js b/api/api/delete.js index 727747be5..1a02977e2 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -24,7 +24,7 @@ function buildDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request * @@ -100,17 +100,17 @@ function buildDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -129,36 +129,8 @@ function buildDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 2b95a02e6..c760a1dab 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -24,7 +24,7 @@ function buildDeleteByQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request * @@ -159,17 +159,17 @@ function buildDeleteByQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -188,36 +188,8 @@ function buildDeleteByQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index 8cc90e6ab..6759b1d4a 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -24,7 +24,7 @@ function buildDeleteByQueryRethrottle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html) request * @@ -79,17 +79,17 @@ function buildDeleteByQueryRethrottle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildDeleteByQueryRethrottle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/delete_script.js b/api/api/delete_script.js index 9ab6c4460..4efd049d2 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -24,7 +24,7 @@ function buildDeleteScript (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request * @@ -77,17 +77,17 @@ function buildDeleteScript (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildDeleteScript (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/exists.js b/api/api/exists.js index 0bc2eead2..b0647a16d 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -24,7 +24,7 @@ function buildExists (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -104,17 +104,17 @@ function buildExists (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -133,36 +133,8 @@ function buildExists (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 7309e7a9d..1d94e75d1 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -24,7 +24,7 @@ function buildExistsSource (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [exists_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -110,17 +110,17 @@ function buildExistsSource (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -139,36 +139,8 @@ function buildExistsSource (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/explain.js b/api/api/explain.js index 26482fa00..ef8c82a9b 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -24,7 +24,7 @@ function buildExplain (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html) request * @@ -106,17 +106,17 @@ function buildExplain (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -135,36 +135,8 @@ function buildExplain (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/field_caps.js b/api/api/field_caps.js index 1771404cd..d30fbe70b 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -24,7 +24,7 @@ function buildFieldCaps (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html) request * @@ -82,17 +82,17 @@ function buildFieldCaps (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildFieldCaps (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/get.js b/api/api/get.js index 923732178..38d95b1c0 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -24,7 +24,7 @@ function buildGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [get](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -104,17 +104,17 @@ function buildGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -133,36 +133,8 @@ function buildGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/get_script.js b/api/api/get_script.js index aae577d34..b02c02455 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -24,7 +24,7 @@ function buildGetScript (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [get_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request * @@ -75,17 +75,17 @@ function buildGetScript (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,36 +100,8 @@ function buildGetScript (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/get_source.js b/api/api/get_source.js index 88bab3b77..c74c9f6aa 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -24,7 +24,7 @@ function buildGetSource (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [get_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -101,17 +101,17 @@ function buildGetSource (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -130,36 +130,8 @@ function buildGetSource (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 44da987fb..2f626c42b 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -24,7 +24,7 @@ function buildGraphExplore (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request * @@ -68,17 +68,17 @@ function buildGraphExplore (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,36 +97,8 @@ function buildGraphExplore (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index 57ced77cc..6ae64f5ae 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmDeleteLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html) request * @@ -63,17 +63,17 @@ function buildIlmDeleteLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) + var warnings = [] + var { method, body, policy, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildIlmDeleteLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index 62362c7ec..7317c5af5 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmExplainLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request * @@ -63,17 +63,17 @@ function buildIlmExplainLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildIlmExplainLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index 1145c399a..05050040c 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmGetLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html) request * @@ -63,17 +63,17 @@ function buildIlmGetLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) + var warnings = [] + var { method, body, policy, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildIlmGetLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index f27b964e3..5cbb2bc12 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -24,7 +24,7 @@ function buildIlmGetStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.get_status](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html) request * @@ -62,17 +62,17 @@ function buildIlmGetStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildIlmGetStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index c450a083a..3f699d25d 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -24,7 +24,7 @@ function buildIlmMoveToStep (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.move_to_step](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html) request * @@ -58,17 +58,17 @@ function buildIlmMoveToStep (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -83,36 +83,8 @@ function buildIlmMoveToStep (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index b8d58d5f3..8f875547a 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmPutLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html) request * @@ -58,17 +58,17 @@ function buildIlmPutLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) + var warnings = [] + var { method, body, policy, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -83,36 +83,8 @@ function buildIlmPutLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index ca37399d2..0ad388fc0 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -24,7 +24,7 @@ function buildIlmRemovePolicy (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.remove_policy](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html) request * @@ -63,17 +63,17 @@ function buildIlmRemovePolicy (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildIlmRemovePolicy (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 1fbcdd1da..30ee6a8ea 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -24,7 +24,7 @@ function buildIlmRetry (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.retry](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html) request * @@ -63,17 +63,17 @@ function buildIlmRetry (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildIlmRetry (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index 8c907d91d..2dcd08d4b 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -24,7 +24,7 @@ function buildIlmStart (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.start](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html) request * @@ -62,17 +62,17 @@ function buildIlmStart (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildIlmStart (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index b056fa599..d22d2491a 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -24,7 +24,7 @@ function buildIlmStop (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.stop](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html) request * @@ -62,17 +62,17 @@ function buildIlmStop (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildIlmStop (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/index.js b/api/api/index.js index 508e1f6cf..4dbb666d9 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -24,7 +24,7 @@ function buildIndex (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [index](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request * @@ -102,17 +102,17 @@ function buildIndex (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -135,36 +135,8 @@ function buildIndex (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index a9d6e886f..718a3e094 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -24,7 +24,7 @@ function buildIndicesAnalyze (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.analyze](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html) request * @@ -65,17 +65,17 @@ function buildIndicesAnalyze (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildIndicesAnalyze (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index 629b97f2b..ee4dc3f9c 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -24,7 +24,7 @@ function buildIndicesClearCache (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request * @@ -87,17 +87,17 @@ function buildIndicesClearCache (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,36 +116,8 @@ function buildIndicesClearCache (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.close.js b/api/api/indices.close.js index cdfefec47..f5be95a27 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -24,7 +24,7 @@ function buildIndicesClose (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.close](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request * @@ -89,17 +89,17 @@ function buildIndicesClose (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildIndicesClose (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.create.js b/api/api/indices.create.js index 61933d059..1005977d0 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -24,7 +24,7 @@ function buildIndicesCreate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request * @@ -80,17 +80,17 @@ function buildIndicesCreate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -105,36 +105,8 @@ function buildIndicesCreate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index ced4e48e2..277ecd916 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -24,7 +24,7 @@ function buildIndicesDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html) request * @@ -86,17 +86,17 @@ function buildIndicesDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildIndicesDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index f7f37523d..b32076509 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -24,7 +24,7 @@ function buildIndicesDeleteAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.delete_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -88,17 +88,17 @@ function buildIndicesDeleteAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -117,36 +117,8 @@ function buildIndicesDeleteAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index 4f969efe0..2304f0127 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -24,7 +24,7 @@ function buildIndicesDeleteTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.delete_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -77,17 +77,17 @@ function buildIndicesDeleteTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildIndicesDeleteTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index 629725623..72386351a 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -24,7 +24,7 @@ function buildIndicesExists (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html) request * @@ -89,17 +89,17 @@ function buildIndicesExists (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildIndicesExists (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index 7531e6fb0..a86badbf2 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -24,7 +24,7 @@ function buildIndicesExistsAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -84,17 +84,17 @@ function buildIndicesExistsAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,36 +113,8 @@ function buildIndicesExistsAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index 83273b91d..e05a64740 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -24,7 +24,7 @@ function buildIndicesExistsTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -80,17 +80,17 @@ function buildIndicesExistsTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -105,36 +105,8 @@ function buildIndicesExistsTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index 585c2d325..b7adfa719 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -24,7 +24,7 @@ function buildIndicesExistsType (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists_type](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html) request * @@ -94,17 +94,17 @@ function buildIndicesExistsType (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,36 +119,8 @@ function buildIndicesExistsType (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index 94d64e23e..cb4712260 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -24,7 +24,7 @@ function buildIndicesFlush (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.flush](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html) request * @@ -82,17 +82,17 @@ function buildIndicesFlush (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildIndicesFlush (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index f4c69b758..239e07b20 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -24,7 +24,7 @@ function buildIndicesFlushSynced (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request * @@ -77,17 +77,17 @@ function buildIndicesFlushSynced (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,36 +106,8 @@ function buildIndicesFlushSynced (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index b5249ecfc..175d010ae 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -24,7 +24,7 @@ function buildIndicesForcemerge (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.forcemerge](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) request * @@ -85,17 +85,17 @@ function buildIndicesForcemerge (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildIndicesForcemerge (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index 0400b00d5..b5e239f45 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -24,7 +24,7 @@ function buildIndicesFreeze (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.freeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request * @@ -82,17 +82,17 @@ function buildIndicesFreeze (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildIndicesFreeze (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get.js b/api/api/indices.get.js index 3e909ecc4..4aa5f5bae 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -24,7 +24,7 @@ function buildIndicesGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request * @@ -95,17 +95,17 @@ function buildIndicesGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -120,36 +120,8 @@ function buildIndicesGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index d016d5741..e462915ae 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -24,7 +24,7 @@ function buildIndicesGetAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -80,17 +80,17 @@ function buildIndicesGetAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,36 +113,8 @@ function buildIndicesGetAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 70a9efaa0..1c2df81ef 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -24,7 +24,7 @@ function buildIndicesGetFieldMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_field_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html) request * @@ -91,17 +91,17 @@ function buildIndicesGetFieldMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type, fields } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'fields']) + var warnings = [] + var { method, body, index, type, fields, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -124,36 +124,8 @@ function buildIndicesGetFieldMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index c7eb7160c..a6b004ee4 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -24,7 +24,7 @@ function buildIndicesGetMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html) request * @@ -86,17 +86,17 @@ function buildIndicesGetMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,36 +119,8 @@ function buildIndicesGetMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index 79d82cbee..8d876e932 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -24,7 +24,7 @@ function buildIndicesGetSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html) request * @@ -89,17 +89,17 @@ function buildIndicesGetSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -122,36 +122,8 @@ function buildIndicesGetSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index 68d6a6b51..31e49a339 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -24,7 +24,7 @@ function buildIndicesGetTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -79,17 +79,17 @@ function buildIndicesGetTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,36 +108,8 @@ function buildIndicesGetTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index 06781bda7..61f9bc4dd 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -24,7 +24,7 @@ function buildIndicesGetUpgrade (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request * @@ -77,17 +77,17 @@ function buildIndicesGetUpgrade (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,36 +106,8 @@ function buildIndicesGetUpgrade (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.open.js b/api/api/indices.open.js index 742cb028d..7a77de7dd 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -24,7 +24,7 @@ function buildIndicesOpen (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.open](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request * @@ -89,17 +89,17 @@ function buildIndicesOpen (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildIndicesOpen (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index c6d2df4a3..d38dd6d83 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -24,7 +24,7 @@ function buildIndicesPutAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -85,17 +85,17 @@ function buildIndicesPutAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,36 +114,8 @@ function buildIndicesPutAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index b477739c0..561274e12 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -24,7 +24,7 @@ function buildIndicesPutMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html) request * @@ -87,17 +87,17 @@ function buildIndicesPutMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,36 +128,8 @@ function buildIndicesPutMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index ba394a719..82984834d 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -24,7 +24,7 @@ function buildIndicesPutSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html) request * @@ -89,17 +89,17 @@ function buildIndicesPutSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -118,36 +118,8 @@ function buildIndicesPutSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index 931a2ab85..12c08451f 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -24,7 +24,7 @@ function buildIndicesPutTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -88,17 +88,17 @@ function buildIndicesPutTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,36 +113,8 @@ function buildIndicesPutTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index 7362561b7..f373a3236 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -24,7 +24,7 @@ function buildIndicesRecovery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html) request * @@ -73,17 +73,17 @@ function buildIndicesRecovery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildIndicesRecovery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index 1a263c834..7f11d2faa 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -24,7 +24,7 @@ function buildIndicesRefresh (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.refresh](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html) request * @@ -77,17 +77,17 @@ function buildIndicesRefresh (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,36 +106,8 @@ function buildIndicesRefresh (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index 8b7fecb73..bb5e45ebe 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -24,7 +24,7 @@ function buildIndicesRollover (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.rollover](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html) request * @@ -90,17 +90,17 @@ function buildIndicesRollover (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, alias, newIndex, new_index } = params - var querystring = semicopy(params, ['method', 'body', 'alias', 'newIndex', 'new_index']) + var warnings = [] + var { method, body, alias, newIndex, new_index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,36 +119,8 @@ function buildIndicesRollover (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index a9feb67f5..aabd9e7df 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -24,7 +24,7 @@ function buildIndicesSegments (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html) request * @@ -79,17 +79,17 @@ function buildIndicesSegments (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,36 +108,8 @@ function buildIndicesSegments (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index 35d5924b8..dccc29561 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -24,7 +24,7 @@ function buildIndicesShardStores (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.shard_stores](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html) request * @@ -79,17 +79,17 @@ function buildIndicesShardStores (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,36 +108,8 @@ function buildIndicesShardStores (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index c746add6b..b3e42dcbe 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -24,7 +24,7 @@ function buildIndicesShrink (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.shrink](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html) request * @@ -88,17 +88,17 @@ function buildIndicesShrink (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, target } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'target']) + var warnings = [] + var { method, body, index, target, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,36 +113,8 @@ function buildIndicesShrink (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.split.js b/api/api/indices.split.js index 50f2501a0..bbf9c25e9 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -24,7 +24,7 @@ function buildIndicesSplit (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.split](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html) request * @@ -88,17 +88,17 @@ function buildIndicesSplit (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, target } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'target']) + var warnings = [] + var { method, body, index, target, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,36 +113,8 @@ function buildIndicesSplit (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index bc0524bc8..581dd8815 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -24,7 +24,7 @@ function buildIndicesStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html) request * @@ -95,17 +95,17 @@ function buildIndicesStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, metric } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'metric']) + var warnings = [] + var { method, body, index, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,36 +128,8 @@ function buildIndicesStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index 81a55968f..6004938fa 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -24,7 +24,7 @@ function buildIndicesUnfreeze (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.unfreeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request * @@ -82,17 +82,17 @@ function buildIndicesUnfreeze (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildIndicesUnfreeze (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index 5c83d0798..69836c820 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -24,7 +24,7 @@ function buildIndicesUpdateAliases (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.update_aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -73,17 +73,17 @@ function buildIndicesUpdateAliases (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -98,36 +98,8 @@ function buildIndicesUpdateAliases (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index bae33c59a..72cba50ca 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -24,7 +24,7 @@ function buildIndicesUpgrade (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request * @@ -83,17 +83,17 @@ function buildIndicesUpgrade (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildIndicesUpgrade (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 3dea50479..4615cd2eb 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -24,7 +24,7 @@ function buildIndicesValidateQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.validate_query](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html) request * @@ -100,17 +100,17 @@ function buildIndicesValidateQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -131,36 +131,8 @@ function buildIndicesValidateQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/info.js b/api/api/info.js index 0d5eb79e1..b43a6c1d3 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -24,7 +24,7 @@ function buildInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [info](http://www.elastic.co/guide/) request * @@ -67,17 +67,17 @@ function buildInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index 68a8479c4..a03e89b05 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -24,7 +24,7 @@ function buildIngestDeletePipeline (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.delete_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html) request * @@ -77,17 +77,17 @@ function buildIngestDeletePipeline (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildIngestDeletePipeline (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index 29a01d7ab..ce094a2c4 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -24,7 +24,7 @@ function buildIngestGetPipeline (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.get_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html) request * @@ -71,17 +71,17 @@ function buildIngestGetPipeline (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,36 +100,8 @@ function buildIngestGetPipeline (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index 679fbadbc..697356aa9 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -24,7 +24,7 @@ function buildIngestProcessorGrok (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.processor_grok](https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get) request * @@ -67,17 +67,17 @@ function buildIngestProcessorGrok (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildIngestProcessorGrok (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index 6e2940b7b..f20822d7d 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -24,7 +24,7 @@ function buildIngestPutPipeline (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.put_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html) request * @@ -78,17 +78,17 @@ function buildIngestPutPipeline (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildIngestPutPipeline (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index c8f83721e..7a1374d31 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -24,7 +24,7 @@ function buildIngestSimulate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.simulate](https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html) request * @@ -71,17 +71,17 @@ function buildIngestSimulate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,36 +100,8 @@ function buildIngestSimulate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.delete.js b/api/api/license.delete.js index fdf2efbc6..cce9d75e5 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -24,7 +24,7 @@ function buildLicenseDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.delete](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html) request * @@ -62,17 +62,17 @@ function buildLicenseDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildLicenseDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.get.js b/api/api/license.get.js index 57266aa82..ae139fffd 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -24,7 +24,7 @@ function buildLicenseGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.get](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html) request * @@ -63,17 +63,17 @@ function buildLicenseGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildLicenseGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index cccf3ffef..ec41252bf 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -24,7 +24,7 @@ function buildLicenseGetBasicStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.get_basic_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html) request * @@ -62,17 +62,17 @@ function buildLicenseGetBasicStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildLicenseGetBasicStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index dcc9091cc..af6b35917 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -24,7 +24,7 @@ function buildLicenseGetTrialStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.get_trial_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html) request * @@ -62,17 +62,17 @@ function buildLicenseGetTrialStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildLicenseGetTrialStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.post.js b/api/api/license.post.js index b29cb4d32..0c1ac7d07 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -24,7 +24,7 @@ function buildLicensePost (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.post](https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html) request * @@ -58,17 +58,17 @@ function buildLicensePost (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -83,36 +83,8 @@ function buildLicensePost (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index 272e61fc4..5fa1373fb 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -24,7 +24,7 @@ function buildLicensePostStartBasic (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.post_start_basic](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html) request * @@ -63,17 +63,17 @@ function buildLicensePostStartBasic (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildLicensePostStartBasic (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index 79207341f..d68c00f90 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -24,7 +24,7 @@ function buildLicensePostStartTrial (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.post_start_trial](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html) request * @@ -65,17 +65,17 @@ function buildLicensePostStartTrial (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -90,36 +90,8 @@ function buildLicensePostStartTrial (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/mget.js b/api/api/mget.js index 14b29eaf4..7a0b5ee4c 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -24,7 +24,7 @@ function buildMget (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [mget](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html) request * @@ -95,17 +95,17 @@ function buildMget (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -126,36 +126,8 @@ function buildMget (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index 727d3a5ba..e074c1bdb 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -24,7 +24,7 @@ function buildMigrationDeprecations (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [migration.deprecations](http://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-deprecation.html) request * @@ -63,17 +63,17 @@ function buildMigrationDeprecations (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildMigrationDeprecations (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.close_job.js b/api/api/ml.close_job.js index ec61d7008..361d14971 100644 --- a/api/api/ml.close_job.js +++ b/api/api/ml.close_job.js @@ -24,7 +24,7 @@ function buildMlCloseJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request * @@ -70,17 +70,17 @@ function buildMlCloseJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,36 +95,8 @@ function buildMlCloseJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js index dc94d6b92..71f7505f8 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/ml.delete_calendar.js @@ -24,7 +24,7 @@ function buildMlDeleteCalendar (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_calendar](undefined) request * @@ -67,17 +67,17 @@ function buildMlDeleteCalendar (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildMlDeleteCalendar (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js index 4846c13fe..cd4d751d3 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/ml.delete_calendar_event.js @@ -24,7 +24,7 @@ function buildMlDeleteCalendarEvent (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_calendar_event](undefined) request * @@ -78,17 +78,17 @@ function buildMlDeleteCalendarEvent (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id, eventId, event_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'eventId', 'event_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, eventId, event_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildMlDeleteCalendarEvent (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js index 27ebb4341..19823d1af 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/ml.delete_calendar_job.js @@ -24,7 +24,7 @@ function buildMlDeleteCalendarJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_calendar_job](undefined) request * @@ -78,17 +78,17 @@ function buildMlDeleteCalendarJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'jobId', 'job_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildMlDeleteCalendarJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js index 5350874cb..e245dbbb7 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/ml.delete_datafeed.js @@ -24,7 +24,7 @@ function buildMlDeleteDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request * @@ -68,17 +68,17 @@ function buildMlDeleteDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlDeleteDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js index d28a54756..c2c5edca7 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/ml.delete_expired_data.js @@ -24,7 +24,7 @@ function buildMlDeleteExpiredData (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_expired_data](undefined) request * @@ -62,17 +62,17 @@ function buildMlDeleteExpiredData (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildMlDeleteExpiredData (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js index e14c6004a..46ae221ab 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/ml.delete_filter.js @@ -24,7 +24,7 @@ function buildMlDeleteFilter (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_filter](undefined) request * @@ -67,17 +67,17 @@ function buildMlDeleteFilter (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildMlDeleteFilter (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js index 61578af3c..1b6616590 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/ml.delete_forecast.js @@ -24,7 +24,7 @@ function buildMlDeleteForecast (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_forecast](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html) request * @@ -78,17 +78,17 @@ function buildMlDeleteForecast (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, forecastId, forecast_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'forecastId', 'forecast_id']) + var warnings = [] + var { method, body, jobId, job_id, forecastId, forecast_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildMlDeleteForecast (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js index 2dab49868..dae7db48c 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/ml.delete_job.js @@ -24,7 +24,7 @@ function buildMlDeleteJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request * @@ -70,17 +70,17 @@ function buildMlDeleteJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,36 +95,8 @@ function buildMlDeleteJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js index ee7e86377..6f5cb1c43 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/ml.delete_model_snapshot.js @@ -24,7 +24,7 @@ function buildMlDeleteModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request * @@ -78,17 +78,17 @@ function buildMlDeleteModelSnapshot (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildMlDeleteModelSnapshot (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index 1e6de545e..eee5b0e56 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -24,7 +24,7 @@ function buildMlFindFileStructure (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html) request * @@ -95,17 +95,17 @@ function buildMlFindFileStructure (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -120,36 +120,8 @@ function buildMlFindFileStructure (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js index f2b062ee2..670aa49a5 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/ml.flush_job.js @@ -24,7 +24,7 @@ function buildMlFlushJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request * @@ -75,17 +75,17 @@ function buildMlFlushJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,36 +100,8 @@ function buildMlFlushJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js index 065d17c6c..ce19e9e65 100644 --- a/api/api/ml.forecast.js +++ b/api/api/ml.forecast.js @@ -24,7 +24,7 @@ function buildMlForecast (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.forecast](undefined) request * @@ -70,17 +70,17 @@ function buildMlForecast (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,36 +95,8 @@ function buildMlForecast (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js index f00ae7a47..4e8a3e68d 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/ml.get_buckets.js @@ -24,7 +24,7 @@ function buildMlGetBuckets (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request * @@ -90,17 +90,17 @@ function buildMlGetBuckets (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, timestamp } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'timestamp']) + var warnings = [] + var { method, body, jobId, job_id, timestamp, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,36 +119,8 @@ function buildMlGetBuckets (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js index 85540eb2a..45752948d 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/ml.get_calendar_events.js @@ -24,7 +24,7 @@ function buildMlGetCalendarEvents (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_calendar_events](undefined) request * @@ -77,17 +77,17 @@ function buildMlGetCalendarEvents (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildMlGetCalendarEvents (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 71d9b2771..549f5530f 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -24,7 +24,7 @@ function buildMlGetCalendars (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_calendars](undefined) request * @@ -61,17 +61,17 @@ function buildMlGetCalendars (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -90,36 +90,8 @@ function buildMlGetCalendars (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js index 8ee43bac5..381ebb54c 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/ml.get_categories.js @@ -24,7 +24,7 @@ function buildMlGetCategories (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request * @@ -68,17 +68,17 @@ function buildMlGetCategories (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, categoryId, category_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'categoryId', 'category_id']) + var warnings = [] + var { method, body, jobId, job_id, categoryId, category_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,36 +97,8 @@ function buildMlGetCategories (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js index d7dd811aa..4f042ce05 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/ml.get_datafeed_stats.js @@ -24,7 +24,7 @@ function buildMlGetDatafeedStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request * @@ -64,17 +64,17 @@ function buildMlGetDatafeedStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlGetDatafeedStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js index 6135237cb..709418c6a 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/ml.get_datafeeds.js @@ -24,7 +24,7 @@ function buildMlGetDatafeeds (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request * @@ -64,17 +64,17 @@ function buildMlGetDatafeeds (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlGetDatafeeds (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js index 3c83a37f8..bac797feb 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/ml.get_filters.js @@ -24,7 +24,7 @@ function buildMlGetFilters (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_filters](undefined) request * @@ -66,17 +66,17 @@ function buildMlGetFilters (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,36 +95,8 @@ function buildMlGetFilters (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js index 6ce303a12..e128965d1 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/ml.get_influencers.js @@ -24,7 +24,7 @@ function buildMlGetInfluencers (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request * @@ -81,17 +81,17 @@ function buildMlGetInfluencers (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,36 +106,8 @@ function buildMlGetInfluencers (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js index 8b5a68e27..af2096023 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/ml.get_job_stats.js @@ -24,7 +24,7 @@ function buildMlGetJobStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request * @@ -64,17 +64,17 @@ function buildMlGetJobStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlGetJobStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js index 688334416..a61691dff 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/ml.get_jobs.js @@ -24,7 +24,7 @@ function buildMlGetJobs (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request * @@ -64,17 +64,17 @@ function buildMlGetJobs (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlGetJobs (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js index 7bfa74eb3..efc1b770c 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/ml.get_model_snapshots.js @@ -24,7 +24,7 @@ function buildMlGetModelSnapshots (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request * @@ -82,17 +82,17 @@ function buildMlGetModelSnapshots (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildMlGetModelSnapshots (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js index e6ee6338c..03798dbe4 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/ml.get_overall_buckets.js @@ -24,7 +24,7 @@ function buildMlGetOverallBuckets (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request * @@ -81,17 +81,17 @@ function buildMlGetOverallBuckets (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,36 +106,8 @@ function buildMlGetOverallBuckets (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js index 5bcfbe7b0..00cdbf7ec 100644 --- a/api/api/ml.get_records.js +++ b/api/api/ml.get_records.js @@ -24,7 +24,7 @@ function buildMlGetRecords (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request * @@ -81,17 +81,17 @@ function buildMlGetRecords (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,36 +106,8 @@ function buildMlGetRecords (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.info.js b/api/api/ml.info.js index b53019e0e..f21bbc95d 100644 --- a/api/api/ml.info.js +++ b/api/api/ml.info.js @@ -24,7 +24,7 @@ function buildMlInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.info](undefined) request * @@ -56,17 +56,17 @@ function buildMlInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -81,36 +81,8 @@ function buildMlInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js index ec9a3268f..a5bb89244 100644 --- a/api/api/ml.open_job.js +++ b/api/api/ml.open_job.js @@ -24,7 +24,7 @@ function buildMlOpenJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request * @@ -69,17 +69,17 @@ function buildMlOpenJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, ignoreDowntime, ignore_downtime, timeout } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'ignoreDowntime', 'ignore_downtime', 'timeout']) + var warnings = [] + var { method, body, jobId, job_id, ignoreDowntime, ignore_downtime, timeout, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildMlOpenJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js index e671d27f9..17112d594 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/ml.post_calendar_events.js @@ -24,7 +24,7 @@ function buildMlPostCalendarEvents (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.post_calendar_events](undefined) request * @@ -68,17 +68,17 @@ function buildMlPostCalendarEvents (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlPostCalendarEvents (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js index 5f500c989..54d5dba4d 100644 --- a/api/api/ml.post_data.js +++ b/api/api/ml.post_data.js @@ -24,7 +24,7 @@ function buildMlPostData (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request * @@ -72,17 +72,17 @@ function buildMlPostData (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,36 +97,8 @@ function buildMlPostData (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js index 4a09368a1..e4e64c0f6 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/ml.preview_datafeed.js @@ -24,7 +24,7 @@ function buildMlPreviewDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request * @@ -67,17 +67,17 @@ function buildMlPreviewDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildMlPreviewDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js index 5f469ac85..f3bf2a1a6 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/ml.put_calendar.js @@ -24,7 +24,7 @@ function buildMlPutCalendar (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_calendar](undefined) request * @@ -64,17 +64,17 @@ function buildMlPutCalendar (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,36 +89,8 @@ function buildMlPutCalendar (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js index 4af04e926..87fecf728 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/ml.put_calendar_job.js @@ -24,7 +24,7 @@ function buildMlPutCalendarJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_calendar_job](undefined) request * @@ -78,17 +78,17 @@ function buildMlPutCalendarJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'jobId', 'job_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildMlPutCalendarJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js index d7da534fe..14745042c 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/ml.put_datafeed.js @@ -24,7 +24,7 @@ function buildMlPutDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request * @@ -68,17 +68,17 @@ function buildMlPutDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlPutDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js index 6f423c071..3ce82f6b8 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/ml.put_filter.js @@ -24,7 +24,7 @@ function buildMlPutFilter (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_filter](undefined) request * @@ -68,17 +68,17 @@ function buildMlPutFilter (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlPutFilter (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js index fa78d3239..45ce0d481 100644 --- a/api/api/ml.put_job.js +++ b/api/api/ml.put_job.js @@ -24,7 +24,7 @@ function buildMlPutJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request * @@ -68,17 +68,17 @@ function buildMlPutJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlPutJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js index 162a2682c..9b9f7b3d4 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/ml.revert_model_snapshot.js @@ -24,7 +24,7 @@ function buildMlRevertModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.revert_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html) request * @@ -76,17 +76,17 @@ function buildMlRevertModelSnapshot (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -101,36 +101,8 @@ function buildMlRevertModelSnapshot (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js index d095c71f0..cae1b7cbf 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/ml.set_upgrade_mode.js @@ -24,7 +24,7 @@ function buildMlSetUpgradeMode (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.set_upgrade_mode](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html) request * @@ -65,17 +65,17 @@ function buildMlSetUpgradeMode (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -90,36 +90,8 @@ function buildMlSetUpgradeMode (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js index 9ae986cf7..ade441af4 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/ml.start_datafeed.js @@ -24,7 +24,7 @@ function buildMlStartDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.start_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html) request * @@ -69,17 +69,17 @@ function buildMlStartDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildMlStartDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js index 8e684ae2c..61ce3876d 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/ml.stop_datafeed.js @@ -24,7 +24,7 @@ function buildMlStopDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.stop_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html) request * @@ -69,17 +69,17 @@ function buildMlStopDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildMlStopDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js index 7e5447521..492310dfa 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/ml.update_datafeed.js @@ -24,7 +24,7 @@ function buildMlUpdateDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html) request * @@ -68,17 +68,17 @@ function buildMlUpdateDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlUpdateDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js index f8de4abc7..03e03b014 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/ml.update_filter.js @@ -24,7 +24,7 @@ function buildMlUpdateFilter (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_filter](undefined) request * @@ -68,17 +68,17 @@ function buildMlUpdateFilter (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlUpdateFilter (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js index c34144cd3..d51325d13 100644 --- a/api/api/ml.update_job.js +++ b/api/api/ml.update_job.js @@ -24,7 +24,7 @@ function buildMlUpdateJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html) request * @@ -68,17 +68,17 @@ function buildMlUpdateJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildMlUpdateJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js index e0dc3043f..117cb7fb0 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/ml.update_model_snapshot.js @@ -24,7 +24,7 @@ function buildMlUpdateModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html) request * @@ -79,17 +79,17 @@ function buildMlUpdateModelSnapshot (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildMlUpdateModelSnapshot (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js index 256da469a..3f3ca43f4 100644 --- a/api/api/ml.validate.js +++ b/api/api/ml.validate.js @@ -24,7 +24,7 @@ function buildMlValidate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.validate](undefined) request * @@ -63,17 +63,17 @@ function buildMlValidate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildMlValidate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js index 4540ff1d5..8dcea86d3 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/ml.validate_detector.js @@ -24,7 +24,7 @@ function buildMlValidateDetector (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.validate_detector](undefined) request * @@ -63,17 +63,17 @@ function buildMlValidateDetector (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildMlValidateDetector (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 96a7caba3..872e48e1d 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -24,7 +24,7 @@ function buildMonitoringBulk (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [monitoring.bulk](https://www.elastic.co/guide/en/elasticsearch/reference/master/es-monitoring.html) request * @@ -71,17 +71,17 @@ function buildMonitoringBulk (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, type } = params - var querystring = semicopy(params, ['method', 'body', 'type']) + var warnings = [] + var { method, body, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,36 +100,8 @@ function buildMonitoringBulk (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/msearch.js b/api/api/msearch.js index 1bf456a67..668ec0a6f 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -24,7 +24,7 @@ function buildMsearch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request * @@ -97,17 +97,17 @@ function buildMsearch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,36 +128,8 @@ function buildMsearch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 7d877463d..2a6cb3514 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -24,7 +24,7 @@ function buildMsearchTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request * @@ -91,17 +91,17 @@ function buildMsearchTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -122,36 +122,8 @@ function buildMsearchTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index a46362de3..92d14c93c 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -24,7 +24,7 @@ function buildMtermvectors (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request * @@ -99,17 +99,17 @@ function buildMtermvectors (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -130,36 +130,8 @@ function buildMtermvectors (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 330bc47ba..44e3688f7 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -24,7 +24,7 @@ function buildNodesHotThreads (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.hot_threads](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html) request * @@ -81,17 +81,17 @@ function buildNodesHotThreads (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,36 +116,8 @@ function buildNodesHotThreads (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index 4e27f08ff..26e7421ea 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -24,7 +24,7 @@ function buildNodesInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html) request * @@ -74,17 +74,17 @@ function buildNodesInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id, metric } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id', 'metric']) + var warnings = [] + var { method, body, nodeId, node_id, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildNodesInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index 7753eb77e..948910a44 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -24,7 +24,7 @@ function buildNodesReloadSecureSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.reload_secure_settings](https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings) request * @@ -70,17 +70,17 @@ function buildNodesReloadSecureSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -99,36 +99,8 @@ function buildNodesReloadSecureSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index 04425a8fb..7a8a1db36 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -24,7 +24,7 @@ function buildNodesStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html) request * @@ -89,17 +89,17 @@ function buildNodesStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, metric, indexMetric, index_metric, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'metric', 'indexMetric', 'index_metric', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, metric, indexMetric, index_metric, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -126,36 +126,8 @@ function buildNodesStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index 1d62545be..159b09f7c 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -24,7 +24,7 @@ function buildNodesUsage (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.usage](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html) request * @@ -71,17 +71,17 @@ function buildNodesUsage (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, metric, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'metric', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, metric, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildNodesUsage (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ping.js b/api/api/ping.js index 71a0dc79e..7aa59fb5e 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -24,7 +24,7 @@ function buildPing (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ping](http://www.elastic.co/guide/) request * @@ -67,17 +67,17 @@ function buildPing (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildPing (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/put_script.js b/api/api/put_script.js index 9ffd1db70..9f17d8316 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -24,7 +24,7 @@ function buildPutScript (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [put_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request * @@ -87,17 +87,17 @@ function buildPutScript (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, context } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'context']) + var warnings = [] + var { method, body, id, context, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,36 +116,8 @@ function buildPutScript (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index df81a0385..98242a4cd 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -24,7 +24,7 @@ function buildRankEval (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rank_eval](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html) request * @@ -78,17 +78,17 @@ function buildRankEval (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,36 +107,8 @@ function buildRankEval (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/reindex.js b/api/api/reindex.js index c1286f6af..85722b4ce 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -24,7 +24,7 @@ function buildReindex (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) request * @@ -85,17 +85,17 @@ function buildReindex (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -110,36 +110,8 @@ function buildReindex (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 2a24b921b..7f9e0bc67 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -24,7 +24,7 @@ function buildReindexRethrottle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [reindex_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) request * @@ -79,17 +79,17 @@ function buildReindexRethrottle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildReindexRethrottle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 0564ba781..9ec822538 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -24,7 +24,7 @@ function buildRenderSearchTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [render_search_template](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request * @@ -63,17 +63,17 @@ function buildRenderSearchTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildRenderSearchTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index b0a06fdb5..a6d7b8800 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -24,7 +24,7 @@ function buildRollupDeleteJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.delete_job]() request * @@ -63,17 +63,17 @@ function buildRollupDeleteJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildRollupDeleteJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index cb1da9051..8bb1f2e71 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -24,7 +24,7 @@ function buildRollupGetJobs (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.get_jobs]() request * @@ -57,17 +57,17 @@ function buildRollupGetJobs (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -86,36 +86,8 @@ function buildRollupGetJobs (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index 3d24fbbaf..b0e8d288c 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -24,7 +24,7 @@ function buildRollupGetRollupCaps (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.get_rollup_caps]() request * @@ -57,17 +57,17 @@ function buildRollupGetRollupCaps (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -86,36 +86,8 @@ function buildRollupGetRollupCaps (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index 54f161dc9..cde9a275a 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -24,7 +24,7 @@ function buildRollupGetRollupIndexCaps (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.get_rollup_index_caps]() request * @@ -63,17 +63,17 @@ function buildRollupGetRollupIndexCaps (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildRollupGetRollupIndexCaps (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index cc8701e7f..b117f198c 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -24,7 +24,7 @@ function buildRollupPutJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.put_job]() request * @@ -68,17 +68,17 @@ function buildRollupPutJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildRollupPutJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 4329cd2d9..4310e49f9 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -24,7 +24,7 @@ function buildRollupRollupSearch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.rollup_search]() request * @@ -79,17 +79,17 @@ function buildRollupRollupSearch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,36 +108,8 @@ function buildRollupRollupSearch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index ced1af7fa..bf39647a7 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -24,7 +24,7 @@ function buildRollupStartJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.start_job]() request * @@ -63,17 +63,17 @@ function buildRollupStartJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildRollupStartJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index 856bdfe09..e4b2e1cc2 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -24,7 +24,7 @@ function buildRollupStopJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.stop_job]() request * @@ -67,17 +67,17 @@ function buildRollupStopJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildRollupStopJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js index 0ef7d852a..b10b63ac9 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/scripts_painless_context.js @@ -24,7 +24,7 @@ function buildScriptsPainlessContext (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [scripts_painless_context](undefined) request * @@ -63,17 +63,17 @@ function buildScriptsPainlessContext (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildScriptsPainlessContext (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index 231a3e461..db99454e1 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -24,7 +24,7 @@ function buildScriptsPainlessExecute (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [scripts_painless_execute](https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html) request * @@ -62,17 +62,17 @@ function buildScriptsPainlessExecute (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildScriptsPainlessExecute (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/scroll.js b/api/api/scroll.js index 565b0925b..fd9e518c1 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -24,7 +24,7 @@ function buildScroll (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request * @@ -71,17 +71,17 @@ function buildScroll (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, scrollId, scroll_id } = params - var querystring = semicopy(params, ['method', 'body', 'scrollId', 'scroll_id']) + var warnings = [] + var { method, body, scrollId, scroll_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,36 +100,8 @@ function buildScroll (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/search.js b/api/api/search.js index a4c73501e..6a1726ee0 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -24,7 +24,7 @@ function buildSearch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * @@ -181,17 +181,17 @@ function buildSearch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -212,36 +212,8 @@ function buildSearch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/search_shards.js b/api/api/search_shards.js index bae036cef..b819d66b2 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -24,7 +24,7 @@ function buildSearchShards (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search_shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html) request * @@ -83,17 +83,17 @@ function buildSearchShards (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildSearchShards (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/search_template.js b/api/api/search_template.js index 3a81eeba3..5b6d53853 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -24,7 +24,7 @@ function buildSearchTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * @@ -110,17 +110,17 @@ function buildSearchTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -141,36 +141,8 @@ function buildSearchTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js index 0a144693a..c2f5ea868 100644 --- a/api/api/security.authenticate.js +++ b/api/api/security.authenticate.js @@ -24,7 +24,7 @@ function buildSecurityAuthenticate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.authenticate](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html) request * @@ -62,17 +62,17 @@ function buildSecurityAuthenticate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildSecurityAuthenticate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js index 3a78e5825..831f013a7 100644 --- a/api/api/security.change_password.js +++ b/api/api/security.change_password.js @@ -24,7 +24,7 @@ function buildSecurityChangePassword (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.change_password](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html) request * @@ -65,17 +65,17 @@ function buildSecurityChangePassword (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildSecurityChangePassword (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js index aab70cec5..b5483c8c4 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/security.clear_cached_realms.js @@ -24,7 +24,7 @@ function buildSecurityClearCachedRealms (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.clear_cached_realms](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html) request * @@ -68,17 +68,17 @@ function buildSecurityClearCachedRealms (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, realms } = params - var querystring = semicopy(params, ['method', 'body', 'realms']) + var warnings = [] + var { method, body, realms, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityClearCachedRealms (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js index c23b1c66e..13eee568b 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/security.clear_cached_roles.js @@ -24,7 +24,7 @@ function buildSecurityClearCachedRoles (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.clear_cached_roles](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html) request * @@ -67,17 +67,17 @@ function buildSecurityClearCachedRoles (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildSecurityClearCachedRoles (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js index a2e0cd315..a2e6a2e29 100644 --- a/api/api/security.create_api_key.js +++ b/api/api/security.create_api_key.js @@ -24,7 +24,7 @@ function buildSecurityCreateApiKey (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.create_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html) request * @@ -64,17 +64,17 @@ function buildSecurityCreateApiKey (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,36 +89,8 @@ function buildSecurityCreateApiKey (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.delete_privileges.js b/api/api/security.delete_privileges.js index e64714740..72efa3bdd 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/security.delete_privileges.js @@ -24,7 +24,7 @@ function buildSecurityDeletePrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_privileges](TODO) request * @@ -79,17 +79,17 @@ function buildSecurityDeletePrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, application, name } = params - var querystring = semicopy(params, ['method', 'body', 'application', 'name']) + var warnings = [] + var { method, body, application, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildSecurityDeletePrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js index 96ea78039..6401406c1 100644 --- a/api/api/security.delete_role.js +++ b/api/api/security.delete_role.js @@ -24,7 +24,7 @@ function buildSecurityDeleteRole (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html) request * @@ -68,17 +68,17 @@ function buildSecurityDeleteRole (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityDeleteRole (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js index 208c950fa..b9f69494c 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/security.delete_role_mapping.js @@ -24,7 +24,7 @@ function buildSecurityDeleteRoleMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html) request * @@ -68,17 +68,17 @@ function buildSecurityDeleteRoleMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityDeleteRoleMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js index 3e176ea8d..da25eda5e 100644 --- a/api/api/security.delete_user.js +++ b/api/api/security.delete_user.js @@ -24,7 +24,7 @@ function buildSecurityDeleteUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html) request * @@ -68,17 +68,17 @@ function buildSecurityDeleteUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityDeleteUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index 3c7d3c000..c12de072d 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -24,7 +24,7 @@ function buildSecurityDisableUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.disable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html) request * @@ -68,17 +68,17 @@ function buildSecurityDisableUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityDisableUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index 2b044b3a5..b59558acb 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -24,7 +24,7 @@ function buildSecurityEnableUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.enable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html) request * @@ -68,17 +68,17 @@ function buildSecurityEnableUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityEnableUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js index eb8af6ea9..eea2eb066 100644 --- a/api/api/security.get_api_key.js +++ b/api/api/security.get_api_key.js @@ -24,7 +24,7 @@ function buildSecurityGetApiKey (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html) request * @@ -69,17 +69,17 @@ function buildSecurityGetApiKey (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildSecurityGetApiKey (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index f7e697124..5bea2a86c 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -24,7 +24,7 @@ function buildSecurityGetPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_privileges](TODO) request * @@ -70,17 +70,17 @@ function buildSecurityGetPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, application, name } = params - var querystring = semicopy(params, ['method', 'body', 'application', 'name']) + var warnings = [] + var { method, body, application, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -101,36 +101,8 @@ function buildSecurityGetPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js index ca9e9a542..f4c757bf6 100644 --- a/api/api/security.get_role.js +++ b/api/api/security.get_role.js @@ -24,7 +24,7 @@ function buildSecurityGetRole (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html) request * @@ -63,17 +63,17 @@ function buildSecurityGetRole (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildSecurityGetRole (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js index 77c43e053..fc58769f6 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/security.get_role_mapping.js @@ -24,7 +24,7 @@ function buildSecurityGetRoleMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html) request * @@ -63,17 +63,17 @@ function buildSecurityGetRoleMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildSecurityGetRoleMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js index b397e77cd..1f4c8c761 100644 --- a/api/api/security.get_token.js +++ b/api/api/security.get_token.js @@ -24,7 +24,7 @@ function buildSecurityGetToken (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html) request * @@ -63,17 +63,17 @@ function buildSecurityGetToken (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildSecurityGetToken (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js index d8bb47568..590661f6b 100644 --- a/api/api/security.get_user.js +++ b/api/api/security.get_user.js @@ -24,7 +24,7 @@ function buildSecurityGetUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html) request * @@ -63,17 +63,17 @@ function buildSecurityGetUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildSecurityGetUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index fdf7e5168..dc8e3f803 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -24,7 +24,7 @@ function buildSecurityGetUserPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_user_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html) request * @@ -62,17 +62,17 @@ function buildSecurityGetUserPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildSecurityGetUserPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js index 22c4c6cf1..cea2e5a13 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/security.has_privileges.js @@ -24,7 +24,7 @@ function buildSecurityHasPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.has_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html) request * @@ -64,17 +64,17 @@ function buildSecurityHasPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, user } = params - var querystring = semicopy(params, ['method', 'body', 'user']) + var warnings = [] + var { method, body, user, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,36 +93,8 @@ function buildSecurityHasPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js index 983ef2ac8..16f0bf3f1 100644 --- a/api/api/security.invalidate_api_key.js +++ b/api/api/security.invalidate_api_key.js @@ -24,7 +24,7 @@ function buildSecurityInvalidateApiKey (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.invalidate_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html) request * @@ -63,17 +63,17 @@ function buildSecurityInvalidateApiKey (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildSecurityInvalidateApiKey (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.invalidate_token.js b/api/api/security.invalidate_token.js index 98e6eb702..262d82ce4 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/security.invalidate_token.js @@ -24,7 +24,7 @@ function buildSecurityInvalidateToken (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.invalidate_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html) request * @@ -63,17 +63,17 @@ function buildSecurityInvalidateToken (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildSecurityInvalidateToken (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js index 4de0d967f..80cf7976f 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/security.put_privileges.js @@ -24,7 +24,7 @@ function buildSecurityPutPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_privileges](TODO) request * @@ -64,17 +64,17 @@ function buildSecurityPutPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,36 +89,8 @@ function buildSecurityPutPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js index 388ff9709..62d8dae4d 100644 --- a/api/api/security.put_role.js +++ b/api/api/security.put_role.js @@ -24,7 +24,7 @@ function buildSecurityPutRole (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html) request * @@ -69,17 +69,17 @@ function buildSecurityPutRole (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildSecurityPutRole (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index 8b3847096..091d7b477 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -24,7 +24,7 @@ function buildSecurityPutRoleMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html) request * @@ -69,17 +69,17 @@ function buildSecurityPutRoleMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildSecurityPutRoleMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js index 9703b86fd..7b8b04f54 100644 --- a/api/api/security.put_user.js +++ b/api/api/security.put_user.js @@ -24,7 +24,7 @@ function buildSecurityPutUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html) request * @@ -69,17 +69,17 @@ function buildSecurityPutUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,36 +94,8 @@ function buildSecurityPutUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index a54cc4b8e..d11ff8931 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -24,7 +24,7 @@ function buildSnapshotCreate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -86,17 +86,17 @@ function buildSnapshotCreate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildSnapshotCreate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index 7d06c4135..c779a0f07 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -24,7 +24,7 @@ function buildSnapshotCreateRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.create_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -80,17 +80,17 @@ function buildSnapshotCreateRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -105,36 +105,8 @@ function buildSnapshotCreateRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index 86e090012..a7338d088 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -24,7 +24,7 @@ function buildSnapshotDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -86,17 +86,17 @@ function buildSnapshotDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildSnapshotDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index 48aa929e1..af9c5a287 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -24,7 +24,7 @@ function buildSnapshotDeleteRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.delete_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -77,17 +77,17 @@ function buildSnapshotDeleteRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildSnapshotDeleteRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index 621f7417c..86a18d362 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -24,7 +24,7 @@ function buildSnapshotGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -91,17 +91,17 @@ function buildSnapshotGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,36 +116,8 @@ function buildSnapshotGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index ae7d9fcdc..3de7b4b7e 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -24,7 +24,7 @@ function buildSnapshotGetRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.get_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -73,17 +73,17 @@ function buildSnapshotGetRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildSnapshotGetRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 217bb7fef..5694aa4ec 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -24,7 +24,7 @@ function buildSnapshotRestore (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.restore](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -86,17 +86,17 @@ function buildSnapshotRestore (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,36 +111,8 @@ function buildSnapshotRestore (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index bf15fa342..6a8213b16 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -24,7 +24,7 @@ function buildSnapshotStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.status](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -81,17 +81,17 @@ function buildSnapshotStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,36 +112,8 @@ function buildSnapshotStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index 0bb67a727..fcf6a1caa 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -24,7 +24,7 @@ function buildSnapshotVerifyRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.verify_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -77,17 +77,17 @@ function buildSnapshotVerifyRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildSnapshotVerifyRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index fccf6ba8d..ab620ca6a 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -24,7 +24,7 @@ function buildSqlClearCursor (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [sql.clear_cursor](Clear SQL cursor) request * @@ -63,17 +63,17 @@ function buildSqlClearCursor (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildSqlClearCursor (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 2bcd7f6e7..87246c23e 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -24,7 +24,7 @@ function buildSqlQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [sql.query](Execute SQL) request * @@ -64,17 +64,17 @@ function buildSqlQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,36 +89,8 @@ function buildSqlQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index 6b5147bb4..cb5d62754 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -24,7 +24,7 @@ function buildSqlTranslate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [sql.translate](Translate SQL into Elasticsearch queries) request * @@ -63,17 +63,17 @@ function buildSqlTranslate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildSqlTranslate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/ssl.certificates.js b/api/api/ssl.certificates.js index 8bf875df8..706bf117d 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/ssl.certificates.js @@ -24,7 +24,7 @@ function buildSslCertificates (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ssl.certificates](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html) request * @@ -62,17 +62,17 @@ function buildSslCertificates (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildSslCertificates (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 6e674b2b2..1dbd66ac4 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -24,7 +24,7 @@ function buildTasksCancel (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [tasks.cancel](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -75,17 +75,17 @@ function buildTasksCancel (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildTasksCancel (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index c3435158f..d4e886adb 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -24,7 +24,7 @@ function buildTasksGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [tasks.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -77,17 +77,17 @@ function buildTasksGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,36 +102,8 @@ function buildTasksGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index 9d74e774d..e8a69211f 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -24,7 +24,7 @@ function buildTasksList (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [tasks.list](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -84,17 +84,17 @@ function buildTasksList (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -109,36 +109,8 @@ function buildTasksList (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/termvectors.js b/api/api/termvectors.js index d2942bc23..93092d9f9 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -24,7 +24,7 @@ function buildTermvectors (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [termvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html) request * @@ -98,17 +98,17 @@ function buildTermvectors (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type, id } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'id']) + var warnings = [] + var { method, body, index, type, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -131,36 +131,8 @@ function buildTermvectors (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/update.js b/api/api/update.js index 6584905ca..615a07aea 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -24,7 +24,7 @@ function buildUpdate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [update](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html) request * @@ -109,17 +109,17 @@ function buildUpdate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -138,36 +138,8 @@ function buildUpdate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index ac34e44db..7d7d7bc47 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -24,7 +24,7 @@ function buildUpdateByQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html) request * @@ -160,17 +160,17 @@ function buildUpdateByQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -189,36 +189,8 @@ function buildUpdateByQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index 050feed99..59a72a6e5 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -24,7 +24,7 @@ function buildUpdateByQueryRethrottle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [update_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html) request * @@ -79,17 +79,17 @@ function buildUpdateByQueryRethrottle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,36 +104,8 @@ function buildUpdateByQueryRethrottle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index cc385c644..323ba16d7 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -24,7 +24,7 @@ function buildWatcherAckWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request * @@ -74,17 +74,17 @@ function buildWatcherAckWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, watchId, watch_id, actionId, action_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id', 'actionId', 'action_id']) + var warnings = [] + var { method, body, watchId, watch_id, actionId, action_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,36 +103,8 @@ function buildWatcherAckWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index 6823f734b..31640579a 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -24,7 +24,7 @@ function buildWatcherActivateWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request * @@ -67,17 +67,17 @@ function buildWatcherActivateWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, watchId, watch_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id']) + var warnings = [] + var { method, body, watchId, watch_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildWatcherActivateWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index 5d089ca4b..54501a2f0 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -24,7 +24,7 @@ function buildWatcherDeactivateWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request * @@ -67,17 +67,17 @@ function buildWatcherDeactivateWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, watchId, watch_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id']) + var warnings = [] + var { method, body, watchId, watch_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildWatcherDeactivateWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index 21d41e1c9..1e7add318 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -24,7 +24,7 @@ function buildWatcherDeleteWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request * @@ -67,17 +67,17 @@ function buildWatcherDeleteWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildWatcherDeleteWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 8b5cf89d2..8a7865d2a 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -24,7 +24,7 @@ function buildWatcherExecuteWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request * @@ -59,17 +59,17 @@ function buildWatcherExecuteWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildWatcherExecuteWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index 587089f94..f40151c35 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -24,7 +24,7 @@ function buildWatcherGetWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request * @@ -67,17 +67,17 @@ function buildWatcherGetWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,36 +92,8 @@ function buildWatcherGetWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index 695f6eb19..05ba4edfe 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -24,7 +24,7 @@ function buildWatcherPutWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request * @@ -72,17 +72,17 @@ function buildWatcherPutWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,36 +97,8 @@ function buildWatcherPutWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 1053693f5..5221faf23 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -24,7 +24,7 @@ function buildWatcherStart (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request * @@ -62,17 +62,17 @@ function buildWatcherStart (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildWatcherStart (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index ffa6b9bd9..792a895c1 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -24,7 +24,7 @@ function buildWatcherStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request * @@ -66,17 +66,17 @@ function buildWatcherStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, metric } = params - var querystring = semicopy(params, ['method', 'body', 'metric']) + var warnings = [] + var { method, body, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,36 +95,8 @@ function buildWatcherStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index d7873de19..5eea1055c 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -24,7 +24,7 @@ function buildWatcherStop (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request * @@ -62,17 +62,17 @@ function buildWatcherStop (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,36 +87,8 @@ function buildWatcherStop (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index 22d1f9f18..504e3543d 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -24,7 +24,7 @@ function buildXpackInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [xpack.info](https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html) request * @@ -63,17 +63,17 @@ function buildXpackInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildXpackInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index 1885f4d93..e7f3971a3 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -24,7 +24,7 @@ function buildXpackUsage (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [xpack.usage](Retrieve information about xpack features usage) request * @@ -63,17 +63,17 @@ function buildXpackUsage (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,36 +88,8 @@ function buildXpackUsage (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } } diff --git a/api/index.js b/api/index.js index d31ded72e..461bfa8a4 100644 --- a/api/index.js +++ b/api/index.js @@ -28,6 +28,7 @@ function ESAPI (opts) { const { result } = opts opts.handleError = handleError + opts.snakeCaseKeys = snakeCaseKeys const apis = { bulk: lazyLoad('bulk', opts), @@ -521,6 +522,19 @@ function ESAPI (opts) { if (callback) return callback(err, result) return Promise.reject(err) } + + function snakeCaseKeys (acceptedQuerystring, snakeCase, querystring, warnings) { + var target = {} + var keys = Object.keys(querystring) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + target[snakeCase[key] || key] = querystring[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + return target + } } // It's unlikely that a user needs all of our APIs, diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index f00d49dc8..0f48503e2 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -128,17 +128,17 @@ function generate (spec, common) { return handleError(err, callback) } - var warnings = null - var { ${genQueryBlacklist(false)} } = params - var querystring = semicopy(params, [${genQueryBlacklist()}]) + var warnings = [] + var { ${genQueryBlacklist(false)}, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { ${generatePickMethod(methods)} } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } @@ -153,36 +153,8 @@ function generate (spec, common) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) } `.trim() // always call trim to avoid newlines @@ -213,7 +185,7 @@ function generate (spec, common) { function build${name[0].toUpperCase() + name.slice(1)} (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts ${generateDocumentation(spec[api], api)} const acceptedQuerystring = [ diff --git a/scripts/utils/generateMain.js b/scripts/utils/generateMain.js index 7f0a5aeda..99d24f9a9 100644 --- a/scripts/utils/generateMain.js +++ b/scripts/utils/generateMain.js @@ -125,6 +125,7 @@ function genFactory (folder) { const { result } = opts opts.handleError = handleError + opts.snakeCaseKeys = snakeCaseKeys const apis = ${apisStr} @@ -135,6 +136,19 @@ function genFactory (folder) { if (callback) return callback(err, result) return Promise.reject(err) } + + function snakeCaseKeys (acceptedQuerystring, snakeCase, querystring, warnings) { + var target = {} + var keys = Object.keys(querystring) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + target[snakeCase[key] || key] = querystring[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + return target + } } // It's unlikely that a user needs all of our APIs, diff --git a/test/unit/events.test.js b/test/unit/events.test.js index d8029f2d5..1b967d900 100644 --- a/test/unit/events.test.js +++ b/test/unit/events.test.js @@ -53,15 +53,7 @@ test('Should emit a request event when a request is performed', t => { 'Content-Length': '0' } }, - options: { - ignore: null, - requestTimeout: null, - maxRetries: null, - asStream: false, - headers: null, - compression: false, - warnings: null - }, + options: {}, id: 1 }, connection: { @@ -113,15 +105,7 @@ test('Should emit a response event in case of a successful response', t => { 'Content-Length': '0' } }, - options: { - ignore: null, - requestTimeout: null, - maxRetries: null, - asStream: false, - headers: null, - compression: false, - warnings: null - }, + options: {}, id: 1 }, connection: { @@ -172,13 +156,7 @@ test('Should emit a response event with the error set', t => { } }, options: { - ignore: null, - requestTimeout: 500, - maxRetries: null, - asStream: false, - headers: null, - compression: false, - warnings: null + requestTimeout: 500 }, id: 1 }, From 802f7902a40507e03a40d1af3e9913e52b04a081 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 6 May 2019 09:59:22 +0200 Subject: [PATCH 33/84] Added User-Agent header (#807) * Added User-Agent header * Updated test * Updated user-agent format * Updated test --- lib/Transport.js | 6 +++++- test/unit/transport.test.js | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/lib/Transport.js b/lib/Transport.js index 3ea692b3a..265f006f6 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -20,6 +20,7 @@ 'use strict' const debug = require('debug')('elasticsearch') +const os = require('os') const once = require('once') const { createGzip } = require('zlib') const intoStream = require('into-stream') @@ -34,6 +35,9 @@ const { const noop = () => {} +const clientVersion = require('../package.json').version +const userAgent = `elasticsearch-js/${clientVersion} (${os.platform()} ${os.release()}-${os.arch()}; Node.js ${process.version})` + class Transport { constructor (opts = {}) { if (typeof opts.compression === 'string' && opts.compression !== 'gzip') { @@ -46,7 +50,7 @@ class Transport { this.requestTimeout = toMs(opts.requestTimeout) this.suggestCompression = opts.suggestCompression === true this.compression = opts.compression || false - this.headers = opts.headers || {} + this.headers = Object.assign({}, { 'User-Agent': userAgent }, opts.headers) this.sniffInterval = opts.sniffInterval this.sniffOnConnectionFault = opts.sniffOnConnectionFault this.sniffEndpoint = opts.sniffEndpoint diff --git a/test/unit/transport.test.js b/test/unit/transport.test.js index b9e079dc3..867483863 100644 --- a/test/unit/transport.test.js +++ b/test/unit/transport.test.js @@ -22,6 +22,7 @@ const { test } = require('tap') const { URL } = require('url') const { createGunzip } = require('zlib') +const os = require('os') const intoStream = require('into-stream') const { buildServer, @@ -2111,6 +2112,43 @@ test('Should accept custom querystring in the optons object', t => { t.end() }) +test('Should add an User-Agent header', t => { + t.plan(2) + const clientVersion = require('../../package.json').version + const userAgent = `elasticsearch-js/${clientVersion} (${os.platform()} ${os.release()}-${os.arch()}; Node.js ${process.version})` + + function handler (req, res) { + t.match(req.headers, { + 'user-agent': userAgent + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const pool = new ConnectionPool({ Connection }) + pool.addConnection(`http://localhost:${port}`) + + const transport = new Transport({ + emit: () => {}, + connectionPool: pool, + serializer: new Serializer(), + maxRetries: 3, + requestTimeout: 30000, + sniffInterval: false, + sniffOnStart: false + }) + + transport.request({ + method: 'GET', + path: '/hello' + }, (err, { body }) => { + t.error(err) + server.stop() + }) + }) +}) + test('Should pass request params and options to generateRequestId', t => { t.plan(3) From 27610a76def8fd2e3cfe3af57e55de0448a89bdd Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 6 May 2019 10:01:34 +0200 Subject: [PATCH 34/84] Bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd88d16eb..4ee69b19c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "index.js", "types": "index.d.ts", "homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", - "version": "0.1.0-beta.2", + "version": "8.0.0-alpha", "keywords": [ "elasticsearch", "elastic", From 4fc4699a4d4474d7887bc7757e0269218a859294 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 6 May 2019 12:01:36 +0200 Subject: [PATCH 35/84] Updated installation instructions (#840) --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 5d707fb60..35efdf59a 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,42 @@ The library is compatible with all Elasticsearch versions since 5.x, but you sho @elastic/elasticsearch@5 ``` +#### Install multiple versions +If you are using multiple versions of Elasticsearch, you need to use multiple versions of the client. In the past, install multiple versions of the same package was not possible, but with `npm v6.9`, you can do that via aliasing. + +The command you must run to install different version of the client is: +```sh +npm install @npm:@elastic/elasticsearch@ +``` +So for example if you need to install `7.x` and `6.x`, you will run +```sh +npm install es6@npm:@elastic/elasticsearch@6 +npm install es7@npm:@elastic/elasticsearch@7 +``` +And your `package.json` will look like the following: +```json +"dependencies": { + "es6": "npm:@elastic/elasticsearch@^6.7.0", + "es7": "npm:@elastic/elasticsearch@^7.0.0" +} +``` +And finally, you will require the packages from your code by using the alias you have defined. +```js +const { Client: Client6 } = require('es6') +const { Client: Client7 } = require('es7') + +const client6 = new Client6({ node: 'http://localhost:9200' }) +const client7 = new Client7({ node: 'http://localhost:9201' }) + +client6.info(console.log) +client7.info(console.log) +``` + +Finally, if you want to install the client for the next version of Elasticsearch *(the one that lives in Elasticsearch’s master branch)*, you can use the following command: +```sh +npm install esmaster@github:elastic/elasticsearch-js +``` + ## Usage You can find the full documentation in our [docs](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html) website. From 82a0a110b53a98342974984409512016b35e7049 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 9 May 2019 14:57:04 +0200 Subject: [PATCH 36/84] Fix 841 (#842) * Added errors to exported members * Updated test --- index.d.ts | 1 + test/types/index.ts | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/index.d.ts b/index.d.ts index 5bce05610..a8018fdcd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -610,6 +610,7 @@ export { Connection, Serializer, events, + errors, ApiResponse, RequestEvent, ResurrectEvent, diff --git a/test/types/index.ts b/test/types/index.ts index 6079906e6..6f97182d4 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -26,6 +26,7 @@ import { RequestEvent, ResurrectEvent, events, + errors, ClientExtendsCallbackOptions } from '../../index' @@ -33,23 +34,23 @@ import { TransportRequestParams, TransportRequestOptions } from '../../lib/Trans const client = new Client({ node: 'http://localhost:9200' }) -client.on(events.RESPONSE, (err: Error | null, request: RequestEvent) => { +client.on(events.RESPONSE, (err: errors.ElasticsearchClientError | null, request: RequestEvent) => { if (err) console.log(err) const { body, statusCode } = request const { params } = request.meta.request console.log(params, body, statusCode) }) -client.on(events.RESURRECT, (err: Error | null, meta: ResurrectEvent) => {}) +client.on(events.RESURRECT, (err: errors.ElasticsearchClientError | null, meta: ResurrectEvent) => {}) // Callbacks -client.info((err: Error | null, result: ApiResponse) => {}) +client.info((err: errors.ElasticsearchClientError | null, result: ApiResponse) => {}) client.index({ index: 'test', type: 'test', id: 'test', body: { hello: 'world' } -}, (err: Error | null, result: ApiResponse) => {}) +}, (err: errors.ElasticsearchClientError | null, result: ApiResponse) => {}) // request options client.index({ @@ -65,12 +66,12 @@ client.index({ querystring: { baz: 'faz' }, compression: 'gzip', asStream: false -}, (err: Error | null, result: ApiResponse) => {}) +}, (err: errors.ElasticsearchClientError | null, result: ApiResponse) => {}) // Promises client.info() .then((result: ApiResponse) => {}) - .catch((err: Error) => {}) + .catch((err: errors.ElasticsearchClientError) => {}) client.index({ index: 'test', @@ -79,7 +80,7 @@ client.index({ body: { hello: 'world' } }) .then((result: ApiResponse) => {}) - .catch((err: Error) => {}) + .catch((err: errors.ElasticsearchClientError) => {}) // request options client.index({ @@ -93,7 +94,7 @@ client.index({ requestTimeout: 2000 }) .then((result: ApiResponse) => {}) - .catch((err: Error) => {}) + .catch((err: errors.ElasticsearchClientError) => {}) // --- Use generics --- // Define the search parameters @@ -127,7 +128,7 @@ interface Source { client.search(searchParams) .then((response: ApiResponse>) => console.log(response)) - .catch((err: Error) => {}) + .catch((err: errors.ElasticsearchClientError) => {}) // extend client client.extend('namespace.method', (options: ClientExtendsCallbackOptions) => { From 24bfff5e69bb22fa466de4a2427a8ec2f32be732 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 9 May 2019 15:33:18 +0200 Subject: [PATCH 37/84] Bumped v8.0.0-snapshot.9f33e3c7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4ee69b19c..fc6d9ea7f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "index.js", "types": "index.d.ts", "homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", - "version": "8.0.0-alpha", + "version": "8.0.0-snapshot.9f33e3c7", "keywords": [ "elasticsearch", "elastic", From bde19d604d583c194561cb3695b509b9920f429e Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 9 May 2019 15:57:16 +0200 Subject: [PATCH 38/84] Bumped v8.0.0-SNAPSHOT.9f33e3c7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc6d9ea7f..054398efe 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "index.js", "types": "index.d.ts", "homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", - "version": "8.0.0-snapshot.9f33e3c7", + "version": "8.0.0-SNAPSHOT.9f33e3c7", "keywords": [ "elasticsearch", "elastic", From 37f11281aa6b15b97085f2767fff56c1072b1dd0 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 10 May 2019 10:55:28 +0200 Subject: [PATCH 39/84] Fix 843 (#845) * Fix #843 * Updated test --- lib/Connection.js | 3 ++- test/unit/connection.test.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/Connection.js b/lib/Connection.js index e90182453..9560b40cf 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -191,7 +191,8 @@ class Connection { path: '', href: url.href, origin: url.origin, - port: url.port, + // https://github.com/elastic/elasticsearch-js/issues/843 + port: url.port !== '' ? url.port : undefined, headers: this.headers, auth: !!url.username === true || !!url.password === true ? `${url.username}:${url.password}` diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 84068cad5..4d1040280 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -763,3 +763,34 @@ test('Util.inspect Connection class should hide agent and ssl', t => { roles: { master: true, data: true, ingest: true, ml: false } }`) ) }) + +// https://github.com/elastic/elasticsearch-js/issues/843 +test('Port handling', t => { + t.test('http 80', t => { + const connection = new Connection({ + url: new URL('http://localhost:80') + }) + + t.strictEqual( + connection.buildRequestObject({}).port, + undefined + ) + + t.end() + }) + + t.test('https 443', t => { + const connection = new Connection({ + url: new URL('https://localhost:443') + }) + + t.strictEqual( + connection.buildRequestObject({}).port, + undefined + ) + + t.end() + }) + + t.end() +}) From 2f92b28bce082d69c2541ee05c3fb059c2c869b8 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 10 May 2019 14:17:24 +0200 Subject: [PATCH 40/84] Updated issue templates --- .github/ISSUE_TEMPLATE/bug.md | 8 ++++++++ .github/ISSUE_TEMPLATE/regression.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 6941b9a0f..c1dbcdb75 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -23,6 +23,14 @@ Paste your code here: ``` + + ## Expected behavior A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/regression.md b/.github/ISSUE_TEMPLATE/regression.md index 29ac65860..b3c6c2606 100644 --- a/.github/ISSUE_TEMPLATE/regression.md +++ b/.github/ISSUE_TEMPLATE/regression.md @@ -29,6 +29,14 @@ Paste your code here: ``` + + ## Expected behavior A clear and concise description of what you expected to happen. From c76d0249c07e0b4dcd9c48496cdb4c50e780b674 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Tue, 14 May 2019 11:19:08 -0400 Subject: [PATCH 41/84] Fix #803 (#846) --- lib/Connection.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index a02b6f72a..c31ff5925 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -76,6 +76,7 @@ export default class Connection { setRole(role: string, enabled: boolean): Connection; status: string; buildRequestObject(params: any): http.ClientRequestArgs; + // @ts-ignore [inspect.custom](object: any, options: InspectOptions): string; } From 7f77250ed537a1bd4bbb53deb8a5013876b31561 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Tue, 14 May 2019 12:00:27 -0400 Subject: [PATCH 42/84] Added toJSON method to Connection class (#849) * Added toJSON method to Connection class * Updated test * Updated typings --- lib/Connection.d.ts | 1 + lib/Connection.js | 13 +++++++++++++ test/unit/connection.test.js | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index c31ff5925..0c49207af 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -78,6 +78,7 @@ export default class Connection { buildRequestObject(params: any): http.ClientRequestArgs; // @ts-ignore [inspect.custom](object: any, options: InspectOptions): string; + toJSON(): any; } export {}; diff --git a/lib/Connection.js b/lib/Connection.js index 9560b40cf..9e8f065ae 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -239,6 +239,19 @@ class Connection { roles: this.roles } } + + toJSON () { + return { + url: this.url, + id: this.id, + headers: this.headers, + deadCount: this.deadCount, + resurrectTimeout: this.resurrectTimeout, + _openRequests: this._openRequests, + status: this.status, + roles: this.roles + } + } } Connection.statuses = { diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 4d1040280..cb7fa9a54 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -794,3 +794,16 @@ test('Port handling', t => { t.end() }) + +test('Should not add agent and ssl to the serialized connection', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200') + }) + + t.strictEqual( + JSON.stringify(connection), + '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":null,"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true,"ml":false}}' + ) + + t.end() +}) From ea1ecad13cd5b2c7d79a58eca24e5f4bb67fadfc Mon Sep 17 00:00:00 2001 From: Cameron Chamberlain Date: Thu, 16 May 2019 23:39:11 +1000 Subject: [PATCH 43/84] missing comma (#854) --- docs/configuration.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 3d52ad5a5..4bef0145d 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -8,7 +8,7 @@ The client is designed to be easily configured as you see fit for your needs, fo const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: 'http://localhost:9200' + node: 'http://localhost:9200', maxRetries: 5, requestTimeout: 60000, sniffOnStart: true From 844206ec9de60d08dc0036dc1650ea6e75bb28cc Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 16 May 2019 16:52:15 -0400 Subject: [PATCH 44/84] Patch deprecated parameters (#851) * Updated code generation * API generation * API generation * Updated code generation --- api/api/bulk.js | 4 ++++ api/api/delete_by_query.js | 19 ++++++----------- api/api/exists.js | 4 ++++ api/api/exists_source.js | 4 ++++ api/api/explain.js | 4 ++++ api/api/get.js | 4 ++++ api/api/get_source.js | 4 ++++ api/api/mget.js | 4 ++++ api/api/msearch.js | 13 ++---------- api/api/msearch_template.js | 13 ++---------- api/api/mtermvectors.js | 13 ++---------- api/api/search.js | 17 ++++++--------- api/api/search_template.js | 13 ++---------- api/api/termvectors.js | 9 ++------ api/api/update.js | 4 ++++ api/api/update_by_query.js | 19 ++++++----------- api/requestParams.d.ts | 30 ++++++++++++++++++++------- docs/reference.asciidoc | 24 --------------------- scripts/generate.js | 4 ++-- scripts/utils/generateApis.js | 12 ++++++++++- scripts/utils/generateRequestTypes.js | 19 +++++++++++++++-- scripts/utils/patch.json | 14 +++++++++++++ 22 files changed, 126 insertions(+), 125 deletions(-) create mode 100644 scripts/utils/patch.json diff --git a/api/api/bulk.js b/api/api/bulk.js index cf09dbbdd..505fe99ec 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -50,7 +50,9 @@ function buildBulk (opts) { 'type', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'pipeline', 'pretty', 'human', @@ -62,7 +64,9 @@ function buildBulk (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index c760a1dab..8450c1eb2 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -29,7 +29,6 @@ function buildDeleteByQuery (opts) { * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {enum} default_operator - The default operator for query string query (AND or OR) @@ -86,7 +85,9 @@ function buildDeleteByQuery (opts) { 'sort', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'terminate_after', 'stats', 'version', @@ -114,7 +115,9 @@ function buildDeleteByQuery (opts) { searchType: 'search_type', searchTimeout: 'search_timeout', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', @@ -147,12 +150,6 @@ function buildDeleteByQuery (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -160,7 +157,7 @@ function buildDeleteByQuery (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -174,11 +171,7 @@ function buildDeleteByQuery (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' - } + path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' // build request object const request = { diff --git a/api/api/exists.js b/api/api/exists.js index b0647a16d..41128f83e 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -53,7 +53,9 @@ function buildExists (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -66,7 +68,9 @@ function buildExists (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 1d94e75d1..7eece25e5 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -51,7 +51,9 @@ function buildExistsSource (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -63,7 +65,9 @@ function buildExistsSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/explain.js b/api/api/explain.js index ef8c82a9b..1f6602e79 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -60,7 +60,9 @@ function buildExplain (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'pretty', 'human', 'error_trace', @@ -73,7 +75,9 @@ function buildExplain (opts) { defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/get.js b/api/api/get.js index 38d95b1c0..670668dc6 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -53,7 +53,9 @@ function buildGet (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -66,7 +68,9 @@ function buildGet (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/get_source.js b/api/api/get_source.js index c74c9f6aa..e9f0491c1 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -51,7 +51,9 @@ function buildGetSource (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -63,7 +65,9 @@ function buildGetSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/mget.js b/api/api/mget.js index 7a0b5ee4c..b32742a97 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -49,7 +49,9 @@ function buildMget (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'pretty', 'human', 'error_trace', @@ -60,7 +62,9 @@ function buildMget (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/msearch.js b/api/api/msearch.js index 668ec0a6f..fd1c89a06 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -29,7 +29,6 @@ function buildMsearch (opts) { * Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request * * @param {list} index - A comma-separated list of index names to use as default - * @param {list} type - A comma-separated list of document types to use as default * @param {enum} search_type - Search operation type * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response @@ -85,12 +84,6 @@ function buildMsearch (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -98,7 +91,7 @@ function buildMsearch (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -112,9 +105,7 @@ function buildMsearch (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' } else { path = '/' + '_msearch' diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 2a6cb3514..527de8da3 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -29,7 +29,6 @@ function buildMsearchTemplate (opts) { * Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request * * @param {list} index - A comma-separated list of index names to use as default - * @param {list} type - A comma-separated list of document types to use as default * @param {enum} search_type - Search operation type * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute @@ -79,12 +78,6 @@ function buildMsearchTemplate (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -92,7 +85,7 @@ function buildMsearchTemplate (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -106,9 +99,7 @@ function buildMsearchTemplate (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template' } else { path = '/' + '_msearch' + '/' + 'template' diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index 92d14c93c..4fee48798 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -29,7 +29,6 @@ function buildMtermvectors (opts) { * Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request * * @param {string} index - The index in which the document resides. - * @param {string} type - The type of the document. * @param {list} ids - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body * @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". @@ -87,12 +86,6 @@ function buildMtermvectors (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -100,7 +93,7 @@ function buildMtermvectors (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -114,9 +107,7 @@ function buildMtermvectors (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors' } else { path = '/' + '_mtermvectors' diff --git a/api/api/search.js b/api/api/search.js index 6a1726ee0..885dd59b0 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -29,7 +29,6 @@ function buildSearch (opts) { * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution @@ -99,7 +98,9 @@ function buildSearch (opts) { 'sort', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'terminate_after', 'stats', 'suggest_field', @@ -137,7 +138,9 @@ function buildSearch (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', @@ -169,12 +172,6 @@ function buildSearch (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -182,7 +179,7 @@ function buildSearch (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -196,9 +193,7 @@ function buildSearch (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' } else { path = '/' + '_search' diff --git a/api/api/search_template.js b/api/api/search_template.js index 5b6d53853..dc9431d05 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -29,7 +29,6 @@ function buildSearchTemplate (opts) { * Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) @@ -98,12 +97,6 @@ function buildSearchTemplate (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -111,7 +104,7 @@ function buildSearchTemplate (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -125,9 +118,7 @@ function buildSearchTemplate (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template' } else { path = '/' + '_search' + '/' + 'template' diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 93092d9f9..47c0ae4ea 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -29,7 +29,6 @@ function buildTermvectors (opts) { * Perform a [termvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html) request * * @param {string} index - The index in which the document resides. - * @param {string} type - The type of the document. * @param {string} id - The id of the document, when not specified a doc param should be supplied. * @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned. * @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. @@ -99,7 +98,7 @@ function buildTermvectors (opts) { } var warnings = [] - var { method, body, index, type, id, ...querystring } = params + var { method, body, index, id, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -113,12 +112,8 @@ function buildTermvectors (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors' - } else if ((index) != null && (id) != null) { + if ((index) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id) - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' } else { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' } diff --git a/api/api/update.js b/api/api/update.js index 615a07aea..8059d3cb1 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -50,7 +50,9 @@ function buildUpdate (opts) { 'wait_for_active_shards', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'lang', 'parent', 'refresh', @@ -69,7 +71,9 @@ function buildUpdate (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 7d7d7bc47..017262d33 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -29,7 +29,6 @@ function buildUpdateByQuery (opts) { * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {enum} default_operator - The default operator for query string query (AND or OR) @@ -89,7 +88,9 @@ function buildUpdateByQuery (opts) { 'sort', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'terminate_after', 'stats', 'version', @@ -118,7 +119,9 @@ function buildUpdateByQuery (opts) { searchType: 'search_type', searchTimeout: 'search_timeout', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', versionType: 'version_type', requestCache: 'request_cache', @@ -148,12 +151,6 @@ function buildUpdateByQuery (opts) { return handleError(err, callback) } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -161,7 +158,7 @@ function buildUpdateByQuery (opts) { } var warnings = [] - var { method, body, index, type, ...querystring } = params + var { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -175,11 +172,7 @@ function buildUpdateByQuery (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' - } + path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' // build request object const request = { diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 5f1134da4..3afecde48 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -30,6 +30,8 @@ export interface Generic { export interface Bulk extends Generic { index?: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; wait_for_active_shards?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; @@ -387,7 +389,8 @@ export interface Delete extends Generic { export interface DeleteByQuery extends Generic { index: string | string[]; - type?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; @@ -438,6 +441,8 @@ export interface Exists extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; stored_fields?: string | string[]; parent?: string; preference?: string; @@ -455,6 +460,8 @@ export interface ExistsSource extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; parent?: string; preference?: string; realtime?: boolean; @@ -471,6 +478,8 @@ export interface Explain extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyze_wildcard?: boolean; analyzer?: string; default_operator?: 'AND' | 'OR'; @@ -500,6 +509,8 @@ export interface Get extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; stored_fields?: string | string[]; parent?: string; preference?: string; @@ -522,6 +533,8 @@ export interface GetSource extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; parent?: string; preference?: string; realtime?: boolean; @@ -933,6 +946,8 @@ export interface IngestSimulate extends Generic { export interface Mget extends Generic { index?: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -946,7 +961,6 @@ export interface Mget extends Generic { export interface Msearch extends Generic { index?: string | string[]; - type?: string | string[]; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; max_concurrent_searches?: number; typed_keys?: boolean; @@ -959,7 +973,6 @@ export interface Msearch extends Generic { export interface MsearchTemplate extends Generic { index?: string | string[]; - type?: string | string[]; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; typed_keys?: boolean; max_concurrent_searches?: number; @@ -970,7 +983,6 @@ export interface MsearchTemplate extends Generic { export interface Mtermvectors extends Generic { index?: string; - type?: string; ids?: string | string[]; term_statistics?: boolean; field_statistics?: boolean; @@ -1086,7 +1098,8 @@ export interface Scroll extends Generic { export interface Search extends Generic { index?: string | string[]; - type?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; ccs_minimize_roundtrips?: boolean; @@ -1144,7 +1157,6 @@ export interface SearchShards extends Generic { export interface SearchTemplate extends Generic { index?: string | string[]; - type?: string | string[]; ignore_unavailable?: boolean; ignore_throttled?: boolean; allow_no_indices?: boolean; @@ -1249,7 +1261,6 @@ export interface TasksList extends Generic { export interface Termvectors extends Generic { index: string; - type?: string; id?: string; term_statistics?: boolean; field_statistics?: boolean; @@ -1270,6 +1281,8 @@ export interface Update extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; wait_for_active_shards?: string; _source?: string | string[]; _source_excludes?: string | string[]; @@ -1287,7 +1300,8 @@ export interface Update extends Generic { export interface UpdateByQuery extends Generic { index: string | string[]; - type?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 3e2029d82..d9f1a3eca 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1160,9 +1160,6 @@ link:{ref}/docs-delete-by-query.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - |`analyzer` |`string` - The analyzer to use for the query string @@ -2930,9 +2927,6 @@ link:{ref}/search-multi-search.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to use as default -|`type` -|`string, string[]` - A comma-separated list of document types to use as default - |`search_type` or `searchType` |`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type @@ -2973,9 +2967,6 @@ link:{ref}/search-multi-search.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to use as default -|`type` -|`string, string[]` - A comma-separated list of document types to use as default - |`search_type` or `searchType` |`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type @@ -3008,9 +2999,6 @@ link:{ref}/docs-multi-termvectors.html[Reference] |`index` |`string` - The index in which the document resides. -|`type` -|`string` - The type of the document. - |`ids` |`string, string[]` - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body @@ -3384,9 +3372,6 @@ link:{ref}/search-search.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - |`analyzer` |`string` - The analyzer to use for the query string @@ -3569,9 +3554,6 @@ link:{ref}/search-template.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -3900,9 +3882,6 @@ link:{ref}/docs-termvectors.html[Reference] |`index` |`string` - The index in which the document resides. -|`type` -|`string` - The type of the document. - |`id` |`string` - The id of the document, when not specified a doc param should be supplied. @@ -4020,9 +3999,6 @@ link:{ref}/docs-update-by-query.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - |`analyzer` |`string` - The analyzer to use for the query string diff --git a/scripts/generate.js b/scripts/generate.js index df47b783e..79b7e2b17 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -69,7 +69,7 @@ function start (opts) { writeFileSync( requestParamsOutputFile, - generateRequestTypes(allSpec), + generateRequestTypes(opts.branch || opts.tag, allSpec), { encoding: 'utf8' } ) @@ -113,7 +113,7 @@ function start (opts) { const spec = require(join(apiFolder, file)) allSpec.push(spec) - const code = generate(spec, common) + const code = generate(opts.branch || opts.tag, spec, common) const filePath = join(apiOutputFolder, `${file.slice(0, file.lastIndexOf('.'))}.js`) writeFileSync(filePath, code, { encoding: 'utf8' }) diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index 0f48503e2..bde344e03 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -22,11 +22,16 @@ 'use strict' const dedent = require('dedent') +const semver = require('semver') const allowedMethods = { noBody: ['GET', 'HEAD', 'DELETE'], body: ['POST', 'PUT', 'DELETE'] } +// if a parameter is depracted in a minor release +// we should be able to support it until the next major +const deprecatedParameters = require('./patch.json') + // list of apis that does not need any kind of validation // because of how the url is built or the `type` handling in ES7 const noPathValidation = [ @@ -63,7 +68,8 @@ const ndjsonApi = [ 'xpack.monitoring.bulk' ] -function generate (spec, common) { +function generate (version, spec, common) { + const release = semver.valid(version) ? semver.major(version) : version const api = Object.keys(spec)[0] const name = api .replace(/\.([a-z])/g, k => k[1].toUpperCase()) @@ -90,7 +96,11 @@ function generate (spec, common) { if (params[key].required) { required.push(key) } + acceptedQuerystring.push(key) + if (deprecatedParameters[release] && deprecatedParameters[release][key]) { + acceptedQuerystring.push(deprecatedParameters[release][key]) + } } for (const key in spec[api]) { diff --git a/scripts/utils/generateRequestTypes.js b/scripts/utils/generateRequestTypes.js index edba2fa68..b1e2bc72d 100644 --- a/scripts/utils/generateRequestTypes.js +++ b/scripts/utils/generateRequestTypes.js @@ -19,7 +19,11 @@ 'use strict' -function generate (api) { +const semver = require('semver') +const deprecatedParameters = require('./patch.json') + +function generate (version, api) { + const release = semver.valid(version) ? semver.major(version) : version var types = `/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -64,9 +68,20 @@ export interface Generic { const partsArr = Object.keys(parts) .map(k => ({ key: k, value: parts[k] })) + const deprecatedParametersToAdd = [] const paramsArr = Object.keys(params) .filter(k => !Object.keys(parts).includes(k)) - .map(k => ({ key: k, value: params[k] })) + .map(k => { + if (deprecatedParameters[release] && deprecatedParameters[release][k]) { + deprecatedParametersToAdd.push({ + key: deprecatedParameters[release][k], + value: params[k] + }) + } + return { key: k, value: params[k] } + }) + + deprecatedParametersToAdd.forEach(k => partsArr.push(k)) const genLine = e => { const optional = e.value.required ? '' : '?' diff --git a/scripts/utils/patch.json b/scripts/utils/patch.json new file mode 100644 index 000000000..392b305cb --- /dev/null +++ b/scripts/utils/patch.json @@ -0,0 +1,14 @@ +{ + "6": { + "_source_includes": "_source_include", + "_source_excludes": "_source_exclude" + }, + "7": { + "_source_includes": "_source_include", + "_source_excludes": "_source_exclude" + }, + "master": { + "_source_includes": "_source_include", + "_source_excludes": "_source_exclude" + } +} From 95007b8c9d91b162c547a7d79d326c70daf48c2a Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 20 May 2019 11:09:33 -0400 Subject: [PATCH 45/84] Support for non-friendly chars in url username and password (#858) * Support for non-friendly chars in url username and password - Added auth option to Connection class - Updated pool.addConnection * Updated test --- lib/Connection.js | 8 +++++--- lib/ConnectionPool.js | 21 ++++++++++++--------- test/unit/connection-pool.test.js | 19 +++++++++++++++++-- test/unit/connection.test.js | 3 ++- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index 9e8f065ae..5d033e717 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -35,6 +35,7 @@ class Connection { this.ssl = opts.ssl || null this.id = opts.id || stripAuth(opts.url.href) this.headers = opts.headers || null + this.auth = opts.auth || { username: null, password: null } this.deadCount = 0 this.resurrectTimeout = 0 @@ -180,6 +181,7 @@ class Connection { buildRequestObject (params) { const url = this.url + const { username, password } = this.auth const request = { protocol: url.protocol, hostname: url.hostname[0] === '[' @@ -194,8 +196,8 @@ class Connection { // https://github.com/elastic/elasticsearch-js/issues/843 port: url.port !== '' ? url.port : undefined, headers: this.headers, - auth: !!url.username === true || !!url.password === true - ? `${url.username}:${url.password}` + auth: username != null && password != null + ? `${username}:${password}` : undefined, agent: this.agent } @@ -224,7 +226,7 @@ class Connection { } // Handles console.log and utils.inspect invocations. - // We want to hide `agent` and `ssl` since they made + // We want to hide `auth`, `agent` and `ssl` since they made // the logs very hard to read. The user can still // access them with `instance.agent` and `instance.ssl`. [inspect.custom] (depth, options) { diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index 3f12a64a4..60191d3ba 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -222,21 +222,24 @@ class ConnectionPool { // we can add it to them once the connection instance has been created if (opts.url.username !== '' && opts.url.password !== '') { this._auth = { - username: opts.url.username, - password: opts.url.password + username: decodeURIComponent(opts.url.username), + password: decodeURIComponent(opts.url.password) } + opts.auth = this._auth } + + if (this._auth != null) { + if (opts.auth == null || (opts.auth.username == null && opts.auth.password == null)) { + opts.auth = this._auth + opts.url.username = this._auth.username + opts.url.password = this._auth.password + } + } + if (opts.ssl == null) opts.ssl = this._ssl if (opts.agent == null) opts.agent = this._agent const connection = new this.Connection(opts) - if (connection.url.username === '' && - connection.url.password === '' && - this._auth != null) { - connection.url.username = this._auth.username - connection.url.password = this._auth.password - } - debug('Adding a new connection', connection) if (this.connections.has(connection.id)) { throw new Error(`Connection with id '${connection.id}' is already present`) diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index fc9495766..c2510a2aa 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -61,8 +61,23 @@ test('API', t => { t.deepEqual(pool._auth, { username: 'foo', password: 'bar' }) pool.addConnection('http://localhost:9201') - t.strictEqual(pool.connections.get('http://localhost:9201/').url.username, 'foo') - t.strictEqual(pool.connections.get('http://localhost:9201/').url.password, 'bar') + const conn = pool.connections.get('http://localhost:9201/') + t.strictEqual(conn.url.username, 'foo') + t.strictEqual(conn.url.password, 'bar') + t.strictEqual(conn.auth.username, 'foo') + t.strictEqual(conn.auth.password, 'bar') + t.end() + }) + + t.test('addConnection should handle not-friendly url parameters for user and password', t => { + const pool = new ConnectionPool({ Connection }) + const href = 'http://us"er:p@assword@localhost:9200/' + pool.addConnection(href) + const conn = pool.getConnection() + t.strictEqual(conn.url.username, 'us%22er') + t.strictEqual(conn.url.password, 'p%40assword') + t.strictEqual(conn.auth.username, 'us"er') + t.strictEqual(conn.auth.password, 'p@assword') t.end() }) diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index cb7fa9a54..2ecad0ff1 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -526,7 +526,8 @@ test('Url with auth', t => { buildServer(handler, ({ port }, server) => { const connection = new Connection({ - url: new URL(`http://foo:bar@localhost:${port}`) + url: new URL(`http://foo:bar@localhost:${port}`), + auth: { username: 'foo', password: 'bar' } }) connection.request({ path: '/hello', From 930703b9eb80df0efd70d8b00484212c1fab3781 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 30 May 2019 13:53:57 +0200 Subject: [PATCH 46/84] Updated stale bot configuration --- .github/stale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/stale.yml b/.github/stale.yml index 9f6c839ea..f6bbb14e1 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -9,6 +9,7 @@ exemptLabels: - "discussion" - "feature request" - "bug" + - "todo" # Label to use when marking an issue as stale staleLabel: stale From ff9904da03557bdb3746419b71a6ac9841233039 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 3 Jun 2019 12:24:42 +0200 Subject: [PATCH 47/84] Docs: added missing configuration options (#870) --- docs/configuration.asciidoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 4bef0145d..f737d521c 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -150,6 +150,15 @@ function generateRequestId (params, options) { |`name` |`string` - The name to identify the client instance in the events. + _Default:_ `elasticsearch-js` + +|`headers` +|`object` - A set of custom headers to send in every request. + +_Default:_ `{}` + +|`cloud` +|`object` - Custom configuration for connecting to https://cloud.elastic.co[Elastic Cloud]. + +_Default:_ `null` + |=== === Advanced configuration From f037e8115ecc96ee08a60b19bcf489031070c7f7 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Tue, 11 Jun 2019 21:02:36 +0200 Subject: [PATCH 48/84] API generation (#875) --- api/api/count.js | 10 +----- api/api/create.js | 2 -- api/api/delete.js | 2 -- api/api/delete_by_query.js | 5 ++- api/api/exists.js | 2 -- api/api/exists_source.js | 2 -- api/api/explain.js | 2 -- api/api/get.js | 2 -- api/api/get_source.js | 2 -- api/api/index.js | 2 -- api/api/ml.find_file_structure.js | 3 ++ api/api/msearch.js | 2 +- api/api/mtermvectors.js | 2 -- api/api/reindex.js | 3 ++ api/api/termvectors.js | 2 -- api/api/update.js | 2 -- api/api/update_by_query.js | 5 ++- api/requestParams.d.ts | 15 +++------ docs/reference.asciidoc | 56 ++++++++++--------------------- 19 files changed, 38 insertions(+), 83 deletions(-) diff --git a/api/api/count.js b/api/api/count.js index c4559bcd3..3ab8ebadb 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -94,12 +94,6 @@ function buildCount (opts) { options = {} } - // check required url components - if (params['type'] != null && (params['index'] == null)) { - const err = new ConfigurationError('Missing required parameter of the url: index') - return handleError(err, callback) - } - // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -121,9 +115,7 @@ function buildCount (opts) { var path = '' - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count' - } else if ((index) != null) { + if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_count' } else { path = '/' + '_count' diff --git a/api/api/create.js b/api/api/create.js index 2c5c20dbd..c1480fbea 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -32,7 +32,6 @@ function buildCreate (opts) { * @param {string} index - The name of the index * @param {string} type - The type of the document * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * @param {string} parent - ID of the parent document * @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout @@ -44,7 +43,6 @@ function buildCreate (opts) { const acceptedQuerystring = [ 'wait_for_active_shards', - 'parent', 'refresh', 'routing', 'timeout', diff --git a/api/api/delete.js b/api/api/delete.js index 1a02977e2..8055d48d3 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -32,7 +32,6 @@ function buildDelete (opts) { * @param {string} index - The name of the index * @param {string} type - The type of the document * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * @param {string} parent - ID of parent document * @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout @@ -44,7 +43,6 @@ function buildDelete (opts) { const acceptedQuerystring = [ 'wait_for_active_shards', - 'parent', 'refresh', 'routing', 'timeout', diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 8450c1eb2..1283cf659 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -45,7 +45,8 @@ function buildDeleteByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. - * @param {number} size - Number of hits to return (default: 10) + * @param {number} size - Deprecated, please use `max_docs` instead + * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field @@ -82,6 +83,7 @@ function buildDeleteByQuery (opts) { 'search_type', 'search_timeout', 'size', + 'max_docs', 'sort', '_source', '_source_excludes', @@ -114,6 +116,7 @@ function buildDeleteByQuery (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', + maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', diff --git a/api/api/exists.js b/api/api/exists.js index 41128f83e..4ee50bdfa 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -32,7 +32,6 @@ function buildExists (opts) { * @param {string} index - The name of the index * @param {string} type - The type of the document (use `_all` to fetch the first document matching the ID across all types) * @param {list} stored_fields - A comma-separated list of stored fields to return in the response - * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode * @param {boolean} refresh - Refresh the shard containing the document before performing the operation @@ -46,7 +45,6 @@ function buildExists (opts) { const acceptedQuerystring = [ 'stored_fields', - 'parent', 'preference', 'realtime', 'refresh', diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 7eece25e5..8d1b4d31a 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -31,7 +31,6 @@ function buildExistsSource (opts) { * @param {string} id - The document ID * @param {string} index - The name of the index * @param {string} type - The type of the document; deprecated and optional starting with 7.0 - * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode * @param {boolean} refresh - Refresh the shard containing the document before performing the operation @@ -44,7 +43,6 @@ function buildExistsSource (opts) { */ const acceptedQuerystring = [ - 'parent', 'preference', 'realtime', 'refresh', diff --git a/api/api/explain.js b/api/api/explain.js index 1f6602e79..243b9f248 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -37,7 +37,6 @@ function buildExplain (opts) { * @param {string} df - The default field for query string query (default: _all) * @param {list} stored_fields - A comma-separated list of stored fields to return in the response * @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {string} q - Query in the Lucene query string syntax * @param {string} routing - Specific routing value @@ -54,7 +53,6 @@ function buildExplain (opts) { 'df', 'stored_fields', 'lenient', - 'parent', 'preference', 'q', 'routing', diff --git a/api/api/get.js b/api/api/get.js index 670668dc6..8f6e6300b 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -32,7 +32,6 @@ function buildGet (opts) { * @param {string} index - The name of the index * @param {string} type - The type of the document (use `_all` to fetch the first document matching the ID across all types) * @param {list} stored_fields - A comma-separated list of stored fields to return in the response - * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode * @param {boolean} refresh - Refresh the shard containing the document before performing the operation @@ -46,7 +45,6 @@ function buildGet (opts) { const acceptedQuerystring = [ 'stored_fields', - 'parent', 'preference', 'realtime', 'refresh', diff --git a/api/api/get_source.js b/api/api/get_source.js index e9f0491c1..40e21e431 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -31,7 +31,6 @@ function buildGetSource (opts) { * @param {string} id - The document ID * @param {string} index - The name of the index * @param {string} type - The type of the document; deprecated and optional starting with 7.0 - * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode * @param {boolean} refresh - Refresh the shard containing the document before performing the operation @@ -44,7 +43,6 @@ function buildGetSource (opts) { */ const acceptedQuerystring = [ - 'parent', 'preference', 'realtime', 'refresh', diff --git a/api/api/index.js b/api/api/index.js index 4dbb666d9..c012359b3 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -33,7 +33,6 @@ function buildIndex (opts) { * @param {string} type - The type of the document * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) * @param {enum} op_type - Explicit operation type - * @param {string} parent - ID of the parent document * @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout @@ -48,7 +47,6 @@ function buildIndex (opts) { const acceptedQuerystring = [ 'wait_for_active_shards', 'op_type', - 'parent', 'refresh', 'routing', 'timeout', diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index eee5b0e56..6371e36a6 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -29,6 +29,7 @@ function buildMlFindFileStructure (opts) { * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html) request * * @param {int} lines_to_sample - How many lines of the file should be included in the analysis + * @param {int} line_merge_size_limit - Maximum number of characters permitted in a single message when lines are merged to create messages. * @param {time} timeout - Timeout after which the analysis will be aborted * @param {string} charset - Optional parameter to specify the character set of the file * @param {enum} format - Optional parameter to specify the high level file format @@ -46,6 +47,7 @@ function buildMlFindFileStructure (opts) { const acceptedQuerystring = [ 'lines_to_sample', + 'line_merge_size_limit', 'timeout', 'charset', 'format', @@ -62,6 +64,7 @@ function buildMlFindFileStructure (opts) { const snakeCase = { linesToSample: 'lines_to_sample', + lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', diff --git a/api/api/msearch.js b/api/api/msearch.js index fd1c89a06..ead9e13b5 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -33,7 +33,7 @@ function buildMsearch (opts) { * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. - * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution * @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index 4fee48798..8462fd231 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -38,7 +38,6 @@ function buildMtermvectors (opts) { * @param {boolean} payloads - Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {string} routing - Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * @param {string} parent - Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {boolean} realtime - Specifies if requests are real-time as opposed to near-real-time (default: true). * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type @@ -55,7 +54,6 @@ function buildMtermvectors (opts) { 'payloads', 'preference', 'routing', - 'parent', 'realtime', 'version', 'version_type', diff --git a/api/api/reindex.js b/api/api/reindex.js index 85722b4ce..812a88bd4 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -35,6 +35,7 @@ function buildReindex (opts) { * @param {number} requests_per_second - The throttle to set on this request in sub-requests per second. -1 means no throttle. * @param {time} scroll - Control how long to keep the search context alive * @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {object} body - The search definition using the Query DSL and the prototype for the index request. */ @@ -46,6 +47,7 @@ function buildReindex (opts) { 'requests_per_second', 'scroll', 'slices', + 'max_docs', 'pretty', 'human', 'error_trace', @@ -57,6 +59,7 @@ function buildReindex (opts) { waitForActiveShards: 'wait_for_active_shards', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', + maxDocs: 'max_docs', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 47c0ae4ea..445d13d85 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -38,7 +38,6 @@ function buildTermvectors (opts) { * @param {boolean} payloads - Specifies if term payloads should be returned. * @param {string} preference - Specify the node or shard the operation should be performed on (default: random). * @param {string} routing - Specific routing value. - * @param {string} parent - Parent id of documents. * @param {boolean} realtime - Specifies if request is real-time as opposed to near-real-time (default: true). * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type @@ -54,7 +53,6 @@ function buildTermvectors (opts) { 'payloads', 'preference', 'routing', - 'parent', 'realtime', 'version', 'version_type', diff --git a/api/api/update.js b/api/api/update.js index 8059d3cb1..6130b7aa4 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -36,7 +36,6 @@ function buildUpdate (opts) { * @param {list} _source_excludes - A list of fields to exclude from the returned _source field * @param {list} _source_includes - A list of fields to extract and return from the _source field * @param {string} lang - The script language (default: painless) - * @param {string} parent - ID of the parent document. Is is only used for routing and when for the upsert request * @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. * @param {number} retry_on_conflict - Specify how many times should the operation be retried when a conflict occurs (default: 0) * @param {string} routing - Specific routing value @@ -54,7 +53,6 @@ function buildUpdate (opts) { '_source_includes', '_source_include', 'lang', - 'parent', 'refresh', 'retry_on_conflict', 'routing', diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 017262d33..98aa3cfa0 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -46,7 +46,8 @@ function buildUpdateByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. - * @param {number} size - Number of hits to return (default: 10) + * @param {number} size - Deprecated, please use `max_docs` instead + * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field @@ -85,6 +86,7 @@ function buildUpdateByQuery (opts) { 'search_type', 'search_timeout', 'size', + 'max_docs', 'sort', '_source', '_source_excludes', @@ -118,6 +120,7 @@ function buildUpdateByQuery (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', + maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 3afecde48..32e92b517 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -362,7 +362,6 @@ export interface Create extends Generic { index: string; type?: string; wait_for_active_shards?: string; - parent?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; timeout?: string; @@ -377,7 +376,6 @@ export interface Delete extends Generic { index: string; type?: string; wait_for_active_shards?: string; - parent?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; timeout?: string; @@ -408,6 +406,7 @@ export interface DeleteByQuery extends Generic { search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; size?: number; + max_docs?: number; sort?: string | string[]; _source?: string | string[]; _source_excludes?: string | string[]; @@ -444,7 +443,6 @@ export interface Exists extends Generic { _source_exclude?: string | string[]; _source_include?: string | string[]; stored_fields?: string | string[]; - parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; @@ -462,7 +460,6 @@ export interface ExistsSource extends Generic { type?: string; _source_exclude?: string | string[]; _source_include?: string | string[]; - parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; @@ -486,7 +483,6 @@ export interface Explain extends Generic { df?: string; stored_fields?: string | string[]; lenient?: boolean; - parent?: string; preference?: string; q?: string; routing?: string; @@ -512,7 +508,6 @@ export interface Get extends Generic { _source_exclude?: string | string[]; _source_include?: string | string[]; stored_fields?: string | string[]; - parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; @@ -535,7 +530,6 @@ export interface GetSource extends Generic { type?: string; _source_exclude?: string | string[]; _source_include?: string | string[]; - parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; @@ -553,7 +547,6 @@ export interface Index extends Generic { type?: string; wait_for_active_shards?: string; op_type?: 'index' | 'create'; - parent?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; timeout?: string; @@ -992,7 +985,6 @@ export interface Mtermvectors extends Generic { payloads?: boolean; preference?: string; routing?: string; - parent?: string; realtime?: boolean; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; @@ -1068,6 +1060,7 @@ export interface Reindex extends Generic { requests_per_second?: number; scroll?: string; slices?: number; + max_docs?: number; body: T; } @@ -1270,7 +1263,6 @@ export interface Termvectors extends Generic { payloads?: boolean; preference?: string; routing?: string; - parent?: string; realtime?: boolean; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; @@ -1288,7 +1280,6 @@ export interface Update extends Generic { _source_excludes?: string | string[]; _source_includes?: string | string[]; lang?: string; - parent?: string; refresh?: 'true' | 'false' | 'wait_for'; retry_on_conflict?: number; routing?: string; @@ -1320,6 +1311,7 @@ export interface UpdateByQuery extends Generic { search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; size?: number; + max_docs?: number; sort?: string | string[]; _source?: string | string[]; _source_excludes?: string | string[]; @@ -1580,6 +1572,7 @@ export interface MlDeleteModelSnapshot extends Generic { export interface MlFindFileStructure extends Generic { lines_to_sample?: number; + line_merge_size_limit?: number; timeout?: string; charset?: string; format?: 'ndjson' | 'xml' | 'delimited' | 'semi_structured_text'; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index d9f1a3eca..ed540b1c8 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1077,9 +1077,6 @@ link:{ref}/docs-index_.html[Reference] |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) -|`parent` -|`string` - ID of the parent document - |`refresh` |`'true', 'false', 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. @@ -1123,9 +1120,6 @@ link:{ref}/docs-delete.html[Reference] |`wait_for_active_shards` or `waitForActiveShards` |`string` - Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) -|`parent` -|`string` - ID of parent document - |`refresh` |`'true', 'false', 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. @@ -1212,7 +1206,10 @@ _Default:_ `open` |`string` - Explicit timeout for each search request. Defaults to no timeout. |`size` -|`number` - Number of hits to return (default: 10) +|`number` - Deprecated, please use `max_docs` instead + +|`max_docs` or `maxDocs` +|`number` - Maximum number of documents to process (default: all documents) |`sort` |`string, string[]` - A comma-separated list of : pairs @@ -1322,9 +1319,6 @@ link:{ref}/docs-get.html[Reference] |`stored_fields` or `storedFields` |`string, string[]` - A comma-separated list of stored fields to return in the response -|`parent` -|`string` - The ID of the parent document - |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1371,9 +1365,6 @@ link:{ref}/docs-get.html[Reference] |`type` |`string` - The type of the document; deprecated and optional starting with 7.0 -|`parent` -|`string` - The ID of the parent document - |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1439,9 +1430,6 @@ _Default:_ `OR` |`lenient` |`boolean` - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored -|`parent` -|`string` - The ID of the parent document - |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1514,9 +1502,6 @@ link:{ref}/docs-get.html[Reference] |`stored_fields` or `storedFields` |`string, string[]` - A comma-separated list of stored fields to return in the response -|`parent` -|`string` - The ID of the parent document - |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1579,9 +1564,6 @@ link:{ref}/docs-get.html[Reference] |`type` |`string` - The type of the document; deprecated and optional starting with 7.0 -|`parent` -|`string` - The ID of the parent document - |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1635,9 +1617,6 @@ link:{ref}/docs-index_.html[Reference] |`'index', 'create'` - Explicit operation type + _Default:_ `index` -|`parent` -|`string` - ID of the parent document - |`refresh` |`'true', 'false', 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. @@ -2941,8 +2920,8 @@ link:{ref}/search-multi-search.html[Reference] _Default:_ `128` |`max_concurrent_shard_requests` or `maxConcurrentShardRequests` -|`number` - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + -_Default:_ `The default grows with the number of nodes in the cluster but is at most 256.` +|`number` - The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + +_Default:_ `5` |`rest_total_hits_as_int` or `restTotalHitsAsInt` |`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response @@ -3030,9 +3009,6 @@ _Default:_ `true` |`routing` |`string` - Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". -|`parent` -|`string` - Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs". - |`realtime` |`boolean` - Specifies if requests are real-time as opposed to near-real-time (default: true). @@ -3274,6 +3250,9 @@ _Default:_ `5m` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + _Default:_ `1` +|`max_docs` or `maxDocs` +|`number` - Maximum number of documents to process (default: all documents) + |`body` |`object` - The search definition using the Query DSL and the prototype for the index request. @@ -3497,7 +3476,7 @@ _Default:_ `512` |`max_concurrent_shard_requests` or `maxConcurrentShardRequests` |`number` - The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + -_Default:_ `The default is 5.` +_Default:_ `5` |`pre_filter_shard_size` or `preFilterShardSize` |`number` - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. + @@ -3913,9 +3892,6 @@ _Default:_ `true` |`routing` |`string` - Specific routing value. -|`parent` -|`string` - Parent id of documents. - |`realtime` |`boolean` - Specifies if request is real-time as opposed to near-real-time (default: true). @@ -3962,9 +3938,6 @@ link:{ref}/docs-update.html[Reference] |`lang` |`string` - The script language (default: painless) -|`parent` -|`string` - ID of the parent document. Is is only used for routing and when for the upsert request - |`refresh` |`'true', 'false', 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. @@ -4054,7 +4027,10 @@ _Default:_ `open` |`string` - Explicit timeout for each search request. Defaults to no timeout. |`size` -|`number` - Number of hits to return (default: 10) +|`number` - Deprecated, please use `max_docs` instead + +|`max_docs` or `maxDocs` +|`number` - Maximum number of documents to process (default: all documents) |`sort` |`string, string[]` - A comma-separated list of : pairs @@ -4874,6 +4850,10 @@ link:{ref}/ml-find-file-structure.html[Reference] |`number` - How many lines of the file should be included in the analysis + _Default:_ `1000` +|`line_merge_size_limit` or `lineMergeSizeLimit` +|`number` - Maximum number of characters permitted in a single message when lines are merged to create messages. + +_Default:_ `10000` + |`timeout` |`string` - Timeout after which the analysis will be aborted + _Default:_ `25s` From 097ecc51598ff0b40d5ac7c861bd2f3febfe4f53 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Tue, 11 Jun 2019 23:39:57 -0700 Subject: [PATCH 49/84] [DOCS] Fixes typo (#877) --- docs/examples/typescript.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/typescript.asciidoc b/docs/examples/typescript.asciidoc index 40e211f4b..32cc146fe 100644 --- a/docs/examples/typescript.asciidoc +++ b/docs/examples/typescript.asciidoc @@ -59,7 +59,7 @@ async function run (): void { client .search(params) .then((result: ApiResponse) => { - console.og(result.body.hits.hits) + console.log(result.body.hits.hits) }) .catch((err: Error) => { console.log(err) From a1ca9cdda0ff68aafe2f4bce8b19b1ef5b95a982 Mon Sep 17 00:00:00 2001 From: Jon Kelley Date: Fri, 14 Jun 2019 03:13:01 -0500 Subject: [PATCH 50/84] Added cloud configuration example (#880) * Added cloud configuration example * Used cloud example from auth docs and added link --- docs/configuration.asciidoc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index f737d521c..cab52c193 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -156,8 +156,19 @@ _Default:_ `elasticsearch-js` _Default:_ `{}` |`cloud` -|`object` - Custom configuration for connecting to https://cloud.elastic.co[Elastic Cloud]. + -_Default:_ `null` +a|`object` - Custom configuration for connecting to https://cloud.elastic.co[Elastic Cloud]. See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication] for more details. + +_Default:_ `null` + +_Cloud configuration example:_ +[source,js] +---- +const client = new Client({ + cloud: { + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + username: 'elastic', + password: 'changeme' + } +}) +---- |=== From ca50f580f41f509f1633103d3d69b5065af006c4 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 19 Jun 2019 09:14:19 +0200 Subject: [PATCH 51/84] Updated type definitions (#882) * Updated type definitions * Updated test --- index.d.ts | 22 +++++++++++++++++++--- lib/Connection.d.ts | 6 +++--- test/types/index.ts | 18 +++++++++++++++++- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/index.d.ts b/index.d.ts index a8018fdcd..72de2f9ed 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /// import { EventEmitter } from 'events'; -import { SecureContextOptions } from 'tls'; +import { ConnectionOptions as TlsConnectionOptions } from 'tls'; import Transport, { ApiResponse, RequestEvent, @@ -31,6 +31,7 @@ import Transport, { generateRequestIdFn, TransportRequestCallback } from './lib/Transport'; +import { URL } from 'url'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool'; import Serializer from './lib/Serializer'; @@ -72,8 +73,22 @@ interface ClientExtends { } // /Extend API +interface NodeOptions { + url: URL; + id?: string; + agent?: AgentOptions; + ssl?: TlsConnectionOptions; + headers?: anyObject; + roles?: { + master: boolean; + data: boolean; + ingest: boolean; + ml: boolean; + } +} + interface ClientOptions { - node?: string | string[]; + node?: string | string[] | NodeOptions | NodeOptions[]; nodes?: string | string[]; Connection?: typeof Connection; ConnectionPool?: typeof ConnectionPool; @@ -89,7 +104,7 @@ interface ClientOptions { resurrectStrategy?: 'ping' | 'optimistic' | 'none'; suggestCompression?: boolean; compression?: 'gzip'; - ssl?: SecureContextOptions; + ssl?: TlsConnectionOptions; agent?: AgentOptions | agentFn; nodeFilter?: nodeFilterFn; nodeSelector?: nodeSelectorFn | string; @@ -616,5 +631,6 @@ export { ResurrectEvent, RequestParams, ClientOptions, + NodeOptions, ClientExtendsCallbackOptions }; diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index 0c49207af..f2ab8532a 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -22,13 +22,13 @@ import { URL } from 'url'; import { inspect, InspectOptions } from 'util'; import * as http from 'http'; -import { SecureContextOptions } from 'tls'; +import { ConnectionOptions as TlsConnectionOptions } from 'tls'; export declare type agentFn = () => any; interface ConnectionOptions { url: URL; - ssl?: SecureContextOptions; + ssl?: TlsConnectionOptions; id?: string; headers?: any; agent?: AgentOptions | agentFn; @@ -59,7 +59,7 @@ export default class Connection { ML: string; }; url: URL; - ssl: SecureContextOptions | null; + ssl: TlsConnectionOptions | null; id: string; headers: any; deadCount: number; diff --git a/test/types/index.ts b/test/types/index.ts index 6f97182d4..2aa0526e9 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -27,13 +27,29 @@ import { ResurrectEvent, events, errors, - ClientExtendsCallbackOptions + ClientExtendsCallbackOptions, + NodeOptions } from '../../index' import { TransportRequestParams, TransportRequestOptions } from '../../lib/Transport' +import { URL } from 'url' const client = new Client({ node: 'http://localhost:9200' }) +const nodeOpts: NodeOptions = { + url: new URL('http://localhost:9200'), + id: 'winteriscoming', + headers: { 'foo': 'bar' }, + roles: { + master: false, + data: true, + ingest: false, + ml: false + } +} + +const client2 = new Client({ node: nodeOpts }) + client.on(events.RESPONSE, (err: errors.ElasticsearchClientError | null, request: RequestEvent) => { if (err) console.log(err) const { body, statusCode } = request From 21863965706e0ebfcbe34e0436bf3359579dc834 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 1 Jul 2019 12:41:44 +0200 Subject: [PATCH 52/84] API generation --- .../data_frame.get_data_frame_transform.js | 6 +- ...ta_frame.get_data_frame_transform_stats.js | 6 +- .../data_frame.stop_data_frame_transform.js | 8 +- api/api/delete_by_query.js | 2 - api/api/indices.reload_search_analyzers.js | 103 +++++++++++ api/api/ml.delete_data_frame_analytics.js | 100 ++++++++++ ...s_context.js => ml.evaluate_data_frame.js} | 32 ++-- api/api/ml.get_data_frame_analytics.js | 106 +++++++++++ api/api/ml.get_data_frame_analytics_stats.js | 106 +++++++++++ api/api/ml.put_data_frame_analytics.js | 101 ++++++++++ api/api/ml.start_data_frame_analytics.js | 98 ++++++++++ api/api/ml.stop_data_frame_analytics.js | 101 ++++++++++ api/api/update_by_query.js | 2 - api/index.js | 18 +- api/requestParams.d.ts | 56 +++++- docs/reference.asciidoc | 174 ++++++++++++++++-- index.d.ts | 18 +- 17 files changed, 982 insertions(+), 55 deletions(-) create mode 100644 api/api/indices.reload_search_analyzers.js create mode 100644 api/api/ml.delete_data_frame_analytics.js rename api/api/{scripts_painless_context.js => ml.evaluate_data_frame.js} (78%) create mode 100644 api/api/ml.get_data_frame_analytics.js create mode 100644 api/api/ml.get_data_frame_analytics_stats.js create mode 100644 api/api/ml.put_data_frame_analytics.js create mode 100644 api/api/ml.start_data_frame_analytics.js create mode 100644 api/api/ml.stop_data_frame_analytics.js diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index 160f75c7e..1d58d4321 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -31,15 +31,17 @@ function buildDataFrameGetDataFrameTransform (opts) { * @param {string} transform_id - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms * @param {int} from - skips a number of transform configs, defaults to 0 * @param {int} size - specifies a max number of transforms to get, defaults to 100 + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) */ const acceptedQuerystring = [ 'from', - 'size' + 'size', + 'allow_no_match' ] const snakeCase = { - + allowNoMatch: 'allow_no_match' } return function dataFrameGetDataFrameTransform (params, options, callback) { diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index c11e1e94b..ad6fac084 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -31,15 +31,17 @@ function buildDataFrameGetDataFrameTransformStats (opts) { * @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms * @param {number} from - skips a number of transform stats, defaults to 0 * @param {number} size - specifies a max number of transform stats to get, defaults to 100 + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) */ const acceptedQuerystring = [ 'from', - 'size' + 'size', + 'allow_no_match' ] const snakeCase = { - + allowNoMatch: 'allow_no_match' } return function dataFrameGetDataFrameTransformStats (params, options, callback) { diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index 87ee0929f..34d65ae76 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -31,16 +31,18 @@ function buildDataFrameStopDataFrameTransform (opts) { * @param {string} transform_id - The id of the transform to stop * @param {boolean} wait_for_completion - Whether to wait for the transform to fully stop before returning or not. Default to false * @param {time} timeout - Controls the time to wait until the transform has stopped. Default to 30 seconds + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) */ const acceptedQuerystring = [ 'wait_for_completion', - 'timeout' + 'timeout', + 'allow_no_match' ] const snakeCase = { - waitForCompletion: 'wait_for_completion' - + waitForCompletion: 'wait_for_completion', + allowNoMatch: 'allow_no_match' } return function dataFrameStopDataFrameTransform (params, options, callback) { diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 1283cf659..997909dea 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -45,7 +45,6 @@ function buildDeleteByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. - * @param {number} size - Deprecated, please use `max_docs` instead * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return @@ -82,7 +81,6 @@ function buildDeleteByQuery (opts) { 'scroll', 'search_type', 'search_timeout', - 'size', 'max_docs', 'sort', '_source', diff --git a/api/api/indices.reload_search_analyzers.js b/api/api/indices.reload_search_analyzers.js new file mode 100644 index 000000000..c4d36be6a --- /dev/null +++ b/api/api/indices.reload_search_analyzers.js @@ -0,0 +1,103 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildIndicesReloadSearchAnalyzers (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [indices.reload_search_analyzers](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html) request + * + * @param {list} index - A comma-separated list of index names to reload analyzers for + * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} allow_no_indices - 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 {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + */ + + const acceptedQuerystring = [ + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards' + ] + + const snakeCase = { + ignoreUnavailable: 'ignore_unavailable', + allowNoIndices: 'allow_no_indices', + expandWildcards: 'expand_wildcards' + } + + return function indicesReloadSearchAnalyzers (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = body == null ? 'GET' : 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + encodeURIComponent(index) + '/' + '_reload_search_analyzers' + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildIndicesReloadSearchAnalyzers diff --git a/api/api/ml.delete_data_frame_analytics.js b/api/api/ml.delete_data_frame_analytics.js new file mode 100644 index 000000000..900260bcc --- /dev/null +++ b/api/api/ml.delete_data_frame_analytics.js @@ -0,0 +1,100 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlDeleteDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.delete_data_frame_analytics](undefined) request + * + * @param {string} id - The ID of the data frame analytics to delete + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function mlDeleteDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'DELETE' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlDeleteDataFrameAnalytics diff --git a/api/api/scripts_painless_context.js b/api/api/ml.evaluate_data_frame.js similarity index 78% rename from api/api/scripts_painless_context.js rename to api/api/ml.evaluate_data_frame.js index b10b63ac9..e8c29307e 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/ml.evaluate_data_frame.js @@ -22,30 +22,24 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildScriptsPainlessContext (opts) { +function buildMlEvaluateDataFrame (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [scripts_painless_context](undefined) request + * Perform a [ml.evaluate_data_frame](undefined) request * - * @param {string} context - Select a specific context to retrieve API information about + * @param {object} body - The evaluation definition */ const acceptedQuerystring = [ - 'context', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' + ] const snakeCase = { - errorTrace: 'error_trace', - filterPath: 'filter_path' + } - return function scriptsPainlessContext (params, options, callback) { + return function mlEvaluateDataFrame (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -57,6 +51,12 @@ function buildScriptsPainlessContext (opts) { options = {} } + // check required parameters + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -68,7 +68,7 @@ function buildScriptsPainlessContext (opts) { querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { - method = 'GET' + method = 'POST' } var ignore = options.ignore @@ -78,13 +78,13 @@ function buildScriptsPainlessContext (opts) { var path = '' - path = '/' + '_scripts' + '/' + 'painless' + '/' + '_context' + path = '/' + '_ml' + '/' + 'data_frame' + '/' + '_evaluate' // build request object const request = { method, path, - body: null, + body: body || '', querystring } @@ -93,4 +93,4 @@ function buildScriptsPainlessContext (opts) { } } -module.exports = buildScriptsPainlessContext +module.exports = buildMlEvaluateDataFrame diff --git a/api/api/ml.get_data_frame_analytics.js b/api/api/ml.get_data_frame_analytics.js new file mode 100644 index 000000000..1a221ffb1 --- /dev/null +++ b/api/api/ml.get_data_frame_analytics.js @@ -0,0 +1,106 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlGetDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.get_data_frame_analytics](undefined) request + * + * @param {string} id - The ID of the data frame analytics to fetch + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {int} from - skips a number of analytics + * @param {int} size - specifies a max number of analytics to get + */ + + const acceptedQuerystring = [ + 'allow_no_match', + 'from', + 'size' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + return function mlGetDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + if ((id) != null) { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + } else { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlGetDataFrameAnalytics diff --git a/api/api/ml.get_data_frame_analytics_stats.js b/api/api/ml.get_data_frame_analytics_stats.js new file mode 100644 index 000000000..a9411722e --- /dev/null +++ b/api/api/ml.get_data_frame_analytics_stats.js @@ -0,0 +1,106 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlGetDataFrameAnalyticsStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.get_data_frame_analytics_stats](undefined) request + * + * @param {string} id - The ID of the data frame analytics stats to fetch + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {int} from - skips a number of analytics + * @param {int} size - specifies a max number of analytics to get + */ + + const acceptedQuerystring = [ + 'allow_no_match', + 'from', + 'size' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + return function mlGetDataFrameAnalyticsStats (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + if ((id) != null) { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stats' + } else { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_stats' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlGetDataFrameAnalyticsStats diff --git a/api/api/ml.put_data_frame_analytics.js b/api/api/ml.put_data_frame_analytics.js new file mode 100644 index 000000000..14d283749 --- /dev/null +++ b/api/api/ml.put_data_frame_analytics.js @@ -0,0 +1,101 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlPutDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.put_data_frame_analytics](undefined) request + * + * @param {string} id - The ID of the data frame analytics to create + * @param {object} body - The data frame analytics configuration + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function mlPutDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'PUT' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlPutDataFrameAnalytics diff --git a/api/api/ml.start_data_frame_analytics.js b/api/api/ml.start_data_frame_analytics.js new file mode 100644 index 000000000..a217a50e6 --- /dev/null +++ b/api/api/ml.start_data_frame_analytics.js @@ -0,0 +1,98 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlStartDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.start_data_frame_analytics](undefined) request + * + * @param {string} id - The ID of the data frame analytics to start + * @param {time} timeout - Controls the time to wait until the task has started. Defaults to 20 seconds + * @param {object} body - The start data frame analytics parameters + */ + + const acceptedQuerystring = [ + 'timeout' + ] + + const snakeCase = { + + } + + return function mlStartDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_start' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlStartDataFrameAnalytics diff --git a/api/api/ml.stop_data_frame_analytics.js b/api/api/ml.stop_data_frame_analytics.js new file mode 100644 index 000000000..0a8e933e5 --- /dev/null +++ b/api/api/ml.stop_data_frame_analytics.js @@ -0,0 +1,101 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlStopDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.stop_data_frame_analytics](undefined) request + * + * @param {string} id - The ID of the data frame analytics to stop + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {time} timeout - Controls the time to wait until the task has stopped. Defaults to 20 seconds + * @param {object} body - The stop data frame analytics parameters + */ + + const acceptedQuerystring = [ + 'allow_no_match', + 'timeout' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + return function mlStopDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stop' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlStopDataFrameAnalytics diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 98aa3cfa0..8a7330c4c 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -46,7 +46,6 @@ function buildUpdateByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. - * @param {number} size - Deprecated, please use `max_docs` instead * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return @@ -85,7 +84,6 @@ function buildUpdateByQuery (opts) { 'scroll', 'search_type', 'search_timeout', - 'size', 'max_docs', 'sort', '_source', diff --git a/api/index.js b/api/index.js index 461bfa8a4..230500784 100644 --- a/api/index.js +++ b/api/index.js @@ -217,6 +217,8 @@ function ESAPI (opts) { putTemplate: lazyLoad('indices.put_template', opts), recovery: lazyLoad('indices.recovery', opts), refresh: lazyLoad('indices.refresh', opts), + reload_search_analyzers: lazyLoad('indices.reload_search_analyzers', opts), + reloadSearchAnalyzers: lazyLoad('indices.reload_search_analyzers', opts), rollover: lazyLoad('indices.rollover', opts), segments: lazyLoad('indices.segments', opts), shard_stores: lazyLoad('indices.shard_stores', opts), @@ -269,6 +271,8 @@ function ESAPI (opts) { deleteCalendarEvent: lazyLoad('ml.delete_calendar_event', opts), delete_calendar_job: lazyLoad('ml.delete_calendar_job', opts), deleteCalendarJob: lazyLoad('ml.delete_calendar_job', opts), + delete_data_frame_analytics: lazyLoad('ml.delete_data_frame_analytics', opts), + deleteDataFrameAnalytics: lazyLoad('ml.delete_data_frame_analytics', opts), delete_datafeed: lazyLoad('ml.delete_datafeed', opts), deleteDatafeed: lazyLoad('ml.delete_datafeed', opts), delete_expired_data: lazyLoad('ml.delete_expired_data', opts), @@ -281,6 +285,8 @@ function ESAPI (opts) { deleteJob: lazyLoad('ml.delete_job', opts), delete_model_snapshot: lazyLoad('ml.delete_model_snapshot', opts), deleteModelSnapshot: lazyLoad('ml.delete_model_snapshot', opts), + evaluate_data_frame: lazyLoad('ml.evaluate_data_frame', opts), + evaluateDataFrame: lazyLoad('ml.evaluate_data_frame', opts), find_file_structure: lazyLoad('ml.find_file_structure', opts), findFileStructure: lazyLoad('ml.find_file_structure', opts), flush_job: lazyLoad('ml.flush_job', opts), @@ -294,6 +300,10 @@ function ESAPI (opts) { getCalendars: lazyLoad('ml.get_calendars', opts), get_categories: lazyLoad('ml.get_categories', opts), getCategories: lazyLoad('ml.get_categories', opts), + get_data_frame_analytics: lazyLoad('ml.get_data_frame_analytics', opts), + getDataFrameAnalytics: lazyLoad('ml.get_data_frame_analytics', opts), + get_data_frame_analytics_stats: lazyLoad('ml.get_data_frame_analytics_stats', opts), + getDataFrameAnalyticsStats: lazyLoad('ml.get_data_frame_analytics_stats', opts), get_datafeed_stats: lazyLoad('ml.get_datafeed_stats', opts), getDatafeedStats: lazyLoad('ml.get_datafeed_stats', opts), get_datafeeds: lazyLoad('ml.get_datafeeds', opts), @@ -325,6 +335,8 @@ function ESAPI (opts) { putCalendar: lazyLoad('ml.put_calendar', opts), put_calendar_job: lazyLoad('ml.put_calendar_job', opts), putCalendarJob: lazyLoad('ml.put_calendar_job', opts), + put_data_frame_analytics: lazyLoad('ml.put_data_frame_analytics', opts), + putDataFrameAnalytics: lazyLoad('ml.put_data_frame_analytics', opts), put_datafeed: lazyLoad('ml.put_datafeed', opts), putDatafeed: lazyLoad('ml.put_datafeed', opts), put_filter: lazyLoad('ml.put_filter', opts), @@ -335,8 +347,12 @@ function ESAPI (opts) { revertModelSnapshot: lazyLoad('ml.revert_model_snapshot', opts), set_upgrade_mode: lazyLoad('ml.set_upgrade_mode', opts), setUpgradeMode: lazyLoad('ml.set_upgrade_mode', opts), + start_data_frame_analytics: lazyLoad('ml.start_data_frame_analytics', opts), + startDataFrameAnalytics: lazyLoad('ml.start_data_frame_analytics', opts), start_datafeed: lazyLoad('ml.start_datafeed', opts), startDatafeed: lazyLoad('ml.start_datafeed', opts), + stop_data_frame_analytics: lazyLoad('ml.stop_data_frame_analytics', opts), + stopDataFrameAnalytics: lazyLoad('ml.stop_data_frame_analytics', opts), stop_datafeed: lazyLoad('ml.stop_datafeed', opts), stopDatafeed: lazyLoad('ml.stop_datafeed', opts), update_datafeed: lazyLoad('ml.update_datafeed', opts), @@ -395,8 +411,6 @@ function ESAPI (opts) { stop_job: lazyLoad('rollup.stop_job', opts), stopJob: lazyLoad('rollup.stop_job', opts) }, - scripts_painless_context: lazyLoad('scripts_painless_context', opts), - scriptsPainlessContext: lazyLoad('scripts_painless_context', opts), scripts_painless_execute: lazyLoad('scripts_painless_execute', opts), scriptsPainlessExecute: lazyLoad('scripts_painless_execute', opts), scroll: lazyLoad('scroll', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 32e92b517..4d340a6b2 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -405,7 +405,6 @@ export interface DeleteByQuery extends Generic { scroll?: string; search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; - size?: number; max_docs?: number; sort?: string | string[]; _source?: string | string[]; @@ -1074,10 +1073,6 @@ export interface RenderSearchTemplate extends Generic { body?: T; } -export interface ScriptsPainlessContext extends Generic { - context?: string; -} - export interface ScriptsPainlessExecute extends Generic { body?: T; } @@ -1310,7 +1305,6 @@ export interface UpdateByQuery extends Generic { scroll?: string; search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; - size?: number; max_docs?: number; sort?: string | string[]; _source?: string | string[]; @@ -1392,12 +1386,14 @@ export interface DataFrameGetDataFrameTransform extends Generic { transform_id?: string; from?: number; size?: number; + allow_no_match?: boolean; } export interface DataFrameGetDataFrameTransformStats extends Generic { transform_id?: string; from?: number; size?: number; + allow_no_match?: boolean; } export interface DataFramePreviewDataFrameTransform extends Generic { @@ -1418,6 +1414,7 @@ export interface DataFrameStopDataFrameTransform extends Generic { transform_id: string; wait_for_completion?: boolean; timeout?: string; + allow_no_match?: boolean; } export interface GraphExplore extends Generic { @@ -1477,6 +1474,13 @@ export interface IndicesFreeze extends Generic { wait_for_active_shards?: string; } +export interface IndicesReloadSearchAnalyzers extends Generic { + index?: string | string[]; + ignore_unavailable?: boolean; + allow_no_indices?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; +} + export interface IndicesUnfreeze extends Generic { index: string; timeout?: string; @@ -1540,6 +1544,10 @@ export interface MlDeleteCalendarJob extends Generic { job_id: string; } +export interface MlDeleteDataFrameAnalytics extends Generic { + id: string; +} + export interface MlDeleteDatafeed extends Generic { datafeed_id: string; force?: boolean; @@ -1570,6 +1578,10 @@ export interface MlDeleteModelSnapshot extends Generic { snapshot_id: string; } +export interface MlEvaluateDataFrame extends Generic { + body: T; +} + export interface MlFindFileStructure extends Generic { lines_to_sample?: number; line_merge_size_limit?: number; @@ -1643,6 +1655,20 @@ export interface MlGetCategories extends Generic { body?: T; } +export interface MlGetDataFrameAnalytics extends Generic { + id?: string; + allow_no_match?: boolean; + from?: number; + size?: number; +} + +export interface MlGetDataFrameAnalyticsStats extends Generic { + id?: string; + allow_no_match?: boolean; + from?: number; + size?: number; +} + export interface MlGetDatafeedStats extends Generic { datafeed_id?: string; allow_no_datafeeds?: boolean; @@ -1754,6 +1780,11 @@ export interface MlPutCalendarJob extends Generic { job_id: string; } +export interface MlPutDataFrameAnalytics extends Generic { + id: string; + body: T; +} + export interface MlPutDatafeed extends Generic { datafeed_id: string; body: T; @@ -1781,6 +1812,12 @@ export interface MlSetUpgradeMode extends Generic { timeout?: string; } +export interface MlStartDataFrameAnalytics extends Generic { + id: string; + timeout?: string; + body?: T; +} + export interface MlStartDatafeed extends Generic { datafeed_id: string; start?: string; @@ -1789,6 +1826,13 @@ export interface MlStartDatafeed extends Generic { body?: T; } +export interface MlStopDataFrameAnalytics extends Generic { + id: string; + allow_no_match?: boolean; + timeout?: string; + body?: T; +} + export interface MlStopDatafeed extends Generic { datafeed_id: string; allow_no_datafeeds?: boolean; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index ed540b1c8..348b796a8 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1205,9 +1205,6 @@ _Default:_ `open` |`search_timeout` or `searchTimeout` |`string` - Explicit timeout for each search request. Defaults to no timeout. -|`size` -|`number` - Deprecated, please use `max_docs` instead - |`max_docs` or `maxDocs` |`number` - Maximum number of documents to process (default: all documents) @@ -3290,18 +3287,6 @@ link:{ref}/search-template.html[Reference] |=== -=== scriptsPainlessContext -[source,js] ----- -client.scriptsPainlessContext([params] [, options] [, callback]) ----- -[cols=2*] -|=== -|`context` -|`string` - Select a specific context to retrieve API information about - -|=== - === scriptsPainlessExecute [source,js] ---- @@ -4026,9 +4011,6 @@ _Default:_ `open` |`search_timeout` or `searchTimeout` |`string` - Explicit timeout for each search request. Defaults to no timeout. -|`size` -|`number` - Deprecated, please use `max_docs` instead - |`max_docs` or `maxDocs` |`number` - Maximum number of documents to process (default: all documents) @@ -4288,6 +4270,9 @@ link:{ref}/get-data-frame-transform.html[Reference] |`size` |`number` - specifies a max number of transforms to get, defaults to 100 +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) + |=== === dataFrame.getDataFrameTransformStats @@ -4307,6 +4292,9 @@ link:{ref}/get-data-frame-transform-stats.html[Reference] |`size` |`number` - specifies a max number of transform stats to get, defaults to 100 +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) + |=== === dataFrame.previewDataFrameTransform @@ -4371,6 +4359,9 @@ link:{ref}/stop-data-frame-transform.html[Reference] |`timeout` |`string` - Controls the time to wait until the transform has stopped. Default to 30 seconds +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) + |=== === graph.explore @@ -4551,6 +4542,29 @@ _Default:_ `closed` |=== +=== indices.reloadSearchAnalyzers +[source,js] +---- +client.indices.reloadSearchAnalyzers([params] [, options] [, callback]) +---- +link:{ref}/indices-reload-analyzers.html[Reference] +[cols=2*] +|=== +|`index` +|`string, string[]` - A comma-separated list of index names to reload analyzers for + +|`ignore_unavailable` or `ignoreUnavailable` +|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) + +|`allow_no_indices` or `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) + +|`expand_wildcards` or `expandWildcards` +|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `open` + +|=== + === indices.unfreeze [source,js] ---- @@ -4745,6 +4759,18 @@ client.ml.deleteCalendarJob([params] [, options] [, callback]) |=== +=== ml.deleteDataFrameAnalytics +[source,js] +---- +client.ml.deleteDataFrameAnalytics([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to delete + +|=== + === ml.deleteDatafeed [source,js] ---- @@ -4838,6 +4864,18 @@ link:{ref}/ml-delete-snapshot.html[Reference] |=== +=== ml.evaluateDataFrame +[source,js] +---- +client.ml.evaluateDataFrame([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`body` +|`object` - The evaluation definition + +|=== + === ml.findFileStructure [source,js] ---- @@ -5064,6 +5102,52 @@ link:{ref}/ml-get-category.html[Reference] |=== +=== ml.getDataFrameAnalytics +[source,js] +---- +client.ml.getDataFrameAnalytics([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to fetch + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + +_Default:_ `true` + +|`from` +|`number` - skips a number of analytics + +|`size` +|`number` - specifies a max number of analytics to get + +_Default:_ `100` + +|=== + +=== ml.getDataFrameAnalyticsStats +[source,js] +---- +client.ml.getDataFrameAnalyticsStats([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics stats to fetch + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + +_Default:_ `true` + +|`from` +|`number` - skips a number of analytics + +|`size` +|`number` - specifies a max number of analytics to get + +_Default:_ `100` + +|=== + === ml.getDatafeedStats [source,js] ---- @@ -5406,6 +5490,21 @@ client.ml.putCalendarJob([params] [, options] [, callback]) |=== +=== ml.putDataFrameAnalytics +[source,js] +---- +client.ml.putDataFrameAnalytics([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to create + +|`body` +|`object` - The data frame analytics configuration + +|=== + === ml.putDatafeed [source,js] ---- @@ -5491,6 +5590,24 @@ link:{ref}/ml-set-upgrade-mode.html[Reference] |=== +=== ml.startDataFrameAnalytics +[source,js] +---- +client.ml.startDataFrameAnalytics([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to start + +|`timeout` +|`string` - Controls the time to wait until the task has started. Defaults to 20 seconds + +|`body` +|`object` - The start data frame analytics parameters + +|=== + === ml.startDatafeed [source,js] ---- @@ -5516,6 +5633,27 @@ link:{ref}/ml-start-datafeed.html[Reference] |=== +=== ml.stopDataFrameAnalytics +[source,js] +---- +client.ml.stopDataFrameAnalytics([params] [, options] [, callback]) +---- +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to stop + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + +|`timeout` +|`string` - Controls the time to wait until the task has stopped. Defaults to 20 seconds + +|`body` +|`object` - The stop data frame analytics parameters + +|=== + === ml.stopDatafeed [source,js] ---- diff --git a/index.d.ts b/index.d.ts index 72de2f9ed..a2ac04692 100644 --- a/index.d.ts +++ b/index.d.ts @@ -312,6 +312,8 @@ declare class Client extends EventEmitter { putTemplate: ApiMethod recovery: ApiMethod refresh: ApiMethod + reload_search_analyzers: ApiMethod + reloadSearchAnalyzers: ApiMethod rollover: ApiMethod segments: ApiMethod shard_stores: ApiMethod @@ -364,6 +366,8 @@ declare class Client extends EventEmitter { deleteCalendarEvent: ApiMethod delete_calendar_job: ApiMethod deleteCalendarJob: ApiMethod + delete_data_frame_analytics: ApiMethod + deleteDataFrameAnalytics: ApiMethod delete_datafeed: ApiMethod deleteDatafeed: ApiMethod delete_expired_data: ApiMethod @@ -376,6 +380,8 @@ declare class Client extends EventEmitter { deleteJob: ApiMethod delete_model_snapshot: ApiMethod deleteModelSnapshot: ApiMethod + evaluate_data_frame: ApiMethod + evaluateDataFrame: ApiMethod find_file_structure: ApiMethod findFileStructure: ApiMethod flush_job: ApiMethod @@ -389,6 +395,10 @@ declare class Client extends EventEmitter { getCalendars: ApiMethod get_categories: ApiMethod getCategories: ApiMethod + get_data_frame_analytics: ApiMethod + getDataFrameAnalytics: ApiMethod + get_data_frame_analytics_stats: ApiMethod + getDataFrameAnalyticsStats: ApiMethod get_datafeed_stats: ApiMethod getDatafeedStats: ApiMethod get_datafeeds: ApiMethod @@ -420,6 +430,8 @@ declare class Client extends EventEmitter { putCalendar: ApiMethod put_calendar_job: ApiMethod putCalendarJob: ApiMethod + put_data_frame_analytics: ApiMethod + putDataFrameAnalytics: ApiMethod put_datafeed: ApiMethod putDatafeed: ApiMethod put_filter: ApiMethod @@ -430,8 +442,12 @@ declare class Client extends EventEmitter { revertModelSnapshot: ApiMethod set_upgrade_mode: ApiMethod setUpgradeMode: ApiMethod + start_data_frame_analytics: ApiMethod + startDataFrameAnalytics: ApiMethod start_datafeed: ApiMethod startDatafeed: ApiMethod + stop_data_frame_analytics: ApiMethod + stopDataFrameAnalytics: ApiMethod stop_datafeed: ApiMethod stopDatafeed: ApiMethod update_datafeed: ApiMethod @@ -490,8 +506,6 @@ declare class Client extends EventEmitter { stop_job: ApiMethod stopJob: ApiMethod } - scripts_painless_context: ApiMethod - scriptsPainlessContext: ApiMethod scripts_painless_execute: ApiMethod scriptsPainlessExecute: ApiMethod scroll: ApiMethod From eadf9a77e877670b7230b0221211bd7c21de66c6 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 1 Jul 2019 14:18:58 +0200 Subject: [PATCH 53/84] Updated test blacklist --- test/integration/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/integration/index.js b/test/integration/index.js index 13b0b7648..bfacb9490 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -52,6 +52,12 @@ const platinumBlackList = { 'indices.get_alias/20_empty.yml': ['Check empty aliases when getting all aliases via /_alias'], // https://github.com/elastic/elasticsearch/pull/39400 'ml/jobs_crud.yml': ['Test put job with id that is already taken'], + // object keys must me strings, and `0.0.toString()` is `0` + 'ml/evaluate_data_frame.yml': [ + 'Test binary_soft_classifition precision', + 'Test binary_soft_classifition recall', + 'Test binary_soft_classifition confusion_matrix' + ], // it gets random failures on CI, must investigate 'ml/set_upgrade_mode.yml': [ 'Attempt to open job when upgrade_mode is enabled', From d00564722e8547544e4957aa9de42afe6be3b595 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 4 Jul 2019 12:11:34 +0200 Subject: [PATCH 54/84] API generation --- api/api/ml.stop_data_frame_analytics.js | 2 + api/api/security.get_builtin_privileges.js | 95 ++++++++++++++++++++++ api/api/security.get_privileges.js | 2 +- api/index.js | 2 + api/requestParams.d.ts | 4 + docs/reference.asciidoc | 13 ++- index.d.ts | 2 + 7 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 api/api/security.get_builtin_privileges.js diff --git a/api/api/ml.stop_data_frame_analytics.js b/api/api/ml.stop_data_frame_analytics.js index 0a8e933e5..6cb7823f2 100644 --- a/api/api/ml.stop_data_frame_analytics.js +++ b/api/api/ml.stop_data_frame_analytics.js @@ -30,12 +30,14 @@ function buildMlStopDataFrameAnalytics (opts) { * * @param {string} id - The ID of the data frame analytics to stop * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {boolean} force - True if the data frame analytics should be forcefully stopped * @param {time} timeout - Controls the time to wait until the task has stopped. Defaults to 20 seconds * @param {object} body - The stop data frame analytics parameters */ const acceptedQuerystring = [ 'allow_no_match', + 'force', 'timeout' ] diff --git a/api/api/security.get_builtin_privileges.js b/api/api/security.get_builtin_privileges.js new file mode 100644 index 000000000..3a9bbf4d7 --- /dev/null +++ b/api/api/security.get_builtin_privileges.js @@ -0,0 +1,95 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildSecurityGetBuiltinPrivileges (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [security.get_builtin_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-builtin-privileges.html) request + * + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function securityGetBuiltinPrivileges (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_security' + '/' + 'privilege' + '/' + '_builtin' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildSecurityGetBuiltinPrivileges diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index 5bea2a86c..ca19de5cb 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -26,7 +26,7 @@ function buildSecurityGetPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [security.get_privileges](TODO) request + * Perform a [security.get_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html) request * * @param {string} application - Application name * @param {string} name - Privilege name diff --git a/api/index.js b/api/index.js index 230500784..9ad5a45c8 100644 --- a/api/index.js +++ b/api/index.js @@ -443,6 +443,8 @@ function ESAPI (opts) { enableUser: lazyLoad('security.enable_user', opts), get_api_key: lazyLoad('security.get_api_key', opts), getApiKey: lazyLoad('security.get_api_key', opts), + get_builtin_privileges: lazyLoad('security.get_builtin_privileges', opts), + getBuiltinPrivileges: lazyLoad('security.get_builtin_privileges', opts), get_privileges: lazyLoad('security.get_privileges', opts), getPrivileges: lazyLoad('security.get_privileges', opts), get_role: lazyLoad('security.get_role', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 4d340a6b2..e92877535 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -1829,6 +1829,7 @@ export interface MlStartDatafeed extends Generic { export interface MlStopDataFrameAnalytics extends Generic { id: string; allow_no_match?: boolean; + force?: boolean; timeout?: string; body?: T; } @@ -1977,6 +1978,9 @@ export interface SecurityGetApiKey extends Generic { realm_name?: string; } +export interface SecurityGetBuiltinPrivileges extends Generic { +} + export interface SecurityGetPrivileges extends Generic { application?: string; name?: string; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 348b796a8..1e82a6458 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -5646,6 +5646,9 @@ client.ml.stopDataFrameAnalytics([params] [, options] [, callback]) |`allow_no_match` or `allowNoMatch` |`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) +|`force` +|`boolean` - True if the data frame analytics should be forcefully stopped + |`timeout` |`string` - Controls the time to wait until the task has stopped. Defaults to 20 seconds @@ -6101,12 +6104,20 @@ link:{ref}/security-api-get-api-key.html[Reference] |=== +=== security.getBuiltinPrivileges +[source,js] +---- +client.security.getBuiltinPrivileges([params] [, options] [, callback]) +---- +link:{ref}/security-api-get-builtin-privileges.html[Reference] + + === security.getPrivileges [source,js] ---- client.security.getPrivileges([params] [, options] [, callback]) ---- -link:TODO[Reference] +link:{ref}/security-api-get-privileges.html[Reference] [cols=2*] |=== |`application` diff --git a/index.d.ts b/index.d.ts index a2ac04692..84acfeaf8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -538,6 +538,8 @@ declare class Client extends EventEmitter { enableUser: ApiMethod get_api_key: ApiMethod getApiKey: ApiMethod + get_builtin_privileges: ApiMethod + getBuiltinPrivileges: ApiMethod get_privileges: ApiMethod getPrivileges: ApiMethod get_role: ApiMethod From 1a3dbeb94be00ef68dad9e62d51bc6fbdf8b03f0 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 4 Jul 2019 13:56:06 +0200 Subject: [PATCH 55/84] Remove auth data from inspect and toJSON in connection class (#887) * Remove auth data from inspect and toJSON in connection class * Updated test --- lib/Connection.js | 4 +-- test/unit/connection.test.js | 47 ++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index 5d033e717..1501d65d7 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -231,7 +231,7 @@ class Connection { // access them with `instance.agent` and `instance.ssl`. [inspect.custom] (depth, options) { return { - url: this.url, + url: stripAuth(this.url.toString()), id: this.id, headers: this.headers, deadCount: this.deadCount, @@ -244,7 +244,7 @@ class Connection { toJSON () { return { - url: this.url, + url: stripAuth(this.url.toString()), id: this.id, headers: this.headers, deadCount: this.deadCount, diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 2ecad0ff1..ea9a2503b 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -723,11 +723,11 @@ test('setRole', t => { t.end() }) -test('Util.inspect Connection class should hide agent and ssl', t => { +test('Util.inspect Connection class should hide agent, ssl and auth', t => { t.plan(1) const connection = new Connection({ - url: new URL('http://localhost:9200'), + url: new URL('http://user:password@localhost:9200'), id: 'node-id', headers: { foo: 'bar' } }) @@ -741,20 +741,7 @@ test('Util.inspect Connection class should hide agent and ssl', t => { .replace(/(\r\n|\n|\r)/gm, '') } - t.strictEqual(cleanStr(inspect(connection)), cleanStr(`{ url: - URL { - href: 'http://localhost:9200/', - origin: 'http://localhost:9200', - protocol: 'http:', - username: '', - password: '', - host: 'localhost:9200', - hostname: 'localhost', - port: '9200', - pathname: '/', - search: '', - searchParams: URLSearchParams {}, - hash: '' }, + t.strictEqual(cleanStr(inspect(connection)), cleanStr(`{ url: 'http://localhost:9200/', id: 'node-id', headers: { foo: 'bar' }, deadCount: 0, @@ -765,6 +752,34 @@ test('Util.inspect Connection class should hide agent and ssl', t => { ) }) +test('connection.toJSON should hide agent, ssl and auth', t => { + t.plan(1) + + const connection = new Connection({ + url: new URL('http://user:password@localhost:9200'), + id: 'node-id', + headers: { foo: 'bar' } + }) + + t.deepEqual(connection.toJSON(), { + url: 'http://localhost:9200/', + id: 'node-id', + headers: { + foo: 'bar' + }, + deadCount: 0, + resurrectTimeout: 0, + _openRequests: 0, + status: 'alive', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }) +}) + // https://github.com/elastic/elasticsearch-js/issues/843 test('Port handling', t => { t.test('http 80', t => { From a3eb4d28747aead4c66fdd942b0e5db1f65e3b97 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 8 Jul 2019 16:29:10 +0200 Subject: [PATCH 56/84] Updated travis configuration (#894) * Updated travis configuration * Run license checker only in Linux * Fixed script * Fix windows test --- .travis.yml | 11 ++++++----- test/behavior/resurrect.test.js | 5 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49778bef5..ecbed2c22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,3 @@ -dist: trusty - -sudo: required - language: node_js node_js: @@ -9,11 +5,16 @@ node_js: - "10" - "8" +os: + - windows + - linux + install: - npm install script: - - npm run license-checker && npm run test + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then npm run license-checker; fi + - npm run test notifications: email: diff --git a/test/behavior/resurrect.test.js b/test/behavior/resurrect.test.js index 8c4d38ba2..6b1a28cfd 100644 --- a/test/behavior/resurrect.test.js +++ b/test/behavior/resurrect.test.js @@ -98,10 +98,9 @@ test('Resurrect a node and handle 502/3/4 status code', t => { var count = 0 function handler (req, res) { - res.statusCode = count < 2 ? 502 : 200 + res.statusCode = count++ < 2 ? 502 : 200 res.setHeader('content-type', 'application/json') res.end(JSON.stringify({ hello: 'world' })) - count++ } buildCluster({ handler, numberOfNodes: 2 }, ({ nodes, shutdown }) => { @@ -123,7 +122,7 @@ test('Resurrect a node and handle 502/3/4 status code', t => { t.strictEqual(meta.connection.id, 'node0') t.strictEqual(meta.name, 'elasticsearch-js') t.deepEqual(meta.request, { id: idCount++ }) - if (count < 3) { + if (count < 4) { t.false(meta.isAlive) } else { t.true(meta.isAlive) From ea3cd7dd58b5aade39fc3040fca619fb67a76a36 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 8 Jul 2019 16:31:46 +0200 Subject: [PATCH 57/84] API generation --- api/api/ml.delete_data_frame_analytics.js | 2 +- api/api/ml.evaluate_data_frame.js | 2 +- api/api/ml.get_data_frame_analytics.js | 2 +- api/api/ml.get_data_frame_analytics_stats.js | 2 +- api/api/ml.put_data_frame_analytics.js | 2 +- api/api/ml.start_data_frame_analytics.js | 2 +- api/api/ml.stop_data_frame_analytics.js | 2 +- docs/reference.asciidoc | 7 +++++++ 8 files changed, 14 insertions(+), 7 deletions(-) diff --git a/api/api/ml.delete_data_frame_analytics.js b/api/api/ml.delete_data_frame_analytics.js index 900260bcc..f1f9c10bb 100644 --- a/api/api/ml.delete_data_frame_analytics.js +++ b/api/api/ml.delete_data_frame_analytics.js @@ -26,7 +26,7 @@ function buildMlDeleteDataFrameAnalytics (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.delete_data_frame_analytics](undefined) request + * Perform a [ml.delete_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html) request * * @param {string} id - The ID of the data frame analytics to delete */ diff --git a/api/api/ml.evaluate_data_frame.js b/api/api/ml.evaluate_data_frame.js index e8c29307e..861a649c0 100644 --- a/api/api/ml.evaluate_data_frame.js +++ b/api/api/ml.evaluate_data_frame.js @@ -26,7 +26,7 @@ function buildMlEvaluateDataFrame (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.evaluate_data_frame](undefined) request + * Perform a [ml.evaluate_data_frame](http://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html) request * * @param {object} body - The evaluation definition */ diff --git a/api/api/ml.get_data_frame_analytics.js b/api/api/ml.get_data_frame_analytics.js index 1a221ffb1..809a46682 100644 --- a/api/api/ml.get_data_frame_analytics.js +++ b/api/api/ml.get_data_frame_analytics.js @@ -26,7 +26,7 @@ function buildMlGetDataFrameAnalytics (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.get_data_frame_analytics](undefined) request + * Perform a [ml.get_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html) request * * @param {string} id - The ID of the data frame analytics to fetch * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) diff --git a/api/api/ml.get_data_frame_analytics_stats.js b/api/api/ml.get_data_frame_analytics_stats.js index a9411722e..a926eedb7 100644 --- a/api/api/ml.get_data_frame_analytics_stats.js +++ b/api/api/ml.get_data_frame_analytics_stats.js @@ -26,7 +26,7 @@ function buildMlGetDataFrameAnalyticsStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.get_data_frame_analytics_stats](undefined) request + * Perform a [ml.get_data_frame_analytics_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html) request * * @param {string} id - The ID of the data frame analytics stats to fetch * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) diff --git a/api/api/ml.put_data_frame_analytics.js b/api/api/ml.put_data_frame_analytics.js index 14d283749..f18e7912e 100644 --- a/api/api/ml.put_data_frame_analytics.js +++ b/api/api/ml.put_data_frame_analytics.js @@ -26,7 +26,7 @@ function buildMlPutDataFrameAnalytics (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.put_data_frame_analytics](undefined) request + * Perform a [ml.put_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html) request * * @param {string} id - The ID of the data frame analytics to create * @param {object} body - The data frame analytics configuration diff --git a/api/api/ml.start_data_frame_analytics.js b/api/api/ml.start_data_frame_analytics.js index a217a50e6..df5ff817f 100644 --- a/api/api/ml.start_data_frame_analytics.js +++ b/api/api/ml.start_data_frame_analytics.js @@ -26,7 +26,7 @@ function buildMlStartDataFrameAnalytics (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.start_data_frame_analytics](undefined) request + * Perform a [ml.start_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/start-dfanalytics.html) request * * @param {string} id - The ID of the data frame analytics to start * @param {time} timeout - Controls the time to wait until the task has started. Defaults to 20 seconds diff --git a/api/api/ml.stop_data_frame_analytics.js b/api/api/ml.stop_data_frame_analytics.js index 6cb7823f2..212a59b9f 100644 --- a/api/api/ml.stop_data_frame_analytics.js +++ b/api/api/ml.stop_data_frame_analytics.js @@ -26,7 +26,7 @@ function buildMlStopDataFrameAnalytics (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [ml.stop_data_frame_analytics](undefined) request + * Perform a [ml.stop_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/stop-dfanalytics.html) request * * @param {string} id - The ID of the data frame analytics to stop * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 1e82a6458..eb9b7c2a7 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -4764,6 +4764,7 @@ client.ml.deleteCalendarJob([params] [, options] [, callback]) ---- client.ml.deleteDataFrameAnalytics([params] [, options] [, callback]) ---- +link:{ref}/delete-dfanalytics.html[Reference] [cols=2*] |=== |`id` @@ -4869,6 +4870,7 @@ link:{ref}/ml-delete-snapshot.html[Reference] ---- client.ml.evaluateDataFrame([params] [, options] [, callback]) ---- +link:{ref}/evaluate-dfanalytics.html[Reference] [cols=2*] |=== |`body` @@ -5107,6 +5109,7 @@ link:{ref}/ml-get-category.html[Reference] ---- client.ml.getDataFrameAnalytics([params] [, options] [, callback]) ---- +link:{ref}/get-dfanalytics.html[Reference] [cols=2*] |=== |`id` @@ -5130,6 +5133,7 @@ _Default:_ `100` ---- client.ml.getDataFrameAnalyticsStats([params] [, options] [, callback]) ---- +link:{ref}/get-dfanalytics-stats.html[Reference] [cols=2*] |=== |`id` @@ -5495,6 +5499,7 @@ client.ml.putCalendarJob([params] [, options] [, callback]) ---- client.ml.putDataFrameAnalytics([params] [, options] [, callback]) ---- +link:{ref}/put-dfanalytics.html[Reference] [cols=2*] |=== |`id` @@ -5595,6 +5600,7 @@ link:{ref}/ml-set-upgrade-mode.html[Reference] ---- client.ml.startDataFrameAnalytics([params] [, options] [, callback]) ---- +link:{ref}/start-dfanalytics.html[Reference] [cols=2*] |=== |`id` @@ -5638,6 +5644,7 @@ link:{ref}/ml-start-datafeed.html[Reference] ---- client.ml.stopDataFrameAnalytics([params] [, options] [, callback]) ---- +link:{ref}/stop-dfanalytics.html[Reference] [cols=2*] |=== |`id` From 6c8b99f78a74a15ad817255fe22af11216d3b9f8 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 10 Jul 2019 15:27:44 +0200 Subject: [PATCH 58/84] Improve integration test (#859) * CI: Added junit plugin * Updated .gitignore * Added integration test reporter * Updated integration testing suite * Updated ci config * Updated report file path * Use refresh 'true' instead of 'wait_for' * Disable junit reporting * Refresh one single time * Update security index name * Updated skip test handling and use class syntax * Updated test script * Disable test timeout * Added command to automatically remove an old snapshot * Disable timeout in integration test script * Updated logs and cleaned up git handling * Fixed shouldSkip utility * Updated cleanup code * Updated cleanup code pt 2 * Rename Platinum to XPack --- .ci/jobs/defaults.yml | 3 + .gitignore | 2 + package.json | 4 +- scripts/es-docker-platinum.sh | 5 + scripts/es-docker.sh | 5 + test/integration/helper.js | 12 +- test/integration/index.js | 454 ++++++------ test/integration/test-runner.js | 1221 +++++++++++++++---------------- 8 files changed, 834 insertions(+), 872 deletions(-) diff --git a/.ci/jobs/defaults.yml b/.ci/jobs/defaults.yml index 1ccaa8b08..5b4b1f68c 100644 --- a/.ci/jobs/defaults.yml +++ b/.ci/jobs/defaults.yml @@ -65,3 +65,6 @@ publishers: - email: recipients: infra-root+build@elastic.co + # - junit: + # results: "*-junit.xml" + # allow-empty-results: true diff --git a/.gitignore b/.gitignore index b726b15e7..a5768f2f9 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,5 @@ elasticsearch* api/generated.d.ts test/benchmarks/macro/fixtures/* + +*-junit.xml diff --git a/package.json b/package.json index 054398efe..41eef9a94 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types", "test:unit": "tap test/unit/*.test.js -t 300 --no-coverage", "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage", - "test:integration": "tap test/integration/index.js -T --harmony --no-esm --no-coverage", + "test:integration": "tap test/integration/index.js -T --no-coverage", + "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > $WORKSPACE/test-report-junit.xml", "test:types": "tsc --project ./test/types/tsconfig.json", "test:coverage": "nyc npm run test:unit && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", @@ -56,6 +57,7 @@ "standard": "^12.0.1", "stoppable": "^1.1.0", "tap": "^13.0.1", + "tap-mocha-reporter": "^4.0.1", "typescript": "^3.4.5", "workq": "^2.1.0" }, diff --git a/scripts/es-docker-platinum.sh b/scripts/es-docker-platinum.sh index 9b6b69494..03171a275 100755 --- a/scripts/es-docker-platinum.sh +++ b/scripts/es-docker-platinum.sh @@ -9,6 +9,11 @@ testnodecrt="/.ci/certs/testnode.crt" testnodekey="/.ci/certs/testnode.key" cacrt="/.ci/certs/ca.crt" +# pass `--clean` to reemove the old snapshot +if [ "$1" != "" ]; then + docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') +fi + exec docker run \ --rm \ -e "node.attr.testattr=test" \ diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index b50050389..794e77684 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -4,6 +4,11 @@ # to delete an old image and download again # the latest snapshot. +# pass `--clean` to reemove the old snapshot +if [ "$1" != "" ]; then + docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') +fi + exec docker run \ --rm \ -e "node.attr.testattr=test" \ diff --git a/test/integration/helper.js b/test/integration/helper.js index ded90388d..0cfb8eba3 100644 --- a/test/integration/helper.js +++ b/test/integration/helper.js @@ -58,11 +58,11 @@ const esDefaultUsers = [ 'remote_monitoring_user' ] -function runInParallel (client, operation, options) { +function runInParallel (client, operation, options, clientOptions) { if (options.length === 0) return Promise.resolve() const operations = options.map(opts => { const api = delve(client, operation).bind(client) - return api(opts) + return api(opts, clientOptions) }) return Promise.all(operations) @@ -82,4 +82,10 @@ function delve (obj, key, def, p) { return (obj === undefined || p < key.length) ? def : obj } -module.exports = { runInParallel, esDefaultRoles, esDefaultUsers, delve } +function to (promise) { + return promise.then(data => [null, data], err => [err, undefined]) +} + +const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) + +module.exports = { runInParallel, esDefaultRoles, esDefaultUsers, delve, to, sleep } diff --git a/test/integration/index.js b/test/integration/index.js index bfacb9490..2280de5ef 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -19,32 +19,32 @@ 'use strict' -const assert = require('assert') const { readFileSync, accessSync, mkdirSync, readdirSync, statSync } = require('fs') const { join, sep } = require('path') const yaml = require('js-yaml') const Git = require('simple-git') -const ora = require('ora') const tap = require('tap') const { Client } = require('../../index') const TestRunner = require('./test-runner') +const { sleep } = require('./helper') const esRepo = 'https://github.com/elastic/elasticsearch.git' const esFolder = join(__dirname, '..', '..', 'elasticsearch') const yamlFolder = join(esFolder, 'rest-api-spec', 'src', 'main', 'resources', 'rest-api-spec', 'test') const xPackYamlFolder = join(esFolder, 'x-pack', 'plugin', 'src', 'test', 'resources', 'rest-api-spec', 'test') -const customSkips = [ + +const ossSkips = { // TODO: remove this once 'arbitrary_key' is implemented // https://github.com/elastic/elasticsearch/pull/41492 - 'indices.split/30_copy_settings.yml', + 'indices.split/30_copy_settings.yml': ['*'], // skipping because we are booting ES with `discovery.type=single-node` // and this test will fail because of this configuration - 'nodes.stats/30_discovery.yml', + 'nodes.stats/30_discovery.yml': ['*'], // the expected error is returning a 503, // which triggers a retry and the node to be marked as dead - 'search.aggregation/240_max_buckets.yml' -] -const platinumBlackList = { + 'search.aggregation/240_max_buckets.yml': ['*'] +} +const xPackBlackList = { // file path: test name 'cat.aliases/10_basic.yml': ['Empty cluster'], 'index/10_with_id.yml': ['Index with ID'], @@ -81,278 +81,276 @@ const platinumBlackList = { 'xpack/15_basic.yml': ['*'] } -function Runner (opts) { - if (!(this instanceof Runner)) { - return new Runner(opts) - } - opts = opts || {} - - assert(opts.node, 'Missing base node') - this.bailout = opts.bailout - const options = { node: opts.node } - if (opts.isPlatinum) { - options.ssl = { - // NOTE: this path works only if we run - // the suite with npm scripts - ca: readFileSync('.ci/certs/ca.crt', 'utf8'), - rejectUnauthorized: false +class Runner { + constructor (opts = {}) { + const options = { node: opts.node } + if (opts.isXPack) { + options.ssl = { + ca: readFileSync(join(__dirname, '..', '..', '.ci', 'certs', 'ca.crt'), 'utf8'), + rejectUnauthorized: false + } } + this.client = new Client(options) + console.log('Loading yaml suite') } - this.client = new Client(options) - this.log = ora('Loading yaml suite').start() -} -Runner.prototype.waitCluster = function (callback, times = 0) { - this.log.text = 'Waiting for ElasticSearch' - this.client.cluster.health( - { waitForStatus: 'green', timeout: '50s' }, - (err, res) => { - if (err && ++times < 10) { - setTimeout(() => { - this.waitCluster(callback, times) - }, 5000) - } else { - callback(err) + async waitCluster (client, times = 0) { + try { + await client.cluster.health({ waitForStatus: 'green', timeout: '50s' }) + } catch (err) { + if (++times < 10) { + await sleep(5000) + return this.waitCluster(client, times) } - } - ) -} - -/** - * Runs the test suite - */ -Runner.prototype.start = function (opts) { - const parse = this.parse.bind(this) - const client = this.client - - // client.on('response', (err, meta) => { - // console.log('Request', meta.request) - // if (err) { - // console.log('Error', err) - // } else { - // console.log('Response', JSON.stringify(meta.response, null, 2)) - // } - // console.log() - // }) - - this.waitCluster(err => { - if (err) { - this.log.fail(err.message) + console.error(err) process.exit(1) } - // Get the build hash of Elasticsearch - client.info((err, { body }) => { - if (err) { - this.log.fail(err.message) - process.exit(1) - } - const { number: version, build_hash: sha } = body.version + } - // Set the repository to the given sha and run the test suite - this.withSHA(sha, () => { - this.log.succeed(`Testing ${opts.isPlatinum ? 'platinum' : 'oss'} api...`) - runTest.call(this, version) - }) - }) - }) + async start ({ isXPack }) { + const { client } = this + const parse = this.parse.bind(this) + + console.log('Waiting for Elasticsearch') + await this.waitCluster(client) + + const { body } = await client.info() + const { number: version, build_hash: sha } = body.version - function runTest (version) { - const files = [] + console.log(`Checking out sha ${sha}...`) + await this.withSHA(sha) + + console.log(`Testing ${isXPack ? 'XPack' : 'oss'} api...`) + + const folders = [] .concat(getAllFiles(yamlFolder)) - .concat(opts.isPlatinum ? getAllFiles(xPackYamlFolder) : []) + .concat(isXPack ? getAllFiles(xPackYamlFolder) : []) .filter(t => !/(README|TODO)/g.test(t)) + // we cluster the array based on the folder names, + // to provide a better test log output + .reduce((arr, file) => { + const path = file.slice(file.indexOf('/rest-api-spec/test'), file.lastIndexOf('/')) + var inserted = false + for (var i = 0; i < arr.length; i++) { + if (arr[i][0].includes(path)) { + inserted = true + arr[i].push(file) + break + } + } + if (!inserted) arr.push([file]) + return arr + }, []) - files.forEach(runTestFile.bind(this)) - function runTestFile (file) { - for (var i = 0; i < customSkips.length; i++) { - if (file.endsWith(customSkips[i])) return - } - // create a subtest for the specific folder - tap.test(file.slice(file.indexOf(`${sep}elasticsearch${sep}`)), { jobs: 1 }, tap1 => { - // read the yaml file - const data = readFileSync(file, 'utf8') - // get the test yaml (as object), some file has multiple yaml documents inside, - // every document is separated by '---', so we split on the separator - // and then we remove the empty strings, finally we parse them - const tests = data - .split('\n---\n') - .map(s => s.trim()) - .filter(Boolean) - .map(parse) + for (const folder of folders) { + // pretty name + const apiName = folder[0].slice( + folder[0].indexOf(`${sep}rest-api-spec${sep}test`) + 19, + folder[0].lastIndexOf(sep) + ) + tap.test(`Testing ${apiName}`, { bail: true, timeout: 0 }, t => { + for (const file of folder) { + const data = readFileSync(file, 'utf8') + // get the test yaml (as object), some file has multiple yaml documents inside, + // every document is separated by '---', so we split on the separator + // and then we remove the empty strings, finally we parse them + const tests = data + .split('\n---\n') + .map(s => s.trim()) + .filter(Boolean) + .map(parse) + + t.test( + file.slice(file.lastIndexOf(apiName)), + testFile(file, tests) + ) + } + t.end() + }) + } + + function testFile (file, tests) { + return t => { // get setup and teardown if present var setupTest = null var teardownTest = null - tests.forEach(test => { + for (const test of tests) { if (test.setup) setupTest = test.setup if (test.teardown) teardownTest = test.teardown - }) + } - // run the tests tests.forEach(test => { const name = Object.keys(test)[0] if (name === 'setup' || name === 'teardown') return - // should skip the test inside `platinumBlackList` - // if we are testing the platinum apis - if (opts.isPlatinum) { - const list = Object.keys(platinumBlackList) - for (i = 0; i < list.length; i++) { - const platTest = platinumBlackList[list[i]] - for (var j = 0; j < platTest.length; j++) { - if (file.endsWith(list[i]) && (name === platTest[j] || platTest[j] === '*')) { - const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name - tap.skip(`Skipping test ${testName} because is blacklisted in the platinum test`) - return - } - } - } - } + if (shouldSkip(t, isXPack, file, name)) return + // create a subtest for the specific folder + test file + test name - tap1.test(name, { jobs: 1, bail: this.bailout }, tap2 => { - const testRunner = TestRunner({ + t.test(name, async t => { + const testRunner = new TestRunner({ client, version, - tap: tap2, - isPlatinum: file.includes('x-pack') + tap: t, + isXPack: file.includes('x-pack') }) - testRunner.run(setupTest, test[name], teardownTest, () => tap2.end()) + await testRunner.run(setupTest, test[name], teardownTest) }) }) - - tap1.end() - }) + t.end() + } } } -} - -/** - * Parses a given yaml document - * @param {string} yaml document - * @returns {object} - */ -Runner.prototype.parse = function (data) { - try { - var doc = yaml.safeLoad(data) - } catch (err) { - this.log.fail(err.message) - return - } - return doc -} - -/** - * Returns the filtered content of a given folder - * @param {string} folder - * @returns {Array} The content of the given folder - */ -Runner.prototype.getTest = function (folder) { - const tests = readdirSync(folder) - return tests.filter(t => !/(README|TODO)/g.test(t)) -} -/** - * Sets the elasticsearch repository to the given sha. - * If the repository is not present in `esFolder` it will - * clone the repository and the checkout the sha. - * If the repository is already present but it cannot checkout to - * the given sha, it will perform a pull and then try again. - * @param {string} sha - * @param {function} callback - */ -Runner.prototype.withSHA = function (sha, callback) { - var fresh = false - var retry = 0 - var log = this.log - - if (!this.pathExist(esFolder)) { - if (!this.createFolder(esFolder)) { - log.fail('Failed folder creation') + parse (data) { + try { + var doc = yaml.safeLoad(data) + } catch (err) { + console.error(err) return } - fresh = true + return doc } - const git = Git(esFolder) - - if (fresh) { - clone(checkout) - } else { - checkout() + getTest (folder) { + const tests = readdirSync(folder) + return tests.filter(t => !/(README|TODO)/g.test(t)) } - function checkout () { - log.text = `Checking out sha '${sha}'` - git.checkout(sha, err => { - if (err) { - if (retry++ > 0) { - log.fail(`Cannot checkout sha '${sha}'`) - return + /** + * Sets the elasticsearch repository to the given sha. + * If the repository is not present in `esFolder` it will + * clone the repository and the checkout the sha. + * If the repository is already present but it cannot checkout to + * the given sha, it will perform a pull and then try again. + * @param {string} sha + * @param {function} callback + */ + withSHA (sha) { + return new Promise((resolve, reject) => { + _withSHA.call(this, err => err ? reject(err) : resolve()) + }) + + function _withSHA (callback) { + var fresh = false + var retry = 0 + + if (!this.pathExist(esFolder)) { + if (!this.createFolder(esFolder)) { + return callback(new Error('Failed folder creation')) } - return pull(checkout) + fresh = true } - callback() - }) - } - function pull (cb) { - log.text = 'Pulling elasticsearch repository...' - git.pull(err => { - if (err) { - log.fail(err.message) - return + const git = Git(esFolder) + + if (fresh) { + clone(checkout) + } else { + checkout() } - cb() - }) - } - function clone (cb) { - log.text = 'Cloning elasticsearch repository...' - git.clone(esRepo, esFolder, err => { - if (err) { - log.fail(err.message) - return + function checkout () { + console.log(`Checking out sha '${sha}'`) + git.checkout(sha, err => { + if (err) { + if (retry++ > 0) { + return callback(err) + } + return pull(checkout) + } + callback() + }) } - cb() - }) + + function pull (cb) { + console.log('Pulling elasticsearch repository...') + git.pull(err => { + if (err) { + return callback(err) + } + cb() + }) + } + + function clone (cb) { + console.log('Cloning elasticsearch repository...') + git.clone(esRepo, esFolder, err => { + if (err) { + return callback(err) + } + cb() + }) + } + } } -} -/** - * Checks if the given path exists - * @param {string} path - * @returns {boolean} true if exists, false if not - */ -Runner.prototype.pathExist = function (path) { - try { - accessSync(path) - return true - } catch (err) { - return false + /** + * Checks if the given path exists + * @param {string} path + * @returns {boolean} true if exists, false if not + */ + pathExist (path) { + try { + accessSync(path) + return true + } catch (err) { + return false + } } -} -/** - * Creates the given folder - * @param {string} name - * @returns {boolean} true on success, false on failure - */ -Runner.prototype.createFolder = function (name) { - try { - mkdirSync(name) - return true - } catch (err) { - return false + /** + * Creates the given folder + * @param {string} name + * @returns {boolean} true on success, false on failure + */ + createFolder (name) { + try { + mkdirSync(name) + return true + } catch (err) { + return false + } } } if (require.main === module) { - const url = process.env.TEST_ES_SERVER || 'http://localhost:9200' + const node = process.env.TEST_ES_SERVER || 'http://localhost:9200' const opts = { - node: url, - isPlatinum: url.indexOf('@') > -1 + node, + isXPack: node.indexOf('@') > -1 } - const runner = Runner(opts) - runner.start(opts) + const runner = new Runner(opts) + runner.start(opts).catch(console.log) +} + +const shouldSkip = (t, isXPack, file, name) => { + var list = Object.keys(ossSkips) + for (var i = 0; i < list.length; i++) { + const ossTest = ossSkips[list[i]] + for (var j = 0; j < ossTest.length; j++) { + if (file.endsWith(list[i]) && (name === ossTest[j] || ossTest[j] === '*')) { + const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name + t.comment(`Skipping test ${testName} because is blacklisted in the oss test`) + return true + } + } + } + + if (file.includes('x-pack') || isXPack) { + list = Object.keys(xPackBlackList) + for (i = 0; i < list.length; i++) { + const platTest = xPackBlackList[list[i]] + for (j = 0; j < platTest.length; j++) { + if (file.endsWith(list[i]) && (name === platTest[j] || platTest[j] === '*')) { + const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name + t.comment(`Skipping test ${testName} because is blacklisted in the XPack test`) + return true + } + } + } + } + + return false } const getAllFiles = dir => diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js index d02495264..eed24ea95 100644 --- a/test/integration/test-runner.js +++ b/test/integration/test-runner.js @@ -19,13 +19,14 @@ 'use strict' +/* eslint camelcase: 0 */ + const t = require('tap') const semver = require('semver') -const workq = require('workq') const helper = require('./helper') const { ConfigurationError } = require('../../lib/errors') -const { delve } = helper +const { delve, to } = helper const supportedFeatures = [ 'gtelte', @@ -38,169 +39,153 @@ const supportedFeatures = [ 'catch_unauthorized' ] -function TestRunner (opts) { - if (!(this instanceof TestRunner)) { - return new TestRunner(opts) +class TestRunner { + constructor (opts = {}) { + opts = opts || {} + + this.client = opts.client + this.esVersion = opts.version + this.response = null + this.stash = new Map() + this.tap = opts.tap || t + this.isXPack = opts.isXPack } - opts = opts || {} - - this.client = opts.client - this.esVersion = opts.version - this.response = null - this.stash = new Map() - this.tap = opts.tap || t - this.isPlatinum = opts.isPlatinum - this.q = opts.q || workq() -} -/** - * Runs a cleanup, removes all indices and templates - * @param {queue} - * @param {function} done - */ -TestRunner.prototype.cleanup = function (q, done) { - this.tap.comment('Cleanup') + /** + * Runs a cleanup, removes all indices, aliases, templates, and snapshots + * @returns {Promise} + */ + async cleanup () { + this.tap.comment('Cleanup') - this.response = null - this.stash = new Map() + this.response = null + this.stash = new Map() - q.add((q, done) => { - this.client.indices.delete({ index: '*' }, { ignore: 404 }, err => { + try { + await this.client.indices.delete({ index: '_all' }, { ignore: 404 }) + } catch (err) { this.tap.error(err, 'should not error: indices.delete') - done() - }) - }) + } + + try { + await this.client.indices.deleteAlias({ index: '_all', name: '_all' }, { ignore: 404 }) + } catch (err) { + this.tap.error(err, 'should not error: indices.deleteAlias') + } - q.add((q, done) => { - this.client.indices.deleteTemplate({ name: '*' }, { ignore: 404 }, err => { + try { + const { body: templates } = await this.client.indices.getTemplate() + await helper.runInParallel( + this.client, 'indices.deleteTemplate', + Object.keys(templates).map(t => ({ name: t })) + ) + } catch (err) { this.tap.error(err, 'should not error: indices.deleteTemplate') - done() - }) - }) - - q.add((q, done) => { - this.client.snapshot.delete({ repository: '*', snapshot: '*' }, { ignore: 404 }, err => { - this.tap.error(err, 'should not error: snapshot.delete') - done() - }) - }) - - q.add((q, done) => { - this.client.snapshot.deleteRepository({ repository: '*' }, { ignore: 404 }, err => { - this.tap.error(err, 'should not error: snapshot.deleteRepository') - done() - }) - }) - - done() -} + } -/** - * Runs some additional API calls to prepare ES for the Platinum test, - * This set of calls should be executed before the final clenup. - * @param {queue} - * @param {function} done - */ -TestRunner.prototype.cleanupPlatinum = function (q, done) { - this.tap.comment('Platinum Cleanup') + try { + const { body: repositories } = await this.client.snapshot.getRepository() + for (const repository of Object.keys(repositories)) { + const { body: snapshots } = await this.client.snapshot.get({ repository, snapshot: '_all' }) + await helper.runInParallel( + this.client, 'snapshot.delete', + Object.keys(snapshots).map(snapshot => ({ snapshot, repository })), + { ignore: [404] } + ) + await this.client.snapshot.deleteRepository({ repository }, { ignore: [404] }) + } + } catch (err) { + this.tap.error(err, 'should not error: snapshot.delete / snapshot.deleteRepository') + } + } - q.add((q, done) => { - this.client.security.getRole((err, { body }) => { - this.tap.error(err, 'should not error: security.getRole') + /** + * Runs some additional API calls to prepare ES for the xpack test, + * This set of calls should be executed before the final clenup. + * @returns {Promise} + */ + async cleanupXPack () { + this.tap.comment('XPack Cleanup') + + try { + const { body } = await this.client.security.getRole() const roles = Object.keys(body).filter(n => helper.esDefaultRoles.indexOf(n) === -1) - helper.runInParallel( + await helper.runInParallel( this.client, 'security.deleteRole', - roles.map(r => ({ name: r, refresh: 'wait_for' })) + roles.map(r => ({ name: r })) ) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: security.deleteRole')) - }) - }) - - q.add((q, done) => { - this.client.security.getUser((err, { body }) => { - this.tap.error(err, 'should not error: security.getUser') + } catch (err) { + this.tap.error(err, 'should not error: security role cleanup') + } + + try { + const { body } = await this.client.security.getUser() const users = Object.keys(body).filter(n => helper.esDefaultUsers.indexOf(n) === -1) - helper.runInParallel( + await helper.runInParallel( this.client, 'security.deleteUser', - users.map(r => ({ username: r, refresh: 'wait_for' })) + users.map(r => ({ username: r })) ) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: security.deleteUser')) - }) - }) - - q.add((q, done) => { - this.client.security.getPrivileges((err, { body }) => { - this.tap.error(err, 'should not error: security.getPrivileges') + } catch (err) { + this.tap.error(err, 'should not error: security user cleanup') + } + + try { + const { body } = await this.client.security.getPrivileges() const privileges = [] Object.keys(body).forEach(app => { Object.keys(body[app]).forEach(priv => { privileges.push({ name: body[app][priv].name, - application: body[app][priv].application, - refresh: 'wait_for' + application: body[app][priv].application }) }) }) - helper.runInParallel(this.client, 'security.deletePrivileges', privileges) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: security.deletePrivileges')) - }) - }) - - q.add((q, done) => { - this.client.ml.stopDatafeed({ datafeedId: '*', force: true }, err => { - this.tap.error(err, 'should not error: ml.stopDatafeed') - this.client.ml.getDatafeeds({ datafeedId: '*' }, (err, { body }) => { - this.tap.error(err, 'should error: not ml.getDatafeeds') - const feeds = body.datafeeds.map(f => f.datafeed_id) - helper.runInParallel( - this.client, 'ml.deleteDatafeed', - feeds.map(f => ({ datafeedId: f })) - ) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: ml.deleteDatafeed')) - }) - }) - }) - - q.add((q, done) => { - this.client.ml.closeJob({ jobId: '*', force: true }, err => { - this.tap.error(err, 'should not error: ml.closeJob') - this.client.ml.getJobs({ jobId: '*' }, (err, { body }) => { - this.tap.error(err, 'should not error: ml.getJobs') - const jobs = body.jobs.map(j => j.job_id) - helper.runInParallel( - this.client, 'ml.deleteJob', - jobs.map(j => ({ jobId: j, waitForCompletion: true, force: true })) - ) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: ml.deleteJob')) - }) - }) - }) + await helper.runInParallel(this.client, 'security.deletePrivileges', privileges) + } catch (err) { + this.tap.error(err, 'should not error: security privileges cleanup') + } + + try { + await this.client.ml.stopDatafeed({ datafeedId: '*', force: true }) + const { body } = await this.client.ml.getDatafeeds({ datafeedId: '*' }) + const feeds = body.datafeeds.map(f => f.datafeed_id) + await helper.runInParallel( + this.client, 'ml.deleteDatafeed', + feeds.map(f => ({ datafeedId: f })) + ) + } catch (err) { + this.tap.error(err, 'should error: not ml datafeed cleanup') + } + + try { + await this.client.ml.closeJob({ jobId: '*', force: true }) + const { body } = await this.client.ml.getJobs({ jobId: '*' }) + const jobs = body.jobs.map(j => j.job_id) + await helper.runInParallel( + this.client, 'ml.deleteJob', + jobs.map(j => ({ jobId: j, waitForCompletion: true, force: true })) + ) + } catch (err) { + this.tap.error(err, 'should not error: ml job cleanup') + } - q.add((q, done) => { - this.client.rollup.getJobs({ id: '_all' }, (err, { body }) => { - this.tap.error(err, 'should not error: rollup.getJobs') + try { + const { body } = await this.client.rollup.getJobs({ id: '_all' }) const jobs = body.jobs.map(j => j.config.id) - helper.runInParallel( + await helper.runInParallel( this.client, 'rollup.stopJob', jobs.map(j => ({ id: j, waitForCompletion: true })) ) - .then(() => helper.runInParallel( - this.client, 'rollup.deleteJob', - jobs.map(j => ({ id: j })) - )) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: rollup.stopJob/deleteJob')) - }) - }) - - q.add((q, done) => { - this.client.tasks.list((err, { body }) => { - this.tap.error(err, 'should not error: tasks.list') + await helper.runInParallel( + this.client, 'rollup.deleteJob', + jobs.map(j => ({ id: j })) + ) + } catch (err) { + this.tap.error(err, 'should not error: rollup jobs cleanup') + } + + try { + const { body } = await this.client.tasks.list() const tasks = Object.keys(body.nodes) .reduce((acc, node) => { const { tasks } = body.nodes[node] @@ -210,289 +195,280 @@ TestRunner.prototype.cleanupPlatinum = function (q, done) { return acc }, []) - helper.runInParallel( + await helper.runInParallel( this.client, 'tasks.cancel', tasks.map(id => ({ taskId: id })) ) - .then(() => done()) - .catch(err => this.tap.error(err, 'should not error: tasks.cancel')) - }) - }) - - q.add((q, done) => { - this.client.indices.delete({ index: '.ml-*' }, { ignore: 404 }, err => { - this.tap.error(err, 'should not error: indices.delete (ml indices)') - done() - }) - }) - - done() -} + } catch (err) { + this.tap.error(err, 'should not error: tasks cleanup') + } -/** - * Runs the given test. - * It runs the test components in the following order: - * - setup - * - the actual test - * - teardown - * - cleanup -* Internally uses a queue to guarantee the order of the test sections. - * @param {object} setup (null if not needed) - * @param {object} test - * @oaram {object} teardown (null if not needed) - * @param {function} end - */ -TestRunner.prototype.run = function (setup, test, teardown, end) { - // if we should skip a feature in the setup/teardown section - // we should skip the entire test file - const skip = getSkip(setup) || getSkip(teardown) - if (skip && this.shouldSkip(skip)) { - this.skip(skip) - return end() - } + try { + await this.client.ilm.removePolicy({ index: '_all' }) + } catch (err) { + this.tap.error(err, 'should not error: ilm.removePolicy') + } - if (this.isPlatinum) { - this.tap.comment('Creating x-pack user') - // Some platinum test requires this user - this.q.add((q, done) => { - this.client.security.putUser({ - username: 'x_pack_rest_user', - body: { password: 'x-pack-test-password', roles: ['superuser'] } - }, (err, { body }) => { - this.tap.error(err, 'should not error: security.putUser') - done() - }) - }) + // refresh the all indexes + try { + await this.client.indices.refresh({ index: '_all' }) + } catch (err) { + this.tap.error(err, 'should not error: indices.refresh') + } } - if (setup) { - this.q.add((q, done) => { - this.exec('Setup', setup, q, done) - }) - } + /** + * Runs the given test. + * It runs the test components in the following order: + * - skip check + * - xpack user + * - setup + * - the actual test + * - teardown + * - xpack cleanup + * - cleanup + * @param {object} setup (null if not needed) + * @param {object} test + * @oaram {object} teardown (null if not needed) + * @returns {Promise} + */ + async run (setup, test, teardown) { + // if we should skip a feature in the setup/teardown section + // we should skip the entire test file + const skip = getSkip(setup) || getSkip(teardown) + if (skip && this.shouldSkip(skip)) { + this.skip(skip) + return + } - this.q.add((q, done) => { - this.exec('Test', test, q, done) - }) + if (this.isXPack) { + // Some xpack test requires this user + this.tap.comment('Creating x-pack user') + try { + await this.client.security.putUser({ + username: 'x_pack_rest_user', + body: { password: 'x-pack-test-password', roles: ['superuser'] } + }) + } catch (err) { + this.tap.error(err, 'should not error: security.putUser') + } + } - if (teardown) { - this.q.add((q, done) => { - this.exec('Teardown', teardown, q, done) - }) - } + if (setup) await this.exec('Setup', setup) - if (this.isPlatinum) { - this.q.add((q, done) => { - this.cleanupPlatinum(q, done) - }) - } + await this.exec('Test', test) - this.q.add((q, done) => { - this.cleanup(q, done) - }) + if (teardown) await this.exec('Teardown', teardown) - this.q.add((q, done) => end() && done()) -} + if (this.isXPack) await this.cleanupXPack() -/** - * Logs a skip - * @param {object} the actions - * @returns {TestRunner} - */ -TestRunner.prototype.skip = function (action) { - if (action.reason && action.version) { - this.tap.skip(`Skip: ${action.reason} (${action.version})`) - } else if (action.features) { - this.tap.skip(`Skip: ${JSON.stringify(action.features)})`) - } else { - this.tap.skip('Skipped') + await this.cleanup() } - return this -} -/** - * Decides if a test should be skipped - * @param {object} the actions - * @returns {boolean} - */ -TestRunner.prototype.shouldSkip = function (action) { - var shouldSkip = false - // skip based on the version - if (action.version) { - if (action.version.trim() === 'all') return true - const [min, max] = action.version.split('-').map(v => v.trim()) - // if both `min` and `max` are specified - if (min && max) { - shouldSkip = semver.satisfies(this.esVersion, action.version) - // if only `min` is specified - } else if (min) { - shouldSkip = semver.gte(this.esVersion, min) - // if only `max` is specified - } else if (max) { - shouldSkip = semver.lte(this.esVersion, max) - // something went wrong! + /** + * Logs a skip + * @param {object} the actions + * @returns {TestRunner} + */ + skip (action) { + if (action.reason && action.version) { + this.tap.comment(`Skip: ${action.reason} (${action.version})`) + } else if (action.features) { + this.tap.comment(`Skip: ${JSON.stringify(action.features)})`) } else { - throw new Error(`skip: Bad version range: ${action.version}`) + this.tap.comment('Skipped') } + return this } - if (shouldSkip) return true + /** + * Decides if a test should be skipped + * @param {object} the actions + * @returns {boolean} + */ + shouldSkip (action) { + var shouldSkip = false + // skip based on the version + if (action.version) { + if (action.version.trim() === 'all') return true + const [min, max] = action.version.split('-').map(v => v.trim()) + // if both `min` and `max` are specified + if (min && max) { + shouldSkip = semver.satisfies(this.esVersion, action.version) + // if only `min` is specified + } else if (min) { + shouldSkip = semver.gte(this.esVersion, min) + // if only `max` is specified + } else if (max) { + shouldSkip = semver.lte(this.esVersion, max) + // something went wrong! + } else { + throw new Error(`skip: Bad version range: ${action.version}`) + } + } - if (action.features) { - if (!Array.isArray(action.features)) action.features = [action.features] - // returns true if one of the features is not present in the supportedFeatures - shouldSkip = !!action.features.filter(f => !~supportedFeatures.indexOf(f)).length - } + if (shouldSkip) return true - if (shouldSkip) return true + if (action.features) { + if (!Array.isArray(action.features)) action.features = [action.features] + // returns true if one of the features is not present in the supportedFeatures + shouldSkip = !!action.features.filter(f => !~supportedFeatures.indexOf(f)).length + } - return false -} + if (shouldSkip) return true -/** - * Updates the array syntax of keys and values - * eg: 'hits.hits.1.stuff' to 'hits.hits[1].stuff' - * @param {object} the action to update - * @returns {obj} the updated action - */ -TestRunner.prototype.updateArraySyntax = function (obj) { - const newObj = {} + return false + } - for (const key in obj) { - const newKey = key.replace(/\.\d{1,}\./g, v => `[${v.slice(1, -1)}].`) - const val = obj[key] + /** + * Updates the array syntax of keys and values + * eg: 'hits.hits.1.stuff' to 'hits.hits[1].stuff' + * @param {object} the action to update + * @returns {obj} the updated action + */ + updateArraySyntax (obj) { + const newObj = {} - if (typeof val === 'string') { - newObj[newKey] = val.replace(/\.\d{1,}\./g, v => `[${v.slice(1, -1)}].`) - } else if (val !== null && typeof val === 'object') { - newObj[newKey] = this.updateArraySyntax(val) - } else { - newObj[newKey] = val - } - } + for (const key in obj) { + const newKey = key.replace(/\.\d{1,}\./g, v => `[${v.slice(1, -1)}].`) + const val = obj[key] - return newObj -} + if (typeof val === 'string') { + newObj[newKey] = val.replace(/\.\d{1,}\./g, v => `[${v.slice(1, -1)}].`) + } else if (val !== null && typeof val === 'object') { + newObj[newKey] = this.updateArraySyntax(val) + } else { + newObj[newKey] = val + } + } -/** - * Fill the stashed values of a command - * let's say the we have stashed the `master` value, - * is_true: nodes.$master.transport.profiles - * becomes - * is_true: nodes.new_value.transport.profiles - * @param {object|string} the action to update - * @returns {object|string} the updated action - */ -TestRunner.prototype.fillStashedValues = function (obj) { - if (typeof obj === 'string') { - return getStashedValues.call(this, obj) + return newObj } - // iterate every key of the object - for (const key in obj) { - const val = obj[key] - // if the key value is a string, and the string includes '${' - // that we must update the content of '${...}'. - // eg: 'Basic ${auth}' we search the stahed value 'auth' - // and the resulting value will be 'Basic valueOfAuth' - if (typeof val === 'string' && val.includes('${')) { - const start = val.indexOf('${') - const end = val.indexOf('}', val.indexOf('${')) - const stashedKey = val.slice(start + 2, end) - const stashed = this.stash.get(stashedKey) - obj[key] = val.slice(0, start) + stashed + val.slice(end + 1) - continue - } - // handle json strings, eg: '{"hello":"$world"}' - if (typeof val === 'string' && val.includes('"$')) { - const start = val.indexOf('"$') - const end = val.indexOf('"', start + 1) - const stashedKey = val.slice(start + 2, end) - const stashed = '"' + this.stash.get(stashedKey) + '"' - obj[key] = val.slice(0, start) + stashed + val.slice(end + 1) - continue - } - // if the key value is a string, and the string includes '$' - // we run the "update value" code - if (typeof val === 'string' && val.includes('$')) { - // update the key value - obj[key] = getStashedValues.call(this, val) - continue + + /** + * Fill the stashed values of a command + * let's say the we have stashed the `master` value, + * is_true: nodes.$master.transport.profiles + * becomes + * is_true: nodes.new_value.transport.profiles + * @param {object|string} the action to update + * @returns {object|string} the updated action + */ + fillStashedValues (obj) { + if (typeof obj === 'string') { + return getStashedValues.call(this, obj) } + // iterate every key of the object + for (const key in obj) { + const val = obj[key] + // if the key value is a string, and the string includes '${' + // that we must update the content of '${...}'. + // eg: 'Basic ${auth}' we search the stahed value 'auth' + // and the resulting value will be 'Basic valueOfAuth' + if (typeof val === 'string' && val.includes('${')) { + const start = val.indexOf('${') + const end = val.indexOf('}', val.indexOf('${')) + const stashedKey = val.slice(start + 2, end) + const stashed = this.stash.get(stashedKey) + obj[key] = val.slice(0, start) + stashed + val.slice(end + 1) + continue + } + // handle json strings, eg: '{"hello":"$world"}' + if (typeof val === 'string' && val.includes('"$')) { + const start = val.indexOf('"$') + const end = val.indexOf('"', start + 1) + const stashedKey = val.slice(start + 2, end) + const stashed = '"' + this.stash.get(stashedKey) + '"' + obj[key] = val.slice(0, start) + stashed + val.slice(end + 1) + continue + } + // if the key value is a string, and the string includes '$' + // we run the "update value" code + if (typeof val === 'string' && val.includes('$')) { + // update the key value + obj[key] = getStashedValues.call(this, val) + continue + } - // go deep in the object - if (val !== null && typeof val === 'object') { - this.fillStashedValues(val) + // go deep in the object + if (val !== null && typeof val === 'object') { + this.fillStashedValues(val) + } } - } - return obj - - function getStashedValues (str) { - const arr = str - // we split the string on the dots - // handle the key with a dot inside that is not a part of the path - .split(/(? { - if (part[0] === '$') { - const stashed = this.stash.get(part.slice(1)) - if (stashed == null) { - throw new Error(`Cannot find stashed value '${part}' for '${JSON.stringify(obj)}'`) + return obj + + function getStashedValues (str) { + const arr = str + // we split the string on the dots + // handle the key with a dot inside that is not a part of the path + .split(/(? { + if (part[0] === '$') { + const stashed = this.stash.get(part.slice(1)) + if (stashed == null) { + throw new Error(`Cannot find stashed value '${part}' for '${JSON.stringify(obj)}'`) + } + return stashed } - return stashed - } - return part - }) + return part + }) - // recreate the string value only if the array length is higher than one - // otherwise return the first element which in some test this could be a number, - // and call `.join` will coerce it to a string. - return arr.length > 1 ? arr.join('.') : arr[0] + // recreate the string value only if the array length is higher than one + // otherwise return the first element which in some test this could be a number, + // and call `.join` will coerce it to a string. + return arr.length > 1 ? arr.join('.') : arr[0] + } } -} -/** - * Stashes a value - * @param {string} the key to search in the previous response - * @param {string} the name to identify the stashed value - * @returns {TestRunner} - */ -TestRunner.prototype.set = function (key, name) { - this.stash.set(name, delve(this.response, key)) - return this -} + /** + * Stashes a value + * @param {string} the key to search in the previous response + * @param {string} the name to identify the stashed value + * @returns {TestRunner} + */ + set (key, name) { + this.stash.set(name, delve(this.response, key)) + return this + } -/** - * Applies a given transformation and stashes the result. - * @param {string} the name to identify the stashed value - * @param {string} the transformation function as string - * @returns {TestRunner} - */ -TestRunner.prototype.transform_and_set = function (name, transform) { - if (/base64EncodeCredentials/.test(transform)) { - const [user, password] = transform - .slice(transform.indexOf('(') + 1, -1) - .replace(/ /g, '') - .split(',') - const userAndPassword = `${delve(this.response, user)}:${delve(this.response, password)}` - this.stash.set(name, Buffer.from(userAndPassword).toString('base64')) - } else { - throw new Error(`Unknown transform: '${transform}'`) + /** + * Applies a given transformation and stashes the result. + * @param {string} the name to identify the stashed value + * @param {string} the transformation function as string + * @returns {TestRunner} + */ + transform_and_set (name, transform) { + if (/base64EncodeCredentials/.test(transform)) { + const [user, password] = transform + .slice(transform.indexOf('(') + 1, -1) + .replace(/ /g, '') + .split(',') + const userAndPassword = `${delve(this.response, user)}:${delve(this.response, password)}` + this.stash.set(name, Buffer.from(userAndPassword).toString('base64')) + } else { + throw new Error(`Unknown transform: '${transform}'`) + } + return this } - return this -} -/** - * Runs a client command - * @param {object} the action to perform - * @param {Queue} - */ -TestRunner.prototype.do = function (action, done) { - const cmd = this.parseDo(action) - const api = delve(this.client, cmd.method).bind(this.client) - const options = { ignore: cmd.params.ignore, headers: action.headers } - if (cmd.params.ignore) delete cmd.params.ignore - api(cmd.params, options, (err, { body, warnings }) => { + /** + * Runs a client command + * @param {object} the action to perform + * @returns {Promise} + */ + async do (action) { + const cmd = this.parseDo(action) + const api = delve(this.client, cmd.method).bind(this.client) + + const options = { ignore: cmd.params.ignore, headers: action.headers } + if (cmd.params.ignore) delete cmd.params.ignore + + const [err, result] = await to(api(cmd.params, options)) + var warnings = result ? result.warnings : null + var body = result ? result.body : null + if (action.warnings && warnings === null) { this.tap.fail('We should get a warning header', action.warnings) } else if (!action.warnings && warnings !== null) { @@ -542,53 +518,39 @@ TestRunner.prototype.do = function (action, done) { this.tap.error(err, `should not error: ${cmd.method}`, action) this.response = body } + } - done() - }) -} - -/** - * Runs an actual test - * @param {string} the name of the test - * @param {object} the actions to perform - * @param {Queue} - */ -TestRunner.prototype.exec = function (name, actions, q, done) { - this.tap.comment(name) - for (var i = 0; i < actions.length; i++) { - const action = actions[i] - - if (action.skip) { - if (this.shouldSkip(action.skip)) { - this.skip(this.fillStashedValues(action.skip)) - break + /** + * Runs an actual test + * @param {string} the name of the test + * @param {object} the actions to perform + * @returns {Promise} + */ + async exec (name, actions) { + this.tap.comment(name) + for (const action of actions) { + if (action.skip) { + if (this.shouldSkip(action.skip)) { + this.skip(this.fillStashedValues(action.skip)) + break + } } - } - if (action.do) { - q.add((q, done) => { - this.do(this.fillStashedValues(action.do), done) - }) - } + if (action.do) { + await this.do(this.fillStashedValues(action.do)) + } - if (action.set) { - q.add((q, done) => { + if (action.set) { const key = Object.keys(action.set)[0] this.set(this.fillStashedValues(key), action.set[key]) - done() - }) - } + } - if (action.transform_and_set) { - q.add((q, done) => { + if (action.transform_and_set) { const key = Object.keys(action.transform_and_set)[0] this.transform_and_set(key, action.transform_and_set[key]) - done() - }) - } + } - if (action.match) { - q.add((q, done) => { + if (action.match) { const key = Object.keys(action.match)[0] this.match( // in some cases, the yaml refers to the body with an empty string @@ -600,56 +562,41 @@ TestRunner.prototype.exec = function (name, actions, q, done) { : this.fillStashedValues(action.match)[key], action.match ) - done() - }) - } + } - if (action.lt) { - q.add((q, done) => { + if (action.lt) { const key = Object.keys(action.lt)[0] this.lt( delve(this.response, this.fillStashedValues(key)), this.fillStashedValues(action.lt)[key] ) - done() - }) - } + } - if (action.gt) { - q.add((q, done) => { + if (action.gt) { const key = Object.keys(action.gt)[0] this.gt( delve(this.response, this.fillStashedValues(key)), this.fillStashedValues(action.gt)[key] ) - done() - }) - } + } - if (action.lte) { - q.add((q, done) => { + if (action.lte) { const key = Object.keys(action.lte)[0] this.lte( delve(this.response, this.fillStashedValues(key)), this.fillStashedValues(action.lte)[key] ) - done() - }) - } + } - if (action.gte) { - q.add((q, done) => { + if (action.gte) { const key = Object.keys(action.gte)[0] this.gte( delve(this.response, this.fillStashedValues(key)), this.fillStashedValues(action.gte)[key] ) - done() - }) - } + } - if (action.length) { - q.add((q, done) => { + if (action.length) { const key = Object.keys(action.length)[0] this.length( key === '$body' || key === '' @@ -659,233 +606,227 @@ TestRunner.prototype.exec = function (name, actions, q, done) { ? action.length[key] : this.fillStashedValues(action.length)[key] ) - done() - }) - } + } - if (action.is_true) { - q.add((q, done) => { + if (action.is_true) { const isTrue = this.fillStashedValues(action.is_true) this.is_true( delve(this.response, isTrue), isTrue ) - done() - }) - } + } - if (action.is_false) { - q.add((q, done) => { + if (action.is_false) { const isFalse = this.fillStashedValues(action.is_false) this.is_false( delve(this.response, isFalse), isFalse ) - done() - }) + } } } - done() -} - -/** - * Asserts that the given value is truthy - * @param {any} the value to check - * @param {string} an optional message - */ -TestRunner.prototype.is_true = function (val, msg) { - this.tap.true(val, `expect truthy value: ${msg} - value: ${JSON.stringify(val)}`) - return this -} -/** - * Asserts that the given value is falsey - * @param {any} the value to check - * @param {string} an optional message - */ -TestRunner.prototype.is_false = function (val, msg) { - this.tap.false(val, `expect falsey value: ${msg} - value: ${JSON.stringify(val)}`) - return this -} + /** + * Asserts that the given value is truthy + * @param {any} the value to check + * @param {string} an optional message + * @returns {TestRunner} + */ + is_true (val, msg) { + this.tap.true(val, `expect truthy value: ${msg} - value: ${JSON.stringify(val)}`) + return this + } -/** - * Asserts that two values are the same - * @param {any} the first value - * @param {any} the second value - * @returns {TestRunner} - */ -TestRunner.prototype.match = function (val1, val2, action) { - // both values are objects - if (typeof val1 === 'object' && typeof val2 === 'object') { - this.tap.strictDeepEqual(val1, val2, action) - // the first value is the body as string and the second a pattern string - } else if ( - typeof val1 === 'string' && typeof val2 === 'string' && - val2.startsWith('/') && (val2.endsWith('/\n') || val2.endsWith('/')) - ) { - const regStr = val2 - // match all comments within a "regexp" match arg - .replace(/([\S\s]?)#[^\n]*\n/g, (match, prevChar) => { - return prevChar === '\\' ? match : `${prevChar}\n` - }) - // remove all whitespace from the expression, all meaningful - // whitespace is represented with \s - .replace(/\s/g, '') - .slice(1, -1) - // 'm' adds the support for multiline regex - this.tap.match(val1, new RegExp(regStr, 'm'), `should match pattern provided: ${val2}, action: ${JSON.stringify(action)}`) - // everything else - } else { - this.tap.strictEqual(val1, val2, `should be equal: ${val1} - ${val2}, action: ${JSON.stringify(action)}`) + /** + * Asserts that the given value is falsey + * @param {any} the value to check + * @param {string} an optional message + * @returns {TestRunner} + */ + is_false (val, msg) { + this.tap.false(val, `expect falsey value: ${msg} - value: ${JSON.stringify(val)}`) + return this } - return this -} -/** - * Asserts that the first value is less than the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @returns {TestRunner} - */ -TestRunner.prototype.lt = function (val1, val2) { - ;[val1, val2] = getNumbers(val1, val2) - this.tap.true(val1 < val2) - return this -} + /** + * Asserts that two values are the same + * @param {any} the first value + * @param {any} the second value + * @returns {TestRunner} + */ + match (val1, val2, action) { + // both values are objects + if (typeof val1 === 'object' && typeof val2 === 'object') { + this.tap.strictDeepEqual(val1, val2, action) + // the first value is the body as string and the second a pattern string + } else if ( + typeof val1 === 'string' && typeof val2 === 'string' && + val2.startsWith('/') && (val2.endsWith('/\n') || val2.endsWith('/')) + ) { + const regStr = val2 + // match all comments within a "regexp" match arg + .replace(/([\S\s]?)#[^\n]*\n/g, (match, prevChar) => { + return prevChar === '\\' ? match : `${prevChar}\n` + }) + // remove all whitespace from the expression, all meaningful + // whitespace is represented with \s + .replace(/\s/g, '') + .slice(1, -1) + // 'm' adds the support for multiline regex + this.tap.match(val1, new RegExp(regStr, 'm'), `should match pattern provided: ${val2}, action: ${JSON.stringify(action)}`) + // everything else + } else { + this.tap.strictEqual(val1, val2, `should be equal: ${val1} - ${val2}, action: ${JSON.stringify(action)}`) + } + return this + } -/** - * Asserts that the first value is greater than the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @returns {TestRunner} - */ -TestRunner.prototype.gt = function (val1, val2) { - ;[val1, val2] = getNumbers(val1, val2) - this.tap.true(val1 > val2) - return this -} + /** + * Asserts that the first value is less than the second + * It also verifies that the two values are numbers + * @param {any} the first value + * @param {any} the second value + * @returns {TestRunner} + */ + lt (val1, val2) { + ;[val1, val2] = getNumbers(val1, val2) + this.tap.true(val1 < val2) + return this + } -/** - * Asserts that the first value is less than or equal the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @returns {TestRunner} - */ -TestRunner.prototype.lte = function (val1, val2) { - ;[val1, val2] = getNumbers(val1, val2) - this.tap.true(val1 <= val2) - return this -} + /** + * Asserts that the first value is greater than the second + * It also verifies that the two values are numbers + * @param {any} the first value + * @param {any} the second value + * @returns {TestRunner} + */ + gt (val1, val2) { + ;[val1, val2] = getNumbers(val1, val2) + this.tap.true(val1 > val2) + return this + } -/** - * Asserts that the first value is greater than or equal the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @returns {TestRunner} -*/ -TestRunner.prototype.gte = function (val1, val2) { - ;[val1, val2] = getNumbers(val1, val2) - this.tap.true(val1 >= val2) - return this -} + /** + * Asserts that the first value is less than or equal the second + * It also verifies that the two values are numbers + * @param {any} the first value + * @param {any} the second value + * @returns {TestRunner} + */ + lte (val1, val2) { + ;[val1, val2] = getNumbers(val1, val2) + this.tap.true(val1 <= val2) + return this + } -/** - * Asserts that the given value has the specified length - * @param {string|object|array} the object to check - * @param {number} the expected length - * @returns {TestRunner} - */ -TestRunner.prototype.length = function (val, len) { - if (typeof val === 'string' || Array.isArray(val)) { - this.tap.strictEqual(val.length, len) - } else if (typeof val === 'object' && val !== null) { - this.tap.strictEqual(Object.keys(val).length, len) - } else { - this.tap.fail(`length: the given value is invalid: ${val}`) + /** + * Asserts that the first value is greater than or equal the second + * It also verifies that the two values are numbers + * @param {any} the first value + * @param {any} the second value + * @returns {TestRunner} + */ + gte (val1, val2) { + ;[val1, val2] = getNumbers(val1, val2) + this.tap.true(val1 >= val2) + return this } - return this -} -/** - * Gets a `do` action object and returns a structured object, - * where the action is the key and the parameter is the value. - * Eg: - * { - * 'indices.create': { - * 'index': 'test' - * }, - * 'warnings': [ - * '[index] is deprecated' - * ] - * } - * becomes - * { - * method: 'indices.create', - * params: { - * index: 'test' - * }, - * warnings: [ - * '[index] is deprecated' - * ] - * } - * @param {object} - * @returns {object} - */ -TestRunner.prototype.parseDo = function (action) { - return Object.keys(action).reduce((acc, val) => { - switch (val) { - case 'catch': - acc.catch = action.catch - break - case 'warnings': - acc.warnings = action.warnings - break - case 'node_selector': - acc.node_selector = action.node_selector - break - default: - // converts underscore to camelCase - // eg: put_mapping => putMapping - acc.method = val.replace(/_([a-z])/g, g => g[1].toUpperCase()) - acc.params = camelify(action[val]) + /** + * Asserts that the given value has the specified length + * @param {string|object|array} the object to check + * @param {number} the expected length + * @returns {TestRunner} + */ + length (val, len) { + if (typeof val === 'string' || Array.isArray(val)) { + this.tap.strictEqual(val.length, len) + } else if (typeof val === 'object' && val !== null) { + this.tap.strictEqual(Object.keys(val).length, len) + } else { + this.tap.fail(`length: the given value is invalid: ${val}`) } - return acc - }, {}) - - function camelify (obj) { - const newObj = {} - - // TODO: add camelCase support for this fields - const doNotCamelify = ['copy_settings'] + return this + } - for (const key in obj) { - const val = obj[key] - var newKey = key - if (!~doNotCamelify.indexOf(key)) { - // if the key starts with `_` we should not camelify the first occurence - // eg: _source_include => _sourceInclude - newKey = key[0] === '_' - ? '_' + key.slice(1).replace(/_([a-z])/g, k => k[1].toUpperCase()) - : key.replace(/_([a-z])/g, k => k[1].toUpperCase()) + /** + * Gets a `do` action object and returns a structured object, + * where the action is the key and the parameter is the value. + * Eg: + * { + * 'indices.create': { + * 'index': 'test' + * }, + * 'warnings': [ + * '[index] is deprecated' + * ] + * } + * becomes + * { + * method: 'indices.create', + * params: { + * index: 'test' + * }, + * warnings: [ + * '[index] is deprecated' + * ] + * } + * @param {object} + * @returns {object} + */ + parseDo (action) { + return Object.keys(action).reduce((acc, val) => { + switch (val) { + case 'catch': + acc.catch = action.catch + break + case 'warnings': + acc.warnings = action.warnings + break + case 'node_selector': + acc.node_selector = action.node_selector + break + default: + // converts underscore to camelCase + // eg: put_mapping => putMapping + acc.method = val.replace(/_([a-z])/g, g => g[1].toUpperCase()) + acc.params = camelify(action[val]) } + return acc + }, {}) + + function camelify (obj) { + const newObj = {} + + // TODO: add camelCase support for this fields + const doNotCamelify = ['copy_settings'] + + for (const key in obj) { + const val = obj[key] + var newKey = key + if (!~doNotCamelify.indexOf(key)) { + // if the key starts with `_` we should not camelify the first occurence + // eg: _source_include => _sourceInclude + newKey = key[0] === '_' + ? '_' + key.slice(1).replace(/_([a-z])/g, k => k[1].toUpperCase()) + : key.replace(/_([a-z])/g, k => k[1].toUpperCase()) + } - if ( - val !== null && - typeof val === 'object' && - !Array.isArray(val) && - key !== 'body' - ) { - newObj[newKey] = camelify(val) - } else { - newObj[newKey] = val + if ( + val !== null && + typeof val === 'object' && + !Array.isArray(val) && + key !== 'body' + ) { + newObj[newKey] = camelify(val) + } else { + newObj[newKey] = val + } } - } - return newObj + return newObj + } } } From 33bc37b34c7922e21574268cee60744c28d07438 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Fri, 12 Jul 2019 15:00:21 -0400 Subject: [PATCH 59/84] [DOCS] Fix broken links (#903) --- api/api/clear_scroll.js | 2 +- api/api/scroll.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 7d02162ad..f76c58114 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -26,7 +26,7 @@ function buildClearScroll (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request + * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#search-request-scroll) request * * @param {list} scroll_id - A comma-separated list of scroll IDs to clear * @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter diff --git a/api/api/scroll.js b/api/api/scroll.js index fd9e518c1..3d8e35b2f 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -26,7 +26,7 @@ function buildScroll (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request + * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#search-request-scroll) request * * @param {string} scroll_id - The scroll ID * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search From ce16f28e8f4d0a216267756dc5d0c612fc3d905e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 14:20:21 +0200 Subject: [PATCH 60/84] Update standard requirement from ^12.0.1 to ^13.0.2 (#906) --- package.json | 2 +- test/unit/errors.test.js | 2 ++ test/unit/events.test.js | 2 +- test/utils/MockConnection.js | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 41eef9a94..d7679f146 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "simple-git": "^1.110.0", "simple-statistics": "^7.0.2", "split2": "^3.1.1", - "standard": "^12.0.1", + "standard": "^13.0.2", "stoppable": "^1.1.0", "tap": "^13.0.1", "tap-mocha-reporter": "^4.0.1", diff --git a/test/unit/errors.test.js b/test/unit/errors.test.js index 213194cff..0e8c2d7c0 100644 --- a/test/unit/errors.test.js +++ b/test/unit/errors.test.js @@ -19,6 +19,8 @@ 'use strict' +/* eslint no-prototype-builtins: 0 */ + const { test } = require('tap') const { errors } = require('../../index') diff --git a/test/unit/events.test.js b/test/unit/events.test.js index 1b967d900..486526cfc 100644 --- a/test/unit/events.test.js +++ b/test/unit/events.test.js @@ -88,7 +88,7 @@ test('Should emit a response event in case of a successful response', t => { statusCode: 200, headers: { 'content-type': 'application/json;utf=8', - 'connection': 'keep-alive' + connection: 'keep-alive' }, warnings: null, meta: { diff --git a/test/utils/MockConnection.js b/test/utils/MockConnection.js index 7f16e27d4..3b41567b1 100644 --- a/test/utils/MockConnection.js +++ b/test/utils/MockConnection.js @@ -30,8 +30,8 @@ class MockConnection extends Connection { stream.statusCode = setStatusCode(params.path) stream.headers = { 'content-type': 'application/json;utf=8', - 'date': new Date().toISOString(), - 'connection': 'keep-alive', + date: new Date().toISOString(), + connection: 'keep-alive', 'content-length': '17' } process.nextTick(() => { @@ -96,8 +96,8 @@ class MockConnectionSniff extends Connection { stream.statusCode = setStatusCode(params.path) stream.headers = { 'content-type': 'application/json;utf=8', - 'date': new Date().toISOString(), - 'connection': 'keep-alive', + date: new Date().toISOString(), + connection: 'keep-alive', 'content-length': '205' } process.nextTick(() => { From 6e3f88906b2c096f617e45a0bd612eb3ad15a23e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 14:20:37 +0200 Subject: [PATCH 61/84] Update @types/node requirement from ^11.13.7 to ^12.6.2 (#899) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7679f146..7f5f40564 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "company": "Elasticsearch BV" }, "devDependencies": { - "@types/node": "^11.13.7", + "@types/node": "^12.6.2", "codecov": "^3.3.0", "convert-hrtime": "^3.0.0", "dedent": "^0.7.0", From 56931a426b909852580a386a8f522a2447a207ff Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 14:21:36 +0200 Subject: [PATCH 62/84] Update tap requirement from ^13.0.1 to ^14.4.1 (#900) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f5f40564..10c887e1e 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "split2": "^3.1.1", "standard": "^13.0.2", "stoppable": "^1.1.0", - "tap": "^13.0.1", + "tap": "^14.4.1", "tap-mocha-reporter": "^4.0.1", "typescript": "^3.4.5", "workq": "^2.1.0" From b66064358aa9c8d175fad7798fdbd20d91a9d3c2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 14:24:43 +0200 Subject: [PATCH 63/84] Update deepmerge requirement from ^3.2.0 to ^4.0.0 (#898) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 10c887e1e..07de66a04 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "codecov": "^3.3.0", "convert-hrtime": "^3.0.0", "dedent": "^0.7.0", - "deepmerge": "^3.2.0", + "deepmerge": "^4.0.0", "dezalgo": "^1.0.3", "js-yaml": "^3.13.1", "license-checker": "^25.0.1", From 45672e89f70bf986d50ff17c2b9295d8b423b13b Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Tue, 16 Jul 2019 12:21:01 +0200 Subject: [PATCH 64/84] Added support for arbitrary_key (#910) --- test/integration/test-runner.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js index eed24ea95..fecb93635 100644 --- a/test/integration/test-runner.js +++ b/test/integration/test-runner.js @@ -36,7 +36,8 @@ const supportedFeatures = [ 'groovy_scripting', 'headers', 'transform_and_set', - 'catch_unauthorized' + 'catch_unauthorized', + 'arbitrary_key' ] class TestRunner { @@ -429,7 +430,20 @@ class TestRunner { * @returns {TestRunner} */ set (key, name) { - this.stash.set(name, delve(this.response, key)) + if (key.includes('_arbitrary_key_')) { + var currentVisit = null + for (const path of key.split('.')) { + if (path === '_arbitrary_key_') { + const keys = Object.keys(currentVisit) + const arbitraryKey = keys[getRandomInt(0, keys.length)] + this.stash.set(name, arbitraryKey) + } else { + currentVisit = delve(this.response, path) + } + } + } else { + this.stash.set(name, delve(this.response, key)) + } return this } @@ -883,4 +897,8 @@ function getNumbers (val1, val2) { return [val1Numeric, val2Numeric] } +function getRandomInt (min, max) { + return Math.floor(Math.random() * (max - min)) + min +} + module.exports = TestRunner From a752ea74034581661cb5c97ad6568e71d771fa9d Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 17 Jul 2019 10:28:31 +0200 Subject: [PATCH 65/84] Improve README (#909) * Updated README * Updated asciidoc intro * Updated intro title * Update README.md Co-Authored-By: Lisa Cawley * Update README.md Co-Authored-By: Lisa Cawley * Update README.md Co-Authored-By: Lisa Cawley * Update README.md Co-Authored-By: Lisa Cawley * Update README.md Co-Authored-By: Lisa Cawley * Update docs/introduction.asciidoc Co-Authored-By: Lisa Cawley * Update docs/introduction.asciidoc Co-Authored-By: Lisa Cawley * Updated asciidoc intro --- README.md | 238 +++++++++++++++++++------------------ docs/index.asciidoc | 2 +- docs/introduction.asciidoc | 134 +++++++++++++++++++-- 3 files changed, 246 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index 35efdf59a..b5143ac83 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,24 @@ -# @elastic/elasticsearch +# Elasticsearch Node.js client [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Build Status](https://clients-ci.elastic.co/job/elastic+elasticsearch-js+master/badge/icon)](https://clients-ci.elastic.co/job/elastic+elasticsearch-js+master/) [![codecov](https://codecov.io/gh/elastic/elasticsearch-js/branch/master/graph/badge.svg)](https://codecov.io/gh/elastic/elasticsearch-js) [![NPM downloads](https://img.shields.io/npm/dm/@elastic/elasticsearch.svg?style=flat)](https://www.npmjs.com/package/@elastic/elasticsearch) +The official Node.js client for Elasticsearch. + --- -**Note:** In the past months we have worked on the new Elasticsearch Node.js client, and if you want you can already try it by following the instructions below, while if you're going to use the legacy one or report an issue, please check out [elastic/elasticsearch-js-legacy](https://github.com/elastic/elasticsearch-js-legacy). +**Note:** In the past months we have worked on the new Elasticsearch Node.js client and you can use it by following the instructions below. If you're going to use the legacy one or report an issue, however, please check out [elastic/elasticsearch-js-legacy](https://github.com/elastic/elasticsearch-js-legacy). --- -The official Node.js client for Elasticsearch. - ## Features - One-to-one mapping with REST API. - Generalized, pluggable architecture. - Configurable, automatic discovery of cluster nodes. - Persistent, Keep-Alive connections. -- Load balancing (with pluggable selection strategy) across all available nodes. +- Load balancing across all available nodes. +- Child client support. - TypeScript support out of the box. ## Install @@ -29,62 +30,49 @@ npm install @elastic/elasticsearch The minimum supported version of Node.js is `v8`. -The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using. -``` -# Elasticsearch 7.x -@elastic/elasticsearch@7 +The library is compatible with all Elasticsearch versions since 5.x, and you should use the same major version of the Elasticsearch instance that you are using. -# Elasticsearch 6.x -@elastic/elasticsearch@6 +| Elasticsearch Version | Client Version | +| --------------------- |----------------| +| `master` | `master` | +| `7.x` | `7.x` | +| `6.x` | `6.x` | +| `5.x` | `5.x` | -# Elasticsearch 5.x -@elastic/elasticsearch@5 +To install a specific major of the client, run the following command: ``` - -#### Install multiple versions -If you are using multiple versions of Elasticsearch, you need to use multiple versions of the client. In the past, install multiple versions of the same package was not possible, but with `npm v6.9`, you can do that via aliasing. - -The command you must run to install different version of the client is: -```sh -npm install @npm:@elastic/elasticsearch@ +npm install @elastic/elasticsearch@ ``` -So for example if you need to install `7.x` and `6.x`, you will run -```sh -npm install es6@npm:@elastic/elasticsearch@6 -npm install es7@npm:@elastic/elasticsearch@7 -``` -And your `package.json` will look like the following: -```json -"dependencies": { - "es6": "npm:@elastic/elasticsearch@^6.7.0", - "es7": "npm:@elastic/elasticsearch@^7.0.0" -} -``` -And finally, you will require the packages from your code by using the alias you have defined. -```js -const { Client: Client6 } = require('es6') -const { Client: Client7 } = require('es7') -const client6 = new Client6({ node: 'http://localhost:9200' }) -const client7 = new Client7({ node: 'http://localhost:9201' }) +#### Browser -client6.info(console.log) -client7.info(console.log) -``` +WARNING: There is no official support for the browser environment. It exposes your Elasticsearch instance to everyone, which could lead to security issues. +We recommend that you write a lightweight proxy that uses this client instead. -Finally, if you want to install the client for the next version of Elasticsearch *(the one that lives in Elasticsearch’s master branch)*, you can use the following command: -```sh -npm install esmaster@github:elastic/elasticsearch-js -``` +## Documentation -## Usage +- [Introduction](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/introduction.html) +- [Usage](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-usage.html) +- [Client configuration](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-configuration.html) +- [API reference](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html) +- [Breaking changes coming from the old client](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/breaking-changes.html) +- [Authentication](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html) +- [Observability](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/observability.html) +- [Creating a child client](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/child-client.html) +- [Extend the client](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/extend-client.html) +- [Typescript support](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/typescript.html) +- [Examples](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/examples.html) -You can find the full documentation in our [docs](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html) website. +## Quick start +First of all, require the client and initialize it: ```js const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://localhost:9200' }) +``` +You can use both the callback-style API and the promise-style API, both behave the same way. +```js // promise API const result = await client.search({ index: 'my-index', @@ -109,85 +97,99 @@ The returned value of **every** API call is formed as follows: meta: object } ``` -### Client options -The client is designed to be easily configured as you see fit for your needs, following you can see all the possible options that you can use to configure it. +Let's see a complete example! +```js +'use strict' -```ts -{ - // the Elasticsearch endpoint to use - node: string | string[]; - // alias of above - nodes: string | string[]; - // custom connection class - Connection: typeof Connection; - // custom connection pool class - ConnectionPool: typeof ConnectionPool; - // custom transport class - Transport: typeof Transport; - // custom serializer class - Serializer: typeof Serializer; - // max number of retries for each request - maxRetries: number; - // max request timeout for each request - requestTimeout: number; - // max ping timeout for each request - pingTimeout: number; - // perform a sniff operation every `n` milliseconds - sniffInterval: number; - // perform a sniff once the client is started - sniffOnStart: boolean; - // custom sniff endpoint, defaults `_nodes/_all/http` - sniffEndpoint: string; - // perform a sniff on connection fault - sniffOnConnectionFault: boolean; - // configurethe node resurrection strategy, default `ping` - resurrectStrategy: 'ping' | 'optimistic' | 'none'; - // adds `accept-encoding` header to every request - suggestCompression: boolean; - // enable gzip request body compression - compression: 'gzip'; - // ssl configuraton - ssl: http.SecureContextOptions; - // http agent options - agent: http.AgentOptions; - // filters which node not to use for a request - nodeFilter: nodeFilterFn; - // custom selection strategy, defaults `round-robin` - nodeSelector: nodeSelectorFn | string; - // function to generate the request id for every request - generateRequestId: generateRequestIdFn; - // name to identify the client instance in the events - name: string; +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) + +async function run () { + // Let's start by indexing some data + await client.index({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + character: 'Ned Stark', + quote: 'Winter is coming.' + } + }) + + await client.index({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + character: 'Daenerys Targaryen', + quote: 'I am the blood of the dragon.' + } + }) + + await client.index({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + character: 'Tyrion Lannister', + quote: 'A mind needs books like a sword needs a whetstone.' + } + }) + + // here we are forcing an index refresh, otherwise we will not + // get any result in the consequent search + await client.indices.refresh({ index: 'game-of-thrones' }) + + // Let's search! + const { body } = await client.search({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + query: { + match: { quote: 'winter' } + } + } + }) + + console.log(body.hits.hits) } + +run().catch(console.log) ``` -### Request specific options -If needed you can pass request specific options in a second object: -```js -// promise API -const result = await client.search({ - index: 'my-index', - body: { foo: 'bar' } -}, { - ignore: [404], - maxRetries: 3 -}) +## Install multiple versions +If you are using multiple versions of Elasticsearch, you need to use multiple versions of the client. In the past, install multiple versions of the same package was not possible, but with `npm v6.9`, you can do that via aliasing. + +The command you must run to install different version of the client is: +```sh +npm install @npm:@elastic/elasticsearch@ ``` -The supported *request specific options* are: -```ts -{ - ignore: [number], // default `null` - requestTimeout: number, // client default - maxRetries: number, // default `5` - asStream: boolean, // default `false` - compression: string, // default `false` - headers: object, // default `null` - querystring: object // default `null`, - context: object // default `null`, - id: any // default incr. integer +So for example if you need to install `7.x` and `6.x`, you will run +```sh +npm install es6@npm:@elastic/elasticsearch@6 +npm install es7@npm:@elastic/elasticsearch@7 +``` +And your `package.json` will look like the following: +```json +"dependencies": { + "es6": "npm:@elastic/elasticsearch@^6.7.0", + "es7": "npm:@elastic/elasticsearch@^7.0.0" } ``` +You will require the packages from your code by using the alias you have defined. +```js +const { Client: Client6 } = require('es6') +const { Client: Client7 } = require('es7') + +const client6 = new Client6({ node: 'http://localhost:9200' }) +const client7 = new Client7({ node: 'http://localhost:9201' }) + +client6.info(console.log) +client7.info(console.log) +``` + +Finally, if you want to install the client for the next version of Elasticsearch *(the one that lives in Elasticsearch’s master branch)*, you can use the following command: +```sh +npm install esmaster@github:elastic/elasticsearch-js +``` ## License diff --git a/docs/index.asciidoc b/docs/index.asciidoc index c0527c567..8dc3d617e 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -1,4 +1,4 @@ -= @elastic/elasticsearch += Elasticsearch Node.js client :branch: master include::{asciidoc-dir}/../../shared/attributes.asciidoc[] diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc index 4bdd7083a..99557aca8 100644 --- a/docs/introduction.asciidoc +++ b/docs/introduction.asciidoc @@ -8,7 +8,8 @@ The official Node.js client for Elasticsearch. * Generalized, pluggable architecture. * Configurable, automatic discovery of cluster nodes. * Persistent, Keep-Alive connections. -* Load balancing (with pluggable selection strategy) across all available nodes. +* Load balancing across all available nodes. +* Child client support. * TypeScript support out of the box. === Install @@ -18,18 +19,133 @@ npm install @elastic/elasticsearch ---- === Compatibility + The minimum supported version of Node.js is `v8`. -The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using. +The library is compatible with all Elasticsearch versions since 5.x, and you should use the same major version of the Elasticsearch instance that you are using. + +[%header,cols=2*] +|=== +|Elasticsearch Version +|Client Version + +|`master` +|`master` + +|`7.x` +|`7.x` + +|`6.x` +|`6.x` + +|`5.x` +|`5.x` +|=== + +To install a specific major of the client, run the following command: ---- -# Elasticsearch 7.x -@elastic/elasticsearch@7 +npm install @elastic/elasticsearch@ +---- + +==== Browser + +WARNING: There is no official support for the browser environment. It exposes your Elasticsearch instance to everyone, which could lead to security issues. +We recommend that you write a lightweight proxy that uses this client instead. -# Elasticsearch 6.x -@elastic/elasticsearch@6 +=== Quick start + +First of all, require the client and initialize it: +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) +---- + +You can use both the callback-style API and the promise-style API, both behave the same way. +[source,js] +---- +// promise API +const result = await client.search({ + index: 'my-index', + body: { foo: 'bar' } +}) + +// callback API +client.search({ + index: 'my-index', + body: { foo: 'bar' } +}, (err, result) => { + if (err) console.log(err) +}) +---- +The returned value of **every** API call is formed as follows: +[source,ts] +---- +{ + body: object | boolean + statusCode: number + headers: object + warnings: [string] + meta: object +} +---- + +Let's see a complete example! +[source,js] +---- +'use strict' + +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ node: 'http://localhost:9200' }) + +async function run () { + // Let's start by indexing some data + await client.index({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + character: 'Ned Stark', + quote: 'Winter is coming.' + } + }) + + await client.index({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + character: 'Daenerys Targaryen', + quote: 'I am the blood of the dragon.' + } + }) + + await client.index({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + character: 'Tyrion Lannister', + quote: 'A mind needs books like a sword needs a whetstone.' + } + }) + + // here we are forcing an index refresh, otherwise we will not + // get any result in the consequent search + await client.indices.refresh({ index: 'game-of-thrones' }) + + // Let's search! + const { body } = await client.search({ + index: 'game-of-thrones', + // type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 + body: { + query: { + match: { quote: 'winter' } + } + } + }) + + console.log(body.hits.hits) +} -# Elasticsearch 5.x -@elastic/elasticsearch@5 +run().catch(console.log) ---- ==== Install multiple versions @@ -59,7 +175,7 @@ And your `package.json` will look like the following: } ---- -And finally, you will require the packages from your code by using the alias you have defined. +You will require the packages from your code by using the alias you have defined. [source,js] ---- From 2bd1c66e6dd93777f736e5b85708f6cf1d3ffa91 Mon Sep 17 00:00:00 2001 From: Victor Voisin Date: Wed, 17 Jul 2019 17:04:01 +0200 Subject: [PATCH 66/84] Fix typo in comments (#912) --- docs/typescript.asciidoc | 4 ++-- test/types/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/typescript.asciidoc b/docs/typescript.asciidoc index 237b27084..e6f1ca8c3 100644 --- a/docs/typescript.asciidoc +++ b/docs/typescript.asciidoc @@ -52,7 +52,7 @@ interface SearchResponse { } } -// Define the intefrace of the source object +// Define the interface of the source object interface Source { foo: string } @@ -123,7 +123,7 @@ interface SearchResponse { aggregations?: any; } -// Define the intefrace of the source object +// Define the interface of the source object interface Source { foo: string } diff --git a/test/types/index.ts b/test/types/index.ts index 2aa0526e9..fb72ff965 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -128,7 +128,7 @@ const searchParams: RequestParams.Search = { } } -// Dewfine the interface of the search response +// Define the interface of the search response interface SearchResponse { hits: { hits: Array<{ @@ -137,7 +137,7 @@ interface SearchResponse { } } -// Define the intefrace of the source object +// Define the interface of the source object interface Source { foo: string } From ffd66c17af525239838f378c342f9598d08e495b Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 17 Jul 2019 18:39:41 +0200 Subject: [PATCH 67/84] Updated test matrix --- .ci/test-matrix.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index c3472b466..cade51d79 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -1,8 +1,6 @@ --- ELASTICSEARCH_VERSION: - - 7.2.0 - - 7.1.0 - - 7.0.0 + - 7.3-SNAPSHOT NODE_JS_VERSION: - 12 From 62e7ba5653a76737f55d21abb4c6b5149ade9bed Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 17 Jul 2019 18:44:44 +0200 Subject: [PATCH 68/84] Updated ci jobs definitions --- .ci/jobs/elastic+elasticsearch-js+6.9.yml | 14 ++++++++++++++ .ci/jobs/elastic+elasticsearch-js+7.3.yml | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .ci/jobs/elastic+elasticsearch-js+6.9.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+7.3.yml diff --git a/.ci/jobs/elastic+elasticsearch-js+6.9.yml b/.ci/jobs/elastic+elasticsearch-js+6.9.yml new file mode 100644 index 000000000..606f8ada6 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+6.9.yml @@ -0,0 +1,14 @@ +--- +- job: + name: elastic+elasticsearch-js+6.9 + display-name: 'elastic / elasticsearch-js # 6.9' + description: Testing the elasticsearch-js 6.9 branch. + parameters: + - string: + name: branch_specifier + default: refs/heads/6.9 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: '@weekly' diff --git a/.ci/jobs/elastic+elasticsearch-js+7.3.yml b/.ci/jobs/elastic+elasticsearch-js+7.3.yml new file mode 100644 index 000000000..51202e0b6 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+7.3.yml @@ -0,0 +1,14 @@ +--- +- job: + name: elastic+elasticsearch-js+7.3 + display-name: 'elastic / elasticsearch-js # 7.3' + description: Testing the elasticsearch-js 7.3 branch. + parameters: + - string: + name: branch_specifier + default: refs/heads/7.3 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: '@weekly' From 2240e0531c9fd90276b683a772a286b8065a0237 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 17 Jul 2019 18:46:40 +0200 Subject: [PATCH 69/84] API generation --- api/api/bulk.js | 4 - .../data_frame.get_data_frame_transform.js | 6 +- ...ta_frame.get_data_frame_transform_stats.js | 6 +- .../data_frame.stop_data_frame_transform.js | 8 +- api/api/delete_by_query.js | 9 +- api/api/exists.js | 4 - api/api/exists_source.js | 4 - api/api/explain.js | 4 - api/api/get.js | 4 - api/api/get_source.js | 4 - api/api/indices.reload_search_analyzers.js | 103 +++++++++ api/api/mget.js | 4 - api/api/ml.delete_data_frame_analytics.js | 100 +++++++++ api/api/ml.evaluate_data_frame.js | 96 ++++++++ api/api/ml.find_file_structure.js | 3 + api/api/ml.get_data_frame_analytics.js | 106 +++++++++ api/api/ml.get_data_frame_analytics_stats.js | 106 +++++++++ api/api/ml.put_data_frame_analytics.js | 101 +++++++++ api/api/ml.start_data_frame_analytics.js | 98 +++++++++ api/api/ml.stop_data_frame_analytics.js | 103 +++++++++ api/api/reindex.js | 3 + api/api/search.js | 4 - ....js => security.get_builtin_privileges.js} | 27 ++- api/api/security.get_privileges.js | 2 +- api/api/update.js | 4 - api/api/update_by_query.js | 9 +- api/index.js | 20 +- api/requestParams.d.ts | 84 ++++--- docs/reference.asciidoc | 205 ++++++++++++++++-- index.d.ts | 20 +- 30 files changed, 1138 insertions(+), 113 deletions(-) create mode 100644 api/api/indices.reload_search_analyzers.js create mode 100644 api/api/ml.delete_data_frame_analytics.js create mode 100644 api/api/ml.evaluate_data_frame.js create mode 100644 api/api/ml.get_data_frame_analytics.js create mode 100644 api/api/ml.get_data_frame_analytics_stats.js create mode 100644 api/api/ml.put_data_frame_analytics.js create mode 100644 api/api/ml.start_data_frame_analytics.js create mode 100644 api/api/ml.stop_data_frame_analytics.js rename api/api/{scripts_painless_context.js => security.get_builtin_privileges.js} (78%) diff --git a/api/api/bulk.js b/api/api/bulk.js index 505fe99ec..cf09dbbdd 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -50,9 +50,7 @@ function buildBulk (opts) { 'type', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'pipeline', 'pretty', 'human', @@ -64,9 +62,7 @@ function buildBulk (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index 160f75c7e..1d58d4321 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -31,15 +31,17 @@ function buildDataFrameGetDataFrameTransform (opts) { * @param {string} transform_id - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms * @param {int} from - skips a number of transform configs, defaults to 0 * @param {int} size - specifies a max number of transforms to get, defaults to 100 + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) */ const acceptedQuerystring = [ 'from', - 'size' + 'size', + 'allow_no_match' ] const snakeCase = { - + allowNoMatch: 'allow_no_match' } return function dataFrameGetDataFrameTransform (params, options, callback) { diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index c11e1e94b..ad6fac084 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -31,15 +31,17 @@ function buildDataFrameGetDataFrameTransformStats (opts) { * @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms * @param {number} from - skips a number of transform stats, defaults to 0 * @param {number} size - specifies a max number of transform stats to get, defaults to 100 + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) */ const acceptedQuerystring = [ 'from', - 'size' + 'size', + 'allow_no_match' ] const snakeCase = { - + allowNoMatch: 'allow_no_match' } return function dataFrameGetDataFrameTransformStats (params, options, callback) { diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index 87ee0929f..34d65ae76 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -31,16 +31,18 @@ function buildDataFrameStopDataFrameTransform (opts) { * @param {string} transform_id - The id of the transform to stop * @param {boolean} wait_for_completion - Whether to wait for the transform to fully stop before returning or not. Default to false * @param {time} timeout - Controls the time to wait until the transform has stopped. Default to 30 seconds + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) */ const acceptedQuerystring = [ 'wait_for_completion', - 'timeout' + 'timeout', + 'allow_no_match' ] const snakeCase = { - waitForCompletion: 'wait_for_completion' - + waitForCompletion: 'wait_for_completion', + allowNoMatch: 'allow_no_match' } return function dataFrameStopDataFrameTransform (params, options, callback) { diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index b6b5fc605..299c1ecb2 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -46,7 +46,8 @@ function buildDeleteByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. - * @param {number} size - Number of hits to return (default: 10) + * @param {number} size - Deprecated, please use `max_docs` instead + * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field @@ -83,12 +84,11 @@ function buildDeleteByQuery (opts) { 'search_type', 'search_timeout', 'size', + 'max_docs', 'sort', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'terminate_after', 'stats', 'version', @@ -115,10 +115,9 @@ function buildDeleteByQuery (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', + maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', diff --git a/api/api/exists.js b/api/api/exists.js index 4ee50bdfa..f81253a11 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -51,9 +51,7 @@ function buildExists (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -66,9 +64,7 @@ function buildExists (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 8d1b4d31a..b2085a032 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -49,9 +49,7 @@ function buildExistsSource (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -63,9 +61,7 @@ function buildExistsSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/explain.js b/api/api/explain.js index 243b9f248..79d58d198 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -58,9 +58,7 @@ function buildExplain (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'pretty', 'human', 'error_trace', @@ -73,9 +71,7 @@ function buildExplain (opts) { defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/get.js b/api/api/get.js index 8f6e6300b..a3d75153f 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -51,9 +51,7 @@ function buildGet (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -66,9 +64,7 @@ function buildGet (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/get_source.js b/api/api/get_source.js index 40e21e431..b3938cd71 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -49,9 +49,7 @@ function buildGetSource (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -63,9 +61,7 @@ function buildGetSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/indices.reload_search_analyzers.js b/api/api/indices.reload_search_analyzers.js new file mode 100644 index 000000000..c4d36be6a --- /dev/null +++ b/api/api/indices.reload_search_analyzers.js @@ -0,0 +1,103 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildIndicesReloadSearchAnalyzers (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [indices.reload_search_analyzers](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html) request + * + * @param {list} index - A comma-separated list of index names to reload analyzers for + * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} allow_no_indices - 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 {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + */ + + const acceptedQuerystring = [ + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards' + ] + + const snakeCase = { + ignoreUnavailable: 'ignore_unavailable', + allowNoIndices: 'allow_no_indices', + expandWildcards: 'expand_wildcards' + } + + return function indicesReloadSearchAnalyzers (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = body == null ? 'GET' : 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + encodeURIComponent(index) + '/' + '_reload_search_analyzers' + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildIndicesReloadSearchAnalyzers diff --git a/api/api/mget.js b/api/api/mget.js index b32742a97..7a0b5ee4c 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -49,9 +49,7 @@ function buildMget (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'pretty', 'human', 'error_trace', @@ -62,9 +60,7 @@ function buildMget (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/ml.delete_data_frame_analytics.js b/api/api/ml.delete_data_frame_analytics.js new file mode 100644 index 000000000..f1f9c10bb --- /dev/null +++ b/api/api/ml.delete_data_frame_analytics.js @@ -0,0 +1,100 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlDeleteDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.delete_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html) request + * + * @param {string} id - The ID of the data frame analytics to delete + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function mlDeleteDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'DELETE' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlDeleteDataFrameAnalytics diff --git a/api/api/ml.evaluate_data_frame.js b/api/api/ml.evaluate_data_frame.js new file mode 100644 index 000000000..861a649c0 --- /dev/null +++ b/api/api/ml.evaluate_data_frame.js @@ -0,0 +1,96 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlEvaluateDataFrame (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.evaluate_data_frame](http://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html) request + * + * @param {object} body - The evaluation definition + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function mlEvaluateDataFrame (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + '_evaluate' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlEvaluateDataFrame diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index eee5b0e56..6371e36a6 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -29,6 +29,7 @@ function buildMlFindFileStructure (opts) { * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html) request * * @param {int} lines_to_sample - How many lines of the file should be included in the analysis + * @param {int} line_merge_size_limit - Maximum number of characters permitted in a single message when lines are merged to create messages. * @param {time} timeout - Timeout after which the analysis will be aborted * @param {string} charset - Optional parameter to specify the character set of the file * @param {enum} format - Optional parameter to specify the high level file format @@ -46,6 +47,7 @@ function buildMlFindFileStructure (opts) { const acceptedQuerystring = [ 'lines_to_sample', + 'line_merge_size_limit', 'timeout', 'charset', 'format', @@ -62,6 +64,7 @@ function buildMlFindFileStructure (opts) { const snakeCase = { linesToSample: 'lines_to_sample', + lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', diff --git a/api/api/ml.get_data_frame_analytics.js b/api/api/ml.get_data_frame_analytics.js new file mode 100644 index 000000000..809a46682 --- /dev/null +++ b/api/api/ml.get_data_frame_analytics.js @@ -0,0 +1,106 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlGetDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.get_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html) request + * + * @param {string} id - The ID of the data frame analytics to fetch + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {int} from - skips a number of analytics + * @param {int} size - specifies a max number of analytics to get + */ + + const acceptedQuerystring = [ + 'allow_no_match', + 'from', + 'size' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + return function mlGetDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + if ((id) != null) { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + } else { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlGetDataFrameAnalytics diff --git a/api/api/ml.get_data_frame_analytics_stats.js b/api/api/ml.get_data_frame_analytics_stats.js new file mode 100644 index 000000000..a926eedb7 --- /dev/null +++ b/api/api/ml.get_data_frame_analytics_stats.js @@ -0,0 +1,106 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlGetDataFrameAnalyticsStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.get_data_frame_analytics_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html) request + * + * @param {string} id - The ID of the data frame analytics stats to fetch + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {int} from - skips a number of analytics + * @param {int} size - specifies a max number of analytics to get + */ + + const acceptedQuerystring = [ + 'allow_no_match', + 'from', + 'size' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + return function mlGetDataFrameAnalyticsStats (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + if ((id) != null) { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stats' + } else { + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_stats' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlGetDataFrameAnalyticsStats diff --git a/api/api/ml.put_data_frame_analytics.js b/api/api/ml.put_data_frame_analytics.js new file mode 100644 index 000000000..f18e7912e --- /dev/null +++ b/api/api/ml.put_data_frame_analytics.js @@ -0,0 +1,101 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlPutDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.put_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html) request + * + * @param {string} id - The ID of the data frame analytics to create + * @param {object} body - The data frame analytics configuration + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function mlPutDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'PUT' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlPutDataFrameAnalytics diff --git a/api/api/ml.start_data_frame_analytics.js b/api/api/ml.start_data_frame_analytics.js new file mode 100644 index 000000000..df5ff817f --- /dev/null +++ b/api/api/ml.start_data_frame_analytics.js @@ -0,0 +1,98 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlStartDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.start_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/start-dfanalytics.html) request + * + * @param {string} id - The ID of the data frame analytics to start + * @param {time} timeout - Controls the time to wait until the task has started. Defaults to 20 seconds + * @param {object} body - The start data frame analytics parameters + */ + + const acceptedQuerystring = [ + 'timeout' + ] + + const snakeCase = { + + } + + return function mlStartDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_start' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlStartDataFrameAnalytics diff --git a/api/api/ml.stop_data_frame_analytics.js b/api/api/ml.stop_data_frame_analytics.js new file mode 100644 index 000000000..212a59b9f --- /dev/null +++ b/api/api/ml.stop_data_frame_analytics.js @@ -0,0 +1,103 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildMlStopDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + /** + * Perform a [ml.stop_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/stop-dfanalytics.html) request + * + * @param {string} id - The ID of the data frame analytics to stop + * @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + * @param {boolean} force - True if the data frame analytics should be forcefully stopped + * @param {time} timeout - Controls the time to wait until the task has stopped. Defaults to 20 seconds + * @param {object} body - The stop data frame analytics parameters + */ + + const acceptedQuerystring = [ + 'allow_no_match', + 'force', + 'timeout' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + return function mlStopDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['id'] == null) { + const err = new ConfigurationError('Missing required parameter: id') + return handleError(err, callback) + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stop' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildMlStopDataFrameAnalytics diff --git a/api/api/reindex.js b/api/api/reindex.js index 85722b4ce..812a88bd4 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -35,6 +35,7 @@ function buildReindex (opts) { * @param {number} requests_per_second - The throttle to set on this request in sub-requests per second. -1 means no throttle. * @param {time} scroll - Control how long to keep the search context alive * @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {object} body - The search definition using the Query DSL and the prototype for the index request. */ @@ -46,6 +47,7 @@ function buildReindex (opts) { 'requests_per_second', 'scroll', 'slices', + 'max_docs', 'pretty', 'human', 'error_trace', @@ -57,6 +59,7 @@ function buildReindex (opts) { waitForActiveShards: 'wait_for_active_shards', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', + maxDocs: 'max_docs', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/search.js b/api/api/search.js index 5d328766f..6a1726ee0 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -99,9 +99,7 @@ function buildSearch (opts) { 'sort', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'terminate_after', 'stats', 'suggest_field', @@ -139,9 +137,7 @@ function buildSearch (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', diff --git a/api/api/scripts_painless_context.js b/api/api/security.get_builtin_privileges.js similarity index 78% rename from api/api/scripts_painless_context.js rename to api/api/security.get_builtin_privileges.js index b10b63ac9..3a9bbf4d7 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/security.get_builtin_privileges.js @@ -22,30 +22,23 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildScriptsPainlessContext (opts) { +function buildSecurityGetBuiltinPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [scripts_painless_context](undefined) request + * Perform a [security.get_builtin_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-builtin-privileges.html) request * - * @param {string} context - Select a specific context to retrieve API information about */ const acceptedQuerystring = [ - 'context', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' + ] const snakeCase = { - errorTrace: 'error_trace', - filterPath: 'filter_path' + } - return function scriptsPainlessContext (params, options, callback) { + return function securityGetBuiltinPrivileges (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -57,6 +50,12 @@ function buildScriptsPainlessContext (opts) { options = {} } + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -78,7 +77,7 @@ function buildScriptsPainlessContext (opts) { var path = '' - path = '/' + '_scripts' + '/' + 'painless' + '/' + '_context' + path = '/' + '_security' + '/' + 'privilege' + '/' + '_builtin' // build request object const request = { @@ -93,4 +92,4 @@ function buildScriptsPainlessContext (opts) { } } -module.exports = buildScriptsPainlessContext +module.exports = buildSecurityGetBuiltinPrivileges diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index 5bea2a86c..ca19de5cb 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -26,7 +26,7 @@ function buildSecurityGetPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [security.get_privileges](TODO) request + * Perform a [security.get_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html) request * * @param {string} application - Application name * @param {string} name - Privilege name diff --git a/api/api/update.js b/api/api/update.js index 6130b7aa4..105856e51 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -49,9 +49,7 @@ function buildUpdate (opts) { 'wait_for_active_shards', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'lang', 'refresh', 'retry_on_conflict', @@ -69,9 +67,7 @@ function buildUpdate (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 0185a1ed5..37b0196cd 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -47,7 +47,8 @@ function buildUpdateByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. - * @param {number} size - Number of hits to return (default: 10) + * @param {number} size - Deprecated, please use `max_docs` instead + * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field @@ -86,12 +87,11 @@ function buildUpdateByQuery (opts) { 'search_type', 'search_timeout', 'size', + 'max_docs', 'sort', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'terminate_after', 'stats', 'version', @@ -119,10 +119,9 @@ function buildUpdateByQuery (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', + maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', terminateAfter: 'terminate_after', versionType: 'version_type', requestCache: 'request_cache', diff --git a/api/index.js b/api/index.js index 461bfa8a4..9ad5a45c8 100644 --- a/api/index.js +++ b/api/index.js @@ -217,6 +217,8 @@ function ESAPI (opts) { putTemplate: lazyLoad('indices.put_template', opts), recovery: lazyLoad('indices.recovery', opts), refresh: lazyLoad('indices.refresh', opts), + reload_search_analyzers: lazyLoad('indices.reload_search_analyzers', opts), + reloadSearchAnalyzers: lazyLoad('indices.reload_search_analyzers', opts), rollover: lazyLoad('indices.rollover', opts), segments: lazyLoad('indices.segments', opts), shard_stores: lazyLoad('indices.shard_stores', opts), @@ -269,6 +271,8 @@ function ESAPI (opts) { deleteCalendarEvent: lazyLoad('ml.delete_calendar_event', opts), delete_calendar_job: lazyLoad('ml.delete_calendar_job', opts), deleteCalendarJob: lazyLoad('ml.delete_calendar_job', opts), + delete_data_frame_analytics: lazyLoad('ml.delete_data_frame_analytics', opts), + deleteDataFrameAnalytics: lazyLoad('ml.delete_data_frame_analytics', opts), delete_datafeed: lazyLoad('ml.delete_datafeed', opts), deleteDatafeed: lazyLoad('ml.delete_datafeed', opts), delete_expired_data: lazyLoad('ml.delete_expired_data', opts), @@ -281,6 +285,8 @@ function ESAPI (opts) { deleteJob: lazyLoad('ml.delete_job', opts), delete_model_snapshot: lazyLoad('ml.delete_model_snapshot', opts), deleteModelSnapshot: lazyLoad('ml.delete_model_snapshot', opts), + evaluate_data_frame: lazyLoad('ml.evaluate_data_frame', opts), + evaluateDataFrame: lazyLoad('ml.evaluate_data_frame', opts), find_file_structure: lazyLoad('ml.find_file_structure', opts), findFileStructure: lazyLoad('ml.find_file_structure', opts), flush_job: lazyLoad('ml.flush_job', opts), @@ -294,6 +300,10 @@ function ESAPI (opts) { getCalendars: lazyLoad('ml.get_calendars', opts), get_categories: lazyLoad('ml.get_categories', opts), getCategories: lazyLoad('ml.get_categories', opts), + get_data_frame_analytics: lazyLoad('ml.get_data_frame_analytics', opts), + getDataFrameAnalytics: lazyLoad('ml.get_data_frame_analytics', opts), + get_data_frame_analytics_stats: lazyLoad('ml.get_data_frame_analytics_stats', opts), + getDataFrameAnalyticsStats: lazyLoad('ml.get_data_frame_analytics_stats', opts), get_datafeed_stats: lazyLoad('ml.get_datafeed_stats', opts), getDatafeedStats: lazyLoad('ml.get_datafeed_stats', opts), get_datafeeds: lazyLoad('ml.get_datafeeds', opts), @@ -325,6 +335,8 @@ function ESAPI (opts) { putCalendar: lazyLoad('ml.put_calendar', opts), put_calendar_job: lazyLoad('ml.put_calendar_job', opts), putCalendarJob: lazyLoad('ml.put_calendar_job', opts), + put_data_frame_analytics: lazyLoad('ml.put_data_frame_analytics', opts), + putDataFrameAnalytics: lazyLoad('ml.put_data_frame_analytics', opts), put_datafeed: lazyLoad('ml.put_datafeed', opts), putDatafeed: lazyLoad('ml.put_datafeed', opts), put_filter: lazyLoad('ml.put_filter', opts), @@ -335,8 +347,12 @@ function ESAPI (opts) { revertModelSnapshot: lazyLoad('ml.revert_model_snapshot', opts), set_upgrade_mode: lazyLoad('ml.set_upgrade_mode', opts), setUpgradeMode: lazyLoad('ml.set_upgrade_mode', opts), + start_data_frame_analytics: lazyLoad('ml.start_data_frame_analytics', opts), + startDataFrameAnalytics: lazyLoad('ml.start_data_frame_analytics', opts), start_datafeed: lazyLoad('ml.start_datafeed', opts), startDatafeed: lazyLoad('ml.start_datafeed', opts), + stop_data_frame_analytics: lazyLoad('ml.stop_data_frame_analytics', opts), + stopDataFrameAnalytics: lazyLoad('ml.stop_data_frame_analytics', opts), stop_datafeed: lazyLoad('ml.stop_datafeed', opts), stopDatafeed: lazyLoad('ml.stop_datafeed', opts), update_datafeed: lazyLoad('ml.update_datafeed', opts), @@ -395,8 +411,6 @@ function ESAPI (opts) { stop_job: lazyLoad('rollup.stop_job', opts), stopJob: lazyLoad('rollup.stop_job', opts) }, - scripts_painless_context: lazyLoad('scripts_painless_context', opts), - scriptsPainlessContext: lazyLoad('scripts_painless_context', opts), scripts_painless_execute: lazyLoad('scripts_painless_execute', opts), scriptsPainlessExecute: lazyLoad('scripts_painless_execute', opts), scroll: lazyLoad('scroll', opts), @@ -429,6 +443,8 @@ function ESAPI (opts) { enableUser: lazyLoad('security.enable_user', opts), get_api_key: lazyLoad('security.get_api_key', opts), getApiKey: lazyLoad('security.get_api_key', opts), + get_builtin_privileges: lazyLoad('security.get_builtin_privileges', opts), + getBuiltinPrivileges: lazyLoad('security.get_builtin_privileges', opts), get_privileges: lazyLoad('security.get_privileges', opts), getPrivileges: lazyLoad('security.get_privileges', opts), get_role: lazyLoad('security.get_role', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index f5fd4e250..2728e26df 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -30,8 +30,6 @@ export interface Generic { export interface Bulk extends Generic { index?: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; wait_for_active_shards?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; @@ -388,8 +386,6 @@ export interface Delete extends Generic { export interface DeleteByQuery extends Generic { index: string | string[]; type?: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; @@ -407,6 +403,7 @@ export interface DeleteByQuery extends Generic { search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; size?: number; + max_docs?: number; sort?: string | string[]; _source?: string | string[]; _source_excludes?: string | string[]; @@ -440,8 +437,6 @@ export interface Exists extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -458,8 +453,6 @@ export interface ExistsSource extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; preference?: string; realtime?: boolean; refresh?: boolean; @@ -475,8 +468,6 @@ export interface Explain extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; analyze_wildcard?: boolean; analyzer?: string; default_operator?: 'AND' | 'OR'; @@ -505,8 +496,6 @@ export interface Get extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -528,8 +517,6 @@ export interface GetSource extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; preference?: string; realtime?: boolean; refresh?: boolean; @@ -941,8 +928,6 @@ export interface IngestSimulate extends Generic { export interface Mget extends Generic { index?: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -1065,6 +1050,7 @@ export interface Reindex extends Generic { requests_per_second?: number; scroll?: string; slices?: number; + max_docs?: number; body: T; } @@ -1078,10 +1064,6 @@ export interface RenderSearchTemplate extends Generic { body?: T; } -export interface ScriptsPainlessContext extends Generic { - context?: string; -} - export interface ScriptsPainlessExecute extends Generic { body?: T; } @@ -1096,8 +1078,6 @@ export interface Scroll extends Generic { export interface Search extends Generic { index?: string | string[]; type?: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; ccs_minimize_roundtrips?: boolean; @@ -1280,8 +1260,6 @@ export interface Update extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; wait_for_active_shards?: string; _source?: string | string[]; _source_excludes?: string | string[]; @@ -1299,8 +1277,6 @@ export interface Update extends Generic { export interface UpdateByQuery extends Generic { index: string | string[]; type?: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; @@ -1319,6 +1295,7 @@ export interface UpdateByQuery extends Generic { search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; size?: number; + max_docs?: number; sort?: string | string[]; _source?: string | string[]; _source_excludes?: string | string[]; @@ -1399,12 +1376,14 @@ export interface DataFrameGetDataFrameTransform extends Generic { transform_id?: string; from?: number; size?: number; + allow_no_match?: boolean; } export interface DataFrameGetDataFrameTransformStats extends Generic { transform_id?: string; from?: number; size?: number; + allow_no_match?: boolean; } export interface DataFramePreviewDataFrameTransform extends Generic { @@ -1425,6 +1404,7 @@ export interface DataFrameStopDataFrameTransform extends Generic { transform_id: string; wait_for_completion?: boolean; timeout?: string; + allow_no_match?: boolean; } export interface GraphExplore extends Generic { @@ -1484,6 +1464,13 @@ export interface IndicesFreeze extends Generic { wait_for_active_shards?: string; } +export interface IndicesReloadSearchAnalyzers extends Generic { + index?: string | string[]; + ignore_unavailable?: boolean; + allow_no_indices?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; +} + export interface IndicesUnfreeze extends Generic { index: string; timeout?: string; @@ -1547,6 +1534,10 @@ export interface MlDeleteCalendarJob extends Generic { job_id: string; } +export interface MlDeleteDataFrameAnalytics extends Generic { + id: string; +} + export interface MlDeleteDatafeed extends Generic { datafeed_id: string; force?: boolean; @@ -1577,8 +1568,13 @@ export interface MlDeleteModelSnapshot extends Generic { snapshot_id: string; } +export interface MlEvaluateDataFrame extends Generic { + body: T; +} + export interface MlFindFileStructure extends Generic { lines_to_sample?: number; + line_merge_size_limit?: number; timeout?: string; charset?: string; format?: 'ndjson' | 'xml' | 'delimited' | 'semi_structured_text'; @@ -1649,6 +1645,20 @@ export interface MlGetCategories extends Generic { body?: T; } +export interface MlGetDataFrameAnalytics extends Generic { + id?: string; + allow_no_match?: boolean; + from?: number; + size?: number; +} + +export interface MlGetDataFrameAnalyticsStats extends Generic { + id?: string; + allow_no_match?: boolean; + from?: number; + size?: number; +} + export interface MlGetDatafeedStats extends Generic { datafeed_id?: string; allow_no_datafeeds?: boolean; @@ -1760,6 +1770,11 @@ export interface MlPutCalendarJob extends Generic { job_id: string; } +export interface MlPutDataFrameAnalytics extends Generic { + id: string; + body: T; +} + export interface MlPutDatafeed extends Generic { datafeed_id: string; body: T; @@ -1787,6 +1802,12 @@ export interface MlSetUpgradeMode extends Generic { timeout?: string; } +export interface MlStartDataFrameAnalytics extends Generic { + id: string; + timeout?: string; + body?: T; +} + export interface MlStartDatafeed extends Generic { datafeed_id: string; start?: string; @@ -1795,6 +1816,14 @@ export interface MlStartDatafeed extends Generic { body?: T; } +export interface MlStopDataFrameAnalytics extends Generic { + id: string; + allow_no_match?: boolean; + force?: boolean; + timeout?: string; + body?: T; +} + export interface MlStopDatafeed extends Generic { datafeed_id: string; allow_no_datafeeds?: boolean; @@ -1939,6 +1968,9 @@ export interface SecurityGetApiKey extends Generic { realm_name?: string; } +export interface SecurityGetBuiltinPrivileges extends Generic { +} + export interface SecurityGetPrivileges extends Generic { application?: string; name?: string; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 90333288b..29fe36eb6 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1209,7 +1209,10 @@ _Default:_ `open` |`string` - Explicit timeout for each search request. Defaults to no timeout. |`size` -|`number` - Number of hits to return (default: 10) +|`number` - Deprecated, please use `max_docs` instead + +|`max_docs` or `maxDocs` +|`number` - Maximum number of documents to process (default: all documents) |`sort` |`string, string[]` - A comma-separated list of : pairs @@ -3265,6 +3268,9 @@ _Default:_ `5m` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + _Default:_ `1` +|`max_docs` or `maxDocs` +|`number` - Maximum number of documents to process (default: all documents) + |`body` |`object` - The search definition using the Query DSL and the prototype for the index request. @@ -3302,18 +3308,6 @@ link:{ref}/search-template.html[Reference] |=== -=== scriptsPainlessContext -[source,js] ----- -client.scriptsPainlessContext([params] [, options] [, callback]) ----- -[cols=2*] -|=== -|`context` -|`string` - Select a specific context to retrieve API information about - -|=== - === scriptsPainlessExecute [source,js] ---- @@ -4051,7 +4045,10 @@ _Default:_ `open` |`string` - Explicit timeout for each search request. Defaults to no timeout. |`size` -|`number` - Number of hits to return (default: 10) +|`number` - Deprecated, please use `max_docs` instead + +|`max_docs` or `maxDocs` +|`number` - Maximum number of documents to process (default: all documents) |`sort` |`string, string[]` - A comma-separated list of : pairs @@ -4309,6 +4306,9 @@ link:{ref}/get-data-frame-transform.html[Reference] |`size` |`number` - specifies a max number of transforms to get, defaults to 100 +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) + |=== === dataFrame.getDataFrameTransformStats @@ -4328,6 +4328,9 @@ link:{ref}/get-data-frame-transform-stats.html[Reference] |`size` |`number` - specifies a max number of transform stats to get, defaults to 100 +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) + |=== === dataFrame.previewDataFrameTransform @@ -4392,6 +4395,9 @@ link:{ref}/stop-data-frame-transform.html[Reference] |`timeout` |`string` - Controls the time to wait until the transform has stopped. Default to 30 seconds +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) + |=== === graph.explore @@ -4572,6 +4578,29 @@ _Default:_ `closed` |=== +=== indices.reloadSearchAnalyzers +[source,js] +---- +client.indices.reloadSearchAnalyzers([params] [, options] [, callback]) +---- +link:{ref}/indices-reload-analyzers.html[Reference] +[cols=2*] +|=== +|`index` +|`string, string[]` - A comma-separated list of index names to reload analyzers for + +|`ignore_unavailable` or `ignoreUnavailable` +|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) + +|`allow_no_indices` or `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) + +|`expand_wildcards` or `expandWildcards` +|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `open` + +|=== + === indices.unfreeze [source,js] ---- @@ -4766,6 +4795,19 @@ client.ml.deleteCalendarJob([params] [, options] [, callback]) |=== +=== ml.deleteDataFrameAnalytics +[source,js] +---- +client.ml.deleteDataFrameAnalytics([params] [, options] [, callback]) +---- +link:{ref}/delete-dfanalytics.html[Reference] +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to delete + +|=== + === ml.deleteDatafeed [source,js] ---- @@ -4859,6 +4901,19 @@ link:{ref}/ml-delete-snapshot.html[Reference] |=== +=== ml.evaluateDataFrame +[source,js] +---- +client.ml.evaluateDataFrame([params] [, options] [, callback]) +---- +link:{ref}/evaluate-dfanalytics.html[Reference] +[cols=2*] +|=== +|`body` +|`object` - The evaluation definition + +|=== + === ml.findFileStructure [source,js] ---- @@ -4871,6 +4926,10 @@ link:{ref}/ml-find-file-structure.html[Reference] |`number` - How many lines of the file should be included in the analysis + _Default:_ `1000` +|`line_merge_size_limit` or `lineMergeSizeLimit` +|`number` - Maximum number of characters permitted in a single message when lines are merged to create messages. + +_Default:_ `10000` + |`timeout` |`string` - Timeout after which the analysis will be aborted + _Default:_ `25s` @@ -5081,6 +5140,54 @@ link:{ref}/ml-get-category.html[Reference] |=== +=== ml.getDataFrameAnalytics +[source,js] +---- +client.ml.getDataFrameAnalytics([params] [, options] [, callback]) +---- +link:{ref}/get-dfanalytics.html[Reference] +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to fetch + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + +_Default:_ `true` + +|`from` +|`number` - skips a number of analytics + +|`size` +|`number` - specifies a max number of analytics to get + +_Default:_ `100` + +|=== + +=== ml.getDataFrameAnalyticsStats +[source,js] +---- +client.ml.getDataFrameAnalyticsStats([params] [, options] [, callback]) +---- +link:{ref}/get-dfanalytics-stats.html[Reference] +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics stats to fetch + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + +_Default:_ `true` + +|`from` +|`number` - skips a number of analytics + +|`size` +|`number` - specifies a max number of analytics to get + +_Default:_ `100` + +|=== + === ml.getDatafeedStats [source,js] ---- @@ -5423,6 +5530,22 @@ client.ml.putCalendarJob([params] [, options] [, callback]) |=== +=== ml.putDataFrameAnalytics +[source,js] +---- +client.ml.putDataFrameAnalytics([params] [, options] [, callback]) +---- +link:{ref}/put-dfanalytics.html[Reference] +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to create + +|`body` +|`object` - The data frame analytics configuration + +|=== + === ml.putDatafeed [source,js] ---- @@ -5508,6 +5631,25 @@ link:{ref}/ml-set-upgrade-mode.html[Reference] |=== +=== ml.startDataFrameAnalytics +[source,js] +---- +client.ml.startDataFrameAnalytics([params] [, options] [, callback]) +---- +link:{ref}/start-dfanalytics.html[Reference] +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to start + +|`timeout` +|`string` - Controls the time to wait until the task has started. Defaults to 20 seconds + +|`body` +|`object` - The start data frame analytics parameters + +|=== + === ml.startDatafeed [source,js] ---- @@ -5533,6 +5675,31 @@ link:{ref}/ml-start-datafeed.html[Reference] |=== +=== ml.stopDataFrameAnalytics +[source,js] +---- +client.ml.stopDataFrameAnalytics([params] [, options] [, callback]) +---- +link:{ref}/stop-dfanalytics.html[Reference] +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to stop + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) + +|`force` +|`boolean` - True if the data frame analytics should be forcefully stopped + +|`timeout` +|`string` - Controls the time to wait until the task has stopped. Defaults to 20 seconds + +|`body` +|`object` - The stop data frame analytics parameters + +|=== + === ml.stopDatafeed [source,js] ---- @@ -5980,12 +6147,20 @@ link:{ref}/security-api-get-api-key.html[Reference] |=== +=== security.getBuiltinPrivileges +[source,js] +---- +client.security.getBuiltinPrivileges([params] [, options] [, callback]) +---- +link:{ref}/security-api-get-builtin-privileges.html[Reference] + + === security.getPrivileges [source,js] ---- client.security.getPrivileges([params] [, options] [, callback]) ---- -link:TODO[Reference] +link:{ref}/security-api-get-privileges.html[Reference] [cols=2*] |=== |`application` diff --git a/index.d.ts b/index.d.ts index 72de2f9ed..84acfeaf8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -312,6 +312,8 @@ declare class Client extends EventEmitter { putTemplate: ApiMethod recovery: ApiMethod refresh: ApiMethod + reload_search_analyzers: ApiMethod + reloadSearchAnalyzers: ApiMethod rollover: ApiMethod segments: ApiMethod shard_stores: ApiMethod @@ -364,6 +366,8 @@ declare class Client extends EventEmitter { deleteCalendarEvent: ApiMethod delete_calendar_job: ApiMethod deleteCalendarJob: ApiMethod + delete_data_frame_analytics: ApiMethod + deleteDataFrameAnalytics: ApiMethod delete_datafeed: ApiMethod deleteDatafeed: ApiMethod delete_expired_data: ApiMethod @@ -376,6 +380,8 @@ declare class Client extends EventEmitter { deleteJob: ApiMethod delete_model_snapshot: ApiMethod deleteModelSnapshot: ApiMethod + evaluate_data_frame: ApiMethod + evaluateDataFrame: ApiMethod find_file_structure: ApiMethod findFileStructure: ApiMethod flush_job: ApiMethod @@ -389,6 +395,10 @@ declare class Client extends EventEmitter { getCalendars: ApiMethod get_categories: ApiMethod getCategories: ApiMethod + get_data_frame_analytics: ApiMethod + getDataFrameAnalytics: ApiMethod + get_data_frame_analytics_stats: ApiMethod + getDataFrameAnalyticsStats: ApiMethod get_datafeed_stats: ApiMethod getDatafeedStats: ApiMethod get_datafeeds: ApiMethod @@ -420,6 +430,8 @@ declare class Client extends EventEmitter { putCalendar: ApiMethod put_calendar_job: ApiMethod putCalendarJob: ApiMethod + put_data_frame_analytics: ApiMethod + putDataFrameAnalytics: ApiMethod put_datafeed: ApiMethod putDatafeed: ApiMethod put_filter: ApiMethod @@ -430,8 +442,12 @@ declare class Client extends EventEmitter { revertModelSnapshot: ApiMethod set_upgrade_mode: ApiMethod setUpgradeMode: ApiMethod + start_data_frame_analytics: ApiMethod + startDataFrameAnalytics: ApiMethod start_datafeed: ApiMethod startDatafeed: ApiMethod + stop_data_frame_analytics: ApiMethod + stopDataFrameAnalytics: ApiMethod stop_datafeed: ApiMethod stopDatafeed: ApiMethod update_datafeed: ApiMethod @@ -490,8 +506,6 @@ declare class Client extends EventEmitter { stop_job: ApiMethod stopJob: ApiMethod } - scripts_painless_context: ApiMethod - scriptsPainlessContext: ApiMethod scripts_painless_execute: ApiMethod scriptsPainlessExecute: ApiMethod scroll: ApiMethod @@ -524,6 +538,8 @@ declare class Client extends EventEmitter { enableUser: ApiMethod get_api_key: ApiMethod getApiKey: ApiMethod + get_builtin_privileges: ApiMethod + getBuiltinPrivileges: ApiMethod get_privileges: ApiMethod getPrivileges: ApiMethod get_role: ApiMethod From 24e674469efe2e30e744c3502eb94928aece5212 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 18 Jul 2019 10:19:16 +0200 Subject: [PATCH 70/84] Removed branch 6.9 from ci jobs --- .ci/jobs/elastic+elasticsearch-js+6.9.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .ci/jobs/elastic+elasticsearch-js+6.9.yml diff --git a/.ci/jobs/elastic+elasticsearch-js+6.9.yml b/.ci/jobs/elastic+elasticsearch-js+6.9.yml deleted file mode 100644 index 606f8ada6..000000000 --- a/.ci/jobs/elastic+elasticsearch-js+6.9.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- job: - name: elastic+elasticsearch-js+6.9 - display-name: 'elastic / elasticsearch-js # 6.9' - description: Testing the elasticsearch-js 6.9 branch. - parameters: - - string: - name: branch_specifier - default: refs/heads/6.9 - description: the Git branch specifier to build (<branchName>, <tagName>, - <commitId>, etc.) - triggers: - - github - - timed: '@weekly' From 0ebbd71e9aad03977af79533cf7f84952f7c11a4 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 18 Jul 2019 10:33:11 +0200 Subject: [PATCH 71/84] Improve authentication handling (#908) --- docs/authentication.asciidoc | 85 +++++--- docs/configuration.asciidoc | 26 ++- index.d.ts | 4 +- index.js | 52 ++++- lib/Connection.d.ts | 2 + lib/Connection.js | 38 +++- lib/ConnectionPool.d.ts | 16 ++ lib/ConnectionPool.js | 19 +- test/types/index.ts | 20 ++ test/unit/client.test.js | 347 ++++++++++++++++++++++++++---- test/unit/connection-pool.test.js | 24 +-- test/unit/connection.test.js | 49 ++++- 12 files changed, 571 insertions(+), 111 deletions(-) diff --git a/docs/authentication.asciidoc b/docs/authentication.asciidoc index bd6a0fa30..3fa7e9641 100644 --- a/docs/authentication.asciidoc +++ b/docs/authentication.asciidoc @@ -3,68 +3,105 @@ This document contains code snippets to show you how to connect to various Elasticsearch providers. -=== Basic Auth -You can provide your credentials in the node(s) URL. +=== Elastic Cloud + +If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers a easy way to connect to it via the `cloud` option. + +You must pass the Cloud ID that you can find in the cloud console, then your username and password inside the `auth` option. + +NOTE: When connecting to Elastic Cloud, the client will automatically enable both request and response compression by default, since it yields significant throughput improvements. + +Moreover, the client will also set the ssl option `secureProtocol` to `TLSv1_2_method` unless specified otherwise. +You can still override this option by configuring them. + +IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are behind a load balancer, Elastic Cloud will take care of everything for you. [source,js] ---- const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: 'https://username:password@localhost:9200' + cloud: { + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + }, + auth: { + username: 'elastic', + password: 'changeme' + } }) ---- -Or you can use the full node declaration. +=== Basic authentication + +You can provide your credentials by passing the `username` and `password` parameters via the `auth` option. [source,js] ---- -const { URL } = require('url') const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: { - url: new URL('https://username:password@localhost:9200'), - id: 'node-1', - ... + node: 'https://localhost:9200', + auth: { + username: 'elastic', + password: 'changeme' } }) ---- -=== SSL configuration +Otherwise, you can provide your credentials in the node(s) URL. -Without any additional configuration you can specify `https://` node urls, but the certificates used to sign these requests will not verified (`rejectUnauthorized: false`). To turn on certificate verification you must specify an `ssl` object either in the top level config or in each host config object and set `rejectUnauthorized: true`. The ssl config object can contain many of the same configuration options that https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[tls.connect()] accepts. +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ + node: 'https://username:password@localhost:9200' +}) +---- + +=== ApiKey authentication + +You can use the https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[ApiKey] authentication by passing the `apiKey` parameter via the `auth` option. + +The `apiKey` parameter can be either a base64 encoded string or an object with the values that you can obtain from the https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[create api key endpoint]. [source,js] ---- const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: 'http://username:password@localhost:9200', - ssl: { - ca: fs.readFileSync('./cacert.pem'), - rejectUnauthorized: true + node: 'https://localhost:9200', + auth: { + apiKey: 'base64EncodedKey' } }) ---- -=== Elastic Cloud +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ + node: 'https://localhost:9200', + auth: { + apiKey: { + id: 'foo', + api_key: 'bar' + } + } +}) +---- -If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers a easy way to connect to it via the `cloud` option. + -You must pass the Cloud ID that you can find in the cloud console, then your username and password. -NOTE: When connecting to Elastic Cloud, the client will automatically enable both request and response compression by default, since it yields significant throughput improvements. + -Moreover, the client will also set the ssl option `secureProtocol` to `TLSv1_2_method` unless specified otherwise. -You can still override this option by configuring them. +=== SSL configuration -IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are behind a load balancer, Elastic Cloud will take care of everything for you. +Without any additional configuration you can specify `https://` node urls, but the certificates used to sign these requests will not verified (`rejectUnauthorized: false`). To turn on certificate verification you must specify an `ssl` object either in the top level config or in each host config object and set `rejectUnauthorized: true`. The ssl config object can contain many of the same configuration options that https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[tls.connect()] accepts. [source,js] ---- const { Client } = require('@elastic/elasticsearch') const client = new Client({ - cloud: { - id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + node: 'http://localhost:9200', + auth: { username: 'elastic', password: 'changeme' + }, + ssl: { + ca: fs.readFileSync('./cacert.pem'), + rejectUnauthorized: true } }) ---- \ No newline at end of file diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index cab52c193..c32575c45 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -43,6 +43,28 @@ node: { } ---- +|`auth` +a|Your authentication data. You can use both Basic authentication and https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[ApiKey]. + +See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication] for more details. + +_Default:_ `null` + +Basic authentication: +[source,js] +---- +auth: { + username: 'elastic', + password: 'changeme' +} +---- +https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[ApiKey] authentication: +[source,js] +---- +auth: { + apiKey: 'base64EncodedKey' +} +---- + + |`maxRetries` |`number` - Max number of retries for each request. + _Default:_ `3` @@ -163,7 +185,9 @@ _Cloud configuration example:_ ---- const client = new Client({ cloud: { - id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==' + }, + auth: { username: 'elastic', password: 'changeme' } diff --git a/index.d.ts b/index.d.ts index 84acfeaf8..caee77c8e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -33,7 +33,7 @@ import Transport, { } from './lib/Transport'; import { URL } from 'url'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; -import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool'; +import ConnectionPool, { ResurrectEvent, BasicAuth, ApiKeyAuth } from './lib/ConnectionPool'; import Serializer from './lib/Serializer'; import * as RequestParams from './api/requestParams'; import * as errors from './lib/errors'; @@ -111,8 +111,10 @@ interface ClientOptions { headers?: anyObject; generateRequestId?: generateRequestIdFn; name?: string; + auth?: BasicAuth | ApiKeyAuth; cloud?: { id: string; + // TODO: remove username and password here in 8 username: string; password: string; } diff --git a/index.js b/index.js index 7f5b3c1c3..742b50c9e 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,7 @@ 'use strict' const { EventEmitter } = require('events') +const { URL } = require('url') const debug = require('debug')('elasticsearch') const Transport = require('./lib/Transport') const Connection = require('./lib/Connection') @@ -43,7 +44,12 @@ class Client extends EventEmitter { // the url is a string divided by two '$', the first is the cloud url // the second the elasticsearch instance, the third the kibana instance const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$') - opts.node = `https://${username}:${password}@${cloudUrls[1]}.${cloudUrls[0]}` + + // TODO: remove username and password here in 8 + if (username && password) { + opts.auth = Object.assign({}, opts.auth, { username, password }) + } + opts.node = `https://${cloudUrls[1]}.${cloudUrls[0]}` // Cloud has better performances with compression enabled // see https://github.com/elastic/elasticsearch-py/pull/704. @@ -61,6 +67,11 @@ class Client extends EventEmitter { throw new ConfigurationError('Missing node(s) option') } + const checkAuth = getAuth(opts.node || opts.nodes) + if (checkAuth && checkAuth.username && checkAuth.password) { + opts.auth = Object.assign({}, opts.auth, { username: checkAuth.username, password: checkAuth.password }) + } + const options = Object.assign({}, { Connection, ConnectionPool, @@ -82,7 +93,8 @@ class Client extends EventEmitter { nodeFilter: null, nodeSelector: 'round-robin', generateRequestId: null, - name: 'elasticsearch-js' + name: 'elasticsearch-js', + auth: null }, opts) this[kInitialOptions] = options @@ -96,6 +108,7 @@ class Client extends EventEmitter { ssl: options.ssl, agent: options.agent, Connection: options.Connection, + auth: options.auth, emit: this.emit.bind(this), sniffEnabled: options.sniffInterval !== false || options.sniffOnStart !== false || @@ -209,6 +222,41 @@ class Client extends EventEmitter { } } +function getAuth (node) { + if (Array.isArray(node)) { + for (const url of node) { + const auth = getUsernameAndPassword(url) + if (auth.username !== '' && auth.password !== '') { + return auth + } + } + + return null + } + + const auth = getUsernameAndPassword(node) + if (auth.username !== '' && auth.password !== '') { + return auth + } + + return null + + function getUsernameAndPassword (node) { + if (typeof node === 'string') { + const { username, password } = new URL(node) + return { + username: decodeURIComponent(username), + password: decodeURIComponent(password) + } + } else if (node.url instanceof URL) { + return { + username: decodeURIComponent(node.url.username), + password: decodeURIComponent(node.url.password) + } + } + } +} + const events = { RESPONSE: 'response', REQUEST: 'request', diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index f2ab8532a..4d1e4c0b4 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -21,6 +21,7 @@ import { URL } from 'url'; import { inspect, InspectOptions } from 'util'; +import { ApiKeyAuth, BasicAuth } from './ConnectionPool' import * as http from 'http'; import { ConnectionOptions as TlsConnectionOptions } from 'tls'; @@ -34,6 +35,7 @@ interface ConnectionOptions { agent?: AgentOptions | agentFn; status?: string; roles?: any; + auth?: BasicAuth | ApiKeyAuth; } interface RequestOptions extends http.ClientRequestArgs { diff --git a/lib/Connection.js b/lib/Connection.js index 1501d65d7..8a6a97700 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -34,8 +34,7 @@ class Connection { this.url = opts.url this.ssl = opts.ssl || null this.id = opts.id || stripAuth(opts.url.href) - this.headers = opts.headers || null - this.auth = opts.auth || { username: null, password: null } + this.headers = prepareHeaders(opts.headers, opts.auth) this.deadCount = 0 this.resurrectTimeout = 0 @@ -181,7 +180,6 @@ class Connection { buildRequestObject (params) { const url = this.url - const { username, password } = this.auth const request = { protocol: url.protocol, hostname: url.hostname[0] === '[' @@ -196,9 +194,6 @@ class Connection { // https://github.com/elastic/elasticsearch-js/issues/843 port: url.port !== '' ? url.port : undefined, headers: this.headers, - auth: username != null && password != null - ? `${username}:${password}` - : undefined, agent: this.agent } @@ -230,10 +225,15 @@ class Connection { // the logs very hard to read. The user can still // access them with `instance.agent` and `instance.ssl`. [inspect.custom] (depth, options) { + const { + authorization, + ...headers + } = this.headers + return { url: stripAuth(this.url.toString()), id: this.id, - headers: this.headers, + headers, deadCount: this.deadCount, resurrectTimeout: this.resurrectTimeout, _openRequests: this._openRequests, @@ -243,10 +243,15 @@ class Connection { } toJSON () { + const { + authorization, + ...headers + } = this.headers + return { url: stripAuth(this.url.toString()), id: this.id, - headers: this.headers, + headers, deadCount: this.deadCount, resurrectTimeout: this.resurrectTimeout, _openRequests: this._openRequests, @@ -302,4 +307,21 @@ function resolve (host, path) { } } +function prepareHeaders (headers = {}, auth) { + if (auth != null && headers.authorization == null) { + if (auth.username && auth.password) { + headers.authorization = 'Basic ' + Buffer.from(`${auth.username}:${auth.password}`).toString('base64') + } + + if (auth.apiKey) { + if (typeof auth.apiKey === 'object') { + headers.authorization = 'ApiKey ' + Buffer.from(`${auth.apiKey.id}:${auth.apiKey.api_key}`).toString('base64') + } else { + headers.authorization = `ApiKey ${auth.apiKey}` + } + } + } + return headers +} + module.exports = Connection diff --git a/lib/ConnectionPool.d.ts b/lib/ConnectionPool.d.ts index 5b68d7d36..669ec7824 100644 --- a/lib/ConnectionPool.d.ts +++ b/lib/ConnectionPool.d.ts @@ -26,6 +26,7 @@ import { nodeFilterFn, nodeSelectorFn } from './Transport'; interface ConnectionPoolOptions { ssl?: SecureContextOptions; agent?: AgentOptions; + auth: BasicAuth | ApiKeyAuth; pingTimeout?: number; Connection: typeof Connection; resurrectStrategy?: string; @@ -36,6 +37,20 @@ export interface getConnectionOptions { selector?: nodeSelectorFn; } +export interface ApiKeyAuth { + apiKey: + | string + | { + id: string; + api_key: string; + } +} + +export interface BasicAuth { + username: string; + password: string; +} + export interface resurrectOptions { now?: number; requestId: string; @@ -66,6 +81,7 @@ export default class ConnectionPool { resurrectTimeout: number; resurrectTimeoutCutoff: number; pingTimeout: number; + auth: BasicAuth | ApiKeyAuth; Connection: typeof Connection; resurrectStrategy: number; constructor(opts?: ConnectionPoolOptions); diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index 60191d3ba..e467e2b01 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -30,7 +30,7 @@ class ConnectionPool { this.connections = new Map() this.dead = [] this.selector = opts.selector - this._auth = null + this.auth = opts.auth || null this._ssl = opts.ssl this._agent = opts.agent // the resurrect timeout is 60s @@ -217,23 +217,14 @@ class ConnectionPool { if (typeof opts === 'string') { opts = this.urlToHost(opts) } - // if a given node has auth data we store it in the connection pool, - // so if we add new nodes without auth data (after a sniff for example) - // we can add it to them once the connection instance has been created + if (opts.url.username !== '' && opts.url.password !== '') { - this._auth = { + opts.auth = { username: decodeURIComponent(opts.url.username), password: decodeURIComponent(opts.url.password) } - opts.auth = this._auth - } - - if (this._auth != null) { - if (opts.auth == null || (opts.auth.username == null && opts.auth.password == null)) { - opts.auth = this._auth - opts.url.username = this._auth.username - opts.url.password = this._auth.password - } + } else if (this.auth !== null) { + opts.auth = this.auth } if (opts.ssl == null) opts.ssl = this._ssl diff --git a/test/types/index.ts b/test/types/index.ts index fb72ff965..a50932d1c 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -50,6 +50,26 @@ const nodeOpts: NodeOptions = { const client2 = new Client({ node: nodeOpts }) +const clientBasicAuth = new Client({ + node: 'http://localhost:9200', + auth: { username: 'foo', password: 'bar' } +}) + +const clientApiKeyString = new Client({ + node: 'http://localhost:9200', + auth: { apiKey: 'foobar' } +}) + +const clientApiKeyObject = new Client({ + node: 'http://localhost:9200', + auth: { + apiKey: { + id: 'foo', + api_key: 'bar' + } + } +}) + client.on(events.RESPONSE, (err: errors.ElasticsearchClientError | null, request: RequestEvent) => { if (err) console.log(err) const { body, statusCode } = request diff --git a/test/unit/client.test.js b/test/unit/client.test.js index d92f765b6..cac05919f 100644 --- a/test/unit/client.test.js +++ b/test/unit/client.test.js @@ -198,63 +198,293 @@ test('Configure host', t => { t.end() }) -test('Node with auth data in the url', t => { - t.plan(3) +test('Authentication', t => { + t.test('Basic', t => { + t.test('Node with basic auth data in the url', t => { + t.plan(3) - function handler (req, res) { - t.match(req.headers, { - authorization: 'Basic Zm9vOmJhcg==' + function handler (req, res) { + t.match(req.headers, { + authorization: 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://foo:bar@localhost:${port}` + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } - buildServer(handler, ({ port }, server) => { - const client = new Client({ - node: `http://foo:bar@localhost:${port}` + t.test('Node with basic auth data in the url (array of nodes)', t => { + t.plan(3) + + function handler (req, res) { + t.match(req.headers, { + authorization: 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + nodes: [`http://foo:bar@localhost:${port}`] + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - client.info((err, { body }) => { - t.error(err) - t.deepEqual(body, { hello: 'world' }) - server.stop() + t.test('Node with basic auth data in the options', t => { + t.plan(3) + + function handler (req, res) { + t.match(req.headers, { + authorization: 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + username: 'foo', + password: 'bar' + } + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) + + t.test('Custom basic authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'hello' : 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://foo:bar@localhost:${port}` + }) + + client.info({}, { + headers: { + authorization: 'hello' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) + }) + }) + + t.test('Override default basic authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'hello' : 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + username: 'foo', + password: 'bar' + } + }) + + client.info({}, { + headers: { + authorization: 'hello' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) + }) + }) + + t.end() }) -}) -test('Custom authentication per request', t => { - t.plan(6) + t.test('ApiKey', t => { + t.test('Node with ApiKey auth data in the options as string', t => { + t.plan(3) - var first = true - function handler (req, res) { - t.match(req.headers, { - authorization: first ? 'hello' : 'Basic Zm9vOmJhcg==' + function handler (req, res) { + t.match(req.headers, { + authorization: 'ApiKey Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + apiKey: 'Zm9vOmJhcg==' + } + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } - buildServer(handler, ({ port }, server) => { - const client = new Client({ - node: `http://foo:bar@localhost:${port}` + t.test('Node with ApiKey auth data in the options as object', t => { + t.plan(3) + + function handler (req, res) { + t.match(req.headers, { + authorization: 'ApiKey Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + apiKey: { id: 'foo', api_key: 'bar' } + } + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - client.info({}, { - headers: { - authorization: 'hello' + t.test('Custom ApiKey authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'ApiKey Zm9vOmJhcg==' : 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) } - }, (err, { body }) => { - t.error(err) - t.deepEqual(body, { hello: 'world' }) - first = false - client.info((err, { body }) => { - t.error(err) - t.deepEqual(body, { hello: 'world' }) - server.stop() + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://foo:bar@localhost:${port}` + }) + + client.info({}, { + headers: { + authorization: 'ApiKey Zm9vOmJhcg==' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) }) + + t.test('Override default ApiKey authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'hello' : 'ApiKey Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + apiKey: 'Zm9vOmJhcg==' + } + }) + + client.info({}, { + headers: { + authorization: 'hello' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) + }) + }) + + t.end() }) + + t.end() }) test('Custom headers per request', t => { @@ -554,6 +784,45 @@ test('Elastic cloud config', t => { t.match(pool.connections.get('https://abcd.localhost/'), { url: new URL('https://elastic:changeme@abcd.localhost'), id: 'https://abcd.localhost/', + headers: { + authorization: 'Basic ' + Buffer.from('elastic:changeme').toString('base64') + }, + ssl: { secureProtocol: 'TLSv1_2_method' }, + deadCount: 0, + resurrectTimeout: 0, + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }) + + t.strictEqual(client.transport.compression, 'gzip') + t.strictEqual(client.transport.suggestCompression, true) + t.deepEqual(pool._ssl, { secureProtocol: 'TLSv1_2_method' }) + }) + + t.test('Auth as separate option', t => { + t.plan(4) + const client = new Client({ + cloud: { + // 'localhost$abcd$efgh' + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==' + }, + auth: { + username: 'elastic', + password: 'changeme' + } + }) + + const pool = client.connectionPool + t.match(pool.connections.get('https://abcd.localhost/'), { + url: new URL('https://elastic:changeme@abcd.localhost'), + id: 'https://abcd.localhost/', + headers: { + authorization: 'Basic ' + Buffer.from('elastic:changeme').toString('base64') + }, ssl: { secureProtocol: 'TLSv1_2_method' }, deadCount: 0, resurrectTimeout: 0, diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index c2510a2aa..2136d83dc 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -50,25 +50,6 @@ test('API', t => { t.end() }) - t.test('addConnection (should store the auth data)', t => { - const pool = new ConnectionPool({ Connection }) - const href = 'http://localhost:9200/' - pool.addConnection('http://foo:bar@localhost:9200') - - t.ok(pool.connections.get(href) instanceof Connection) - t.strictEqual(pool.connections.get(href).status, Connection.statuses.ALIVE) - t.deepEqual(pool.dead, []) - t.deepEqual(pool._auth, { username: 'foo', password: 'bar' }) - - pool.addConnection('http://localhost:9201') - const conn = pool.connections.get('http://localhost:9201/') - t.strictEqual(conn.url.username, 'foo') - t.strictEqual(conn.url.password, 'bar') - t.strictEqual(conn.auth.username, 'foo') - t.strictEqual(conn.auth.password, 'bar') - t.end() - }) - t.test('addConnection should handle not-friendly url parameters for user and password', t => { const pool = new ConnectionPool({ Connection }) const href = 'http://us"er:p@assword@localhost:9200/' @@ -76,8 +57,9 @@ test('API', t => { const conn = pool.getConnection() t.strictEqual(conn.url.username, 'us%22er') t.strictEqual(conn.url.password, 'p%40assword') - t.strictEqual(conn.auth.username, 'us"er') - t.strictEqual(conn.auth.password, 'p@assword') + t.match(conn.headers, { + authorization: 'Basic ' + Buffer.from('us"er:p@assword').toString('base64') + }) t.end() }) diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index ea9a2503b..9029afdea 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -811,6 +811,53 @@ test('Port handling', t => { t.end() }) +test('Authorization header', t => { + t.test('None', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200') + }) + + t.deepEqual(connection.headers, {}) + + t.end() + }) + + t.test('Basic', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200'), + auth: { username: 'foo', password: 'bar' } + }) + + t.deepEqual(connection.headers, { authorization: 'Basic Zm9vOmJhcg==' }) + + t.end() + }) + + t.test('ApiKey (string)', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200'), + auth: { apiKey: 'Zm9vOmJhcg==' } + }) + + t.deepEqual(connection.headers, { authorization: 'ApiKey Zm9vOmJhcg==' }) + + t.end() + }) + + t.test('ApiKey (object)', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200'), + auth: { apiKey: { id: 'foo', api_key: 'bar' } } + }) + + t.deepEqual(connection.headers, { authorization: 'ApiKey Zm9vOmJhcg==' }) + + t.end() + }) + + t.end() +}) + test('Should not add agent and ssl to the serialized connection', t => { const connection = new Connection({ url: new URL('http://localhost:9200') @@ -818,7 +865,7 @@ test('Should not add agent and ssl to the serialized connection', t => { t.strictEqual( JSON.stringify(connection), - '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":null,"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true,"ml":false}}' + '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":{},"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true,"ml":false}}' ) t.end() From 0e0891902e20a6529f29815832a4e28a5a3a0716 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 18 Jul 2019 10:33:11 +0200 Subject: [PATCH 72/84] Improve authentication handling (#908) --- docs/authentication.asciidoc | 85 +++++--- docs/configuration.asciidoc | 26 ++- index.d.ts | 4 +- index.js | 52 ++++- lib/Connection.d.ts | 2 + lib/Connection.js | 38 +++- lib/ConnectionPool.d.ts | 16 ++ lib/ConnectionPool.js | 19 +- test/types/index.ts | 20 ++ test/unit/client.test.js | 347 ++++++++++++++++++++++++++---- test/unit/connection-pool.test.js | 24 +-- test/unit/connection.test.js | 49 ++++- 12 files changed, 571 insertions(+), 111 deletions(-) diff --git a/docs/authentication.asciidoc b/docs/authentication.asciidoc index bd6a0fa30..3fa7e9641 100644 --- a/docs/authentication.asciidoc +++ b/docs/authentication.asciidoc @@ -3,68 +3,105 @@ This document contains code snippets to show you how to connect to various Elasticsearch providers. -=== Basic Auth -You can provide your credentials in the node(s) URL. +=== Elastic Cloud + +If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers a easy way to connect to it via the `cloud` option. + +You must pass the Cloud ID that you can find in the cloud console, then your username and password inside the `auth` option. + +NOTE: When connecting to Elastic Cloud, the client will automatically enable both request and response compression by default, since it yields significant throughput improvements. + +Moreover, the client will also set the ssl option `secureProtocol` to `TLSv1_2_method` unless specified otherwise. +You can still override this option by configuring them. + +IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are behind a load balancer, Elastic Cloud will take care of everything for you. [source,js] ---- const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: 'https://username:password@localhost:9200' + cloud: { + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + }, + auth: { + username: 'elastic', + password: 'changeme' + } }) ---- -Or you can use the full node declaration. +=== Basic authentication + +You can provide your credentials by passing the `username` and `password` parameters via the `auth` option. [source,js] ---- -const { URL } = require('url') const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: { - url: new URL('https://username:password@localhost:9200'), - id: 'node-1', - ... + node: 'https://localhost:9200', + auth: { + username: 'elastic', + password: 'changeme' } }) ---- -=== SSL configuration +Otherwise, you can provide your credentials in the node(s) URL. -Without any additional configuration you can specify `https://` node urls, but the certificates used to sign these requests will not verified (`rejectUnauthorized: false`). To turn on certificate verification you must specify an `ssl` object either in the top level config or in each host config object and set `rejectUnauthorized: true`. The ssl config object can contain many of the same configuration options that https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[tls.connect()] accepts. +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ + node: 'https://username:password@localhost:9200' +}) +---- + +=== ApiKey authentication + +You can use the https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[ApiKey] authentication by passing the `apiKey` parameter via the `auth` option. + +The `apiKey` parameter can be either a base64 encoded string or an object with the values that you can obtain from the https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[create api key endpoint]. [source,js] ---- const { Client } = require('@elastic/elasticsearch') const client = new Client({ - node: 'http://username:password@localhost:9200', - ssl: { - ca: fs.readFileSync('./cacert.pem'), - rejectUnauthorized: true + node: 'https://localhost:9200', + auth: { + apiKey: 'base64EncodedKey' } }) ---- -=== Elastic Cloud +[source,js] +---- +const { Client } = require('@elastic/elasticsearch') +const client = new Client({ + node: 'https://localhost:9200', + auth: { + apiKey: { + id: 'foo', + api_key: 'bar' + } + } +}) +---- -If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers a easy way to connect to it via the `cloud` option. + -You must pass the Cloud ID that you can find in the cloud console, then your username and password. -NOTE: When connecting to Elastic Cloud, the client will automatically enable both request and response compression by default, since it yields significant throughput improvements. + -Moreover, the client will also set the ssl option `secureProtocol` to `TLSv1_2_method` unless specified otherwise. -You can still override this option by configuring them. +=== SSL configuration -IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are behind a load balancer, Elastic Cloud will take care of everything for you. +Without any additional configuration you can specify `https://` node urls, but the certificates used to sign these requests will not verified (`rejectUnauthorized: false`). To turn on certificate verification you must specify an `ssl` object either in the top level config or in each host config object and set `rejectUnauthorized: true`. The ssl config object can contain many of the same configuration options that https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[tls.connect()] accepts. [source,js] ---- const { Client } = require('@elastic/elasticsearch') const client = new Client({ - cloud: { - id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + node: 'http://localhost:9200', + auth: { username: 'elastic', password: 'changeme' + }, + ssl: { + ca: fs.readFileSync('./cacert.pem'), + rejectUnauthorized: true } }) ---- \ No newline at end of file diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index cab52c193..c32575c45 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -43,6 +43,28 @@ node: { } ---- +|`auth` +a|Your authentication data. You can use both Basic authentication and https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[ApiKey]. + +See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication] for more details. + +_Default:_ `null` + +Basic authentication: +[source,js] +---- +auth: { + username: 'elastic', + password: 'changeme' +} +---- +https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[ApiKey] authentication: +[source,js] +---- +auth: { + apiKey: 'base64EncodedKey' +} +---- + + |`maxRetries` |`number` - Max number of retries for each request. + _Default:_ `3` @@ -163,7 +185,9 @@ _Cloud configuration example:_ ---- const client = new Client({ cloud: { - id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==' + }, + auth: { username: 'elastic', password: 'changeme' } diff --git a/index.d.ts b/index.d.ts index 84acfeaf8..caee77c8e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -33,7 +33,7 @@ import Transport, { } from './lib/Transport'; import { URL } from 'url'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; -import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool'; +import ConnectionPool, { ResurrectEvent, BasicAuth, ApiKeyAuth } from './lib/ConnectionPool'; import Serializer from './lib/Serializer'; import * as RequestParams from './api/requestParams'; import * as errors from './lib/errors'; @@ -111,8 +111,10 @@ interface ClientOptions { headers?: anyObject; generateRequestId?: generateRequestIdFn; name?: string; + auth?: BasicAuth | ApiKeyAuth; cloud?: { id: string; + // TODO: remove username and password here in 8 username: string; password: string; } diff --git a/index.js b/index.js index 7f5b3c1c3..742b50c9e 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,7 @@ 'use strict' const { EventEmitter } = require('events') +const { URL } = require('url') const debug = require('debug')('elasticsearch') const Transport = require('./lib/Transport') const Connection = require('./lib/Connection') @@ -43,7 +44,12 @@ class Client extends EventEmitter { // the url is a string divided by two '$', the first is the cloud url // the second the elasticsearch instance, the third the kibana instance const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$') - opts.node = `https://${username}:${password}@${cloudUrls[1]}.${cloudUrls[0]}` + + // TODO: remove username and password here in 8 + if (username && password) { + opts.auth = Object.assign({}, opts.auth, { username, password }) + } + opts.node = `https://${cloudUrls[1]}.${cloudUrls[0]}` // Cloud has better performances with compression enabled // see https://github.com/elastic/elasticsearch-py/pull/704. @@ -61,6 +67,11 @@ class Client extends EventEmitter { throw new ConfigurationError('Missing node(s) option') } + const checkAuth = getAuth(opts.node || opts.nodes) + if (checkAuth && checkAuth.username && checkAuth.password) { + opts.auth = Object.assign({}, opts.auth, { username: checkAuth.username, password: checkAuth.password }) + } + const options = Object.assign({}, { Connection, ConnectionPool, @@ -82,7 +93,8 @@ class Client extends EventEmitter { nodeFilter: null, nodeSelector: 'round-robin', generateRequestId: null, - name: 'elasticsearch-js' + name: 'elasticsearch-js', + auth: null }, opts) this[kInitialOptions] = options @@ -96,6 +108,7 @@ class Client extends EventEmitter { ssl: options.ssl, agent: options.agent, Connection: options.Connection, + auth: options.auth, emit: this.emit.bind(this), sniffEnabled: options.sniffInterval !== false || options.sniffOnStart !== false || @@ -209,6 +222,41 @@ class Client extends EventEmitter { } } +function getAuth (node) { + if (Array.isArray(node)) { + for (const url of node) { + const auth = getUsernameAndPassword(url) + if (auth.username !== '' && auth.password !== '') { + return auth + } + } + + return null + } + + const auth = getUsernameAndPassword(node) + if (auth.username !== '' && auth.password !== '') { + return auth + } + + return null + + function getUsernameAndPassword (node) { + if (typeof node === 'string') { + const { username, password } = new URL(node) + return { + username: decodeURIComponent(username), + password: decodeURIComponent(password) + } + } else if (node.url instanceof URL) { + return { + username: decodeURIComponent(node.url.username), + password: decodeURIComponent(node.url.password) + } + } + } +} + const events = { RESPONSE: 'response', REQUEST: 'request', diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index f2ab8532a..4d1e4c0b4 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -21,6 +21,7 @@ import { URL } from 'url'; import { inspect, InspectOptions } from 'util'; +import { ApiKeyAuth, BasicAuth } from './ConnectionPool' import * as http from 'http'; import { ConnectionOptions as TlsConnectionOptions } from 'tls'; @@ -34,6 +35,7 @@ interface ConnectionOptions { agent?: AgentOptions | agentFn; status?: string; roles?: any; + auth?: BasicAuth | ApiKeyAuth; } interface RequestOptions extends http.ClientRequestArgs { diff --git a/lib/Connection.js b/lib/Connection.js index 1501d65d7..8a6a97700 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -34,8 +34,7 @@ class Connection { this.url = opts.url this.ssl = opts.ssl || null this.id = opts.id || stripAuth(opts.url.href) - this.headers = opts.headers || null - this.auth = opts.auth || { username: null, password: null } + this.headers = prepareHeaders(opts.headers, opts.auth) this.deadCount = 0 this.resurrectTimeout = 0 @@ -181,7 +180,6 @@ class Connection { buildRequestObject (params) { const url = this.url - const { username, password } = this.auth const request = { protocol: url.protocol, hostname: url.hostname[0] === '[' @@ -196,9 +194,6 @@ class Connection { // https://github.com/elastic/elasticsearch-js/issues/843 port: url.port !== '' ? url.port : undefined, headers: this.headers, - auth: username != null && password != null - ? `${username}:${password}` - : undefined, agent: this.agent } @@ -230,10 +225,15 @@ class Connection { // the logs very hard to read. The user can still // access them with `instance.agent` and `instance.ssl`. [inspect.custom] (depth, options) { + const { + authorization, + ...headers + } = this.headers + return { url: stripAuth(this.url.toString()), id: this.id, - headers: this.headers, + headers, deadCount: this.deadCount, resurrectTimeout: this.resurrectTimeout, _openRequests: this._openRequests, @@ -243,10 +243,15 @@ class Connection { } toJSON () { + const { + authorization, + ...headers + } = this.headers + return { url: stripAuth(this.url.toString()), id: this.id, - headers: this.headers, + headers, deadCount: this.deadCount, resurrectTimeout: this.resurrectTimeout, _openRequests: this._openRequests, @@ -302,4 +307,21 @@ function resolve (host, path) { } } +function prepareHeaders (headers = {}, auth) { + if (auth != null && headers.authorization == null) { + if (auth.username && auth.password) { + headers.authorization = 'Basic ' + Buffer.from(`${auth.username}:${auth.password}`).toString('base64') + } + + if (auth.apiKey) { + if (typeof auth.apiKey === 'object') { + headers.authorization = 'ApiKey ' + Buffer.from(`${auth.apiKey.id}:${auth.apiKey.api_key}`).toString('base64') + } else { + headers.authorization = `ApiKey ${auth.apiKey}` + } + } + } + return headers +} + module.exports = Connection diff --git a/lib/ConnectionPool.d.ts b/lib/ConnectionPool.d.ts index 5b68d7d36..669ec7824 100644 --- a/lib/ConnectionPool.d.ts +++ b/lib/ConnectionPool.d.ts @@ -26,6 +26,7 @@ import { nodeFilterFn, nodeSelectorFn } from './Transport'; interface ConnectionPoolOptions { ssl?: SecureContextOptions; agent?: AgentOptions; + auth: BasicAuth | ApiKeyAuth; pingTimeout?: number; Connection: typeof Connection; resurrectStrategy?: string; @@ -36,6 +37,20 @@ export interface getConnectionOptions { selector?: nodeSelectorFn; } +export interface ApiKeyAuth { + apiKey: + | string + | { + id: string; + api_key: string; + } +} + +export interface BasicAuth { + username: string; + password: string; +} + export interface resurrectOptions { now?: number; requestId: string; @@ -66,6 +81,7 @@ export default class ConnectionPool { resurrectTimeout: number; resurrectTimeoutCutoff: number; pingTimeout: number; + auth: BasicAuth | ApiKeyAuth; Connection: typeof Connection; resurrectStrategy: number; constructor(opts?: ConnectionPoolOptions); diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index 60191d3ba..e467e2b01 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -30,7 +30,7 @@ class ConnectionPool { this.connections = new Map() this.dead = [] this.selector = opts.selector - this._auth = null + this.auth = opts.auth || null this._ssl = opts.ssl this._agent = opts.agent // the resurrect timeout is 60s @@ -217,23 +217,14 @@ class ConnectionPool { if (typeof opts === 'string') { opts = this.urlToHost(opts) } - // if a given node has auth data we store it in the connection pool, - // so if we add new nodes without auth data (after a sniff for example) - // we can add it to them once the connection instance has been created + if (opts.url.username !== '' && opts.url.password !== '') { - this._auth = { + opts.auth = { username: decodeURIComponent(opts.url.username), password: decodeURIComponent(opts.url.password) } - opts.auth = this._auth - } - - if (this._auth != null) { - if (opts.auth == null || (opts.auth.username == null && opts.auth.password == null)) { - opts.auth = this._auth - opts.url.username = this._auth.username - opts.url.password = this._auth.password - } + } else if (this.auth !== null) { + opts.auth = this.auth } if (opts.ssl == null) opts.ssl = this._ssl diff --git a/test/types/index.ts b/test/types/index.ts index fb72ff965..a50932d1c 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -50,6 +50,26 @@ const nodeOpts: NodeOptions = { const client2 = new Client({ node: nodeOpts }) +const clientBasicAuth = new Client({ + node: 'http://localhost:9200', + auth: { username: 'foo', password: 'bar' } +}) + +const clientApiKeyString = new Client({ + node: 'http://localhost:9200', + auth: { apiKey: 'foobar' } +}) + +const clientApiKeyObject = new Client({ + node: 'http://localhost:9200', + auth: { + apiKey: { + id: 'foo', + api_key: 'bar' + } + } +}) + client.on(events.RESPONSE, (err: errors.ElasticsearchClientError | null, request: RequestEvent) => { if (err) console.log(err) const { body, statusCode } = request diff --git a/test/unit/client.test.js b/test/unit/client.test.js index d92f765b6..cac05919f 100644 --- a/test/unit/client.test.js +++ b/test/unit/client.test.js @@ -198,63 +198,293 @@ test('Configure host', t => { t.end() }) -test('Node with auth data in the url', t => { - t.plan(3) +test('Authentication', t => { + t.test('Basic', t => { + t.test('Node with basic auth data in the url', t => { + t.plan(3) - function handler (req, res) { - t.match(req.headers, { - authorization: 'Basic Zm9vOmJhcg==' + function handler (req, res) { + t.match(req.headers, { + authorization: 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://foo:bar@localhost:${port}` + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } - buildServer(handler, ({ port }, server) => { - const client = new Client({ - node: `http://foo:bar@localhost:${port}` + t.test('Node with basic auth data in the url (array of nodes)', t => { + t.plan(3) + + function handler (req, res) { + t.match(req.headers, { + authorization: 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + nodes: [`http://foo:bar@localhost:${port}`] + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - client.info((err, { body }) => { - t.error(err) - t.deepEqual(body, { hello: 'world' }) - server.stop() + t.test('Node with basic auth data in the options', t => { + t.plan(3) + + function handler (req, res) { + t.match(req.headers, { + authorization: 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + username: 'foo', + password: 'bar' + } + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) + + t.test('Custom basic authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'hello' : 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://foo:bar@localhost:${port}` + }) + + client.info({}, { + headers: { + authorization: 'hello' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) + }) + }) + + t.test('Override default basic authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'hello' : 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + username: 'foo', + password: 'bar' + } + }) + + client.info({}, { + headers: { + authorization: 'hello' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) + }) + }) + + t.end() }) -}) -test('Custom authentication per request', t => { - t.plan(6) + t.test('ApiKey', t => { + t.test('Node with ApiKey auth data in the options as string', t => { + t.plan(3) - var first = true - function handler (req, res) { - t.match(req.headers, { - authorization: first ? 'hello' : 'Basic Zm9vOmJhcg==' + function handler (req, res) { + t.match(req.headers, { + authorization: 'ApiKey Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + apiKey: 'Zm9vOmJhcg==' + } + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } - buildServer(handler, ({ port }, server) => { - const client = new Client({ - node: `http://foo:bar@localhost:${port}` + t.test('Node with ApiKey auth data in the options as object', t => { + t.plan(3) + + function handler (req, res) { + t.match(req.headers, { + authorization: 'ApiKey Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + apiKey: { id: 'foo', api_key: 'bar' } + } + }) + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) - client.info({}, { - headers: { - authorization: 'hello' + t.test('Custom ApiKey authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'ApiKey Zm9vOmJhcg==' : 'Basic Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) } - }, (err, { body }) => { - t.error(err) - t.deepEqual(body, { hello: 'world' }) - first = false - client.info((err, { body }) => { - t.error(err) - t.deepEqual(body, { hello: 'world' }) - server.stop() + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://foo:bar@localhost:${port}` + }) + + client.info({}, { + headers: { + authorization: 'ApiKey Zm9vOmJhcg==' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) }) }) + + t.test('Override default ApiKey authentication per request', t => { + t.plan(6) + + var first = true + function handler (req, res) { + t.match(req.headers, { + authorization: first ? 'hello' : 'ApiKey Zm9vOmJhcg==' + }) + res.setHeader('Content-Type', 'application/json;utf=8') + res.end(JSON.stringify({ hello: 'world' })) + } + + buildServer(handler, ({ port }, server) => { + const client = new Client({ + node: `http://localhost:${port}`, + auth: { + apiKey: 'Zm9vOmJhcg==' + } + }) + + client.info({}, { + headers: { + authorization: 'hello' + } + }, (err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + first = false + + client.info((err, { body }) => { + t.error(err) + t.deepEqual(body, { hello: 'world' }) + server.stop() + }) + }) + }) + }) + + t.end() }) + + t.end() }) test('Custom headers per request', t => { @@ -554,6 +784,45 @@ test('Elastic cloud config', t => { t.match(pool.connections.get('https://abcd.localhost/'), { url: new URL('https://elastic:changeme@abcd.localhost'), id: 'https://abcd.localhost/', + headers: { + authorization: 'Basic ' + Buffer.from('elastic:changeme').toString('base64') + }, + ssl: { secureProtocol: 'TLSv1_2_method' }, + deadCount: 0, + resurrectTimeout: 0, + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }) + + t.strictEqual(client.transport.compression, 'gzip') + t.strictEqual(client.transport.suggestCompression, true) + t.deepEqual(pool._ssl, { secureProtocol: 'TLSv1_2_method' }) + }) + + t.test('Auth as separate option', t => { + t.plan(4) + const client = new Client({ + cloud: { + // 'localhost$abcd$efgh' + id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==' + }, + auth: { + username: 'elastic', + password: 'changeme' + } + }) + + const pool = client.connectionPool + t.match(pool.connections.get('https://abcd.localhost/'), { + url: new URL('https://elastic:changeme@abcd.localhost'), + id: 'https://abcd.localhost/', + headers: { + authorization: 'Basic ' + Buffer.from('elastic:changeme').toString('base64') + }, ssl: { secureProtocol: 'TLSv1_2_method' }, deadCount: 0, resurrectTimeout: 0, diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index c2510a2aa..2136d83dc 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -50,25 +50,6 @@ test('API', t => { t.end() }) - t.test('addConnection (should store the auth data)', t => { - const pool = new ConnectionPool({ Connection }) - const href = 'http://localhost:9200/' - pool.addConnection('http://foo:bar@localhost:9200') - - t.ok(pool.connections.get(href) instanceof Connection) - t.strictEqual(pool.connections.get(href).status, Connection.statuses.ALIVE) - t.deepEqual(pool.dead, []) - t.deepEqual(pool._auth, { username: 'foo', password: 'bar' }) - - pool.addConnection('http://localhost:9201') - const conn = pool.connections.get('http://localhost:9201/') - t.strictEqual(conn.url.username, 'foo') - t.strictEqual(conn.url.password, 'bar') - t.strictEqual(conn.auth.username, 'foo') - t.strictEqual(conn.auth.password, 'bar') - t.end() - }) - t.test('addConnection should handle not-friendly url parameters for user and password', t => { const pool = new ConnectionPool({ Connection }) const href = 'http://us"er:p@assword@localhost:9200/' @@ -76,8 +57,9 @@ test('API', t => { const conn = pool.getConnection() t.strictEqual(conn.url.username, 'us%22er') t.strictEqual(conn.url.password, 'p%40assword') - t.strictEqual(conn.auth.username, 'us"er') - t.strictEqual(conn.auth.password, 'p@assword') + t.match(conn.headers, { + authorization: 'Basic ' + Buffer.from('us"er:p@assword').toString('base64') + }) t.end() }) diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index ea9a2503b..9029afdea 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -811,6 +811,53 @@ test('Port handling', t => { t.end() }) +test('Authorization header', t => { + t.test('None', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200') + }) + + t.deepEqual(connection.headers, {}) + + t.end() + }) + + t.test('Basic', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200'), + auth: { username: 'foo', password: 'bar' } + }) + + t.deepEqual(connection.headers, { authorization: 'Basic Zm9vOmJhcg==' }) + + t.end() + }) + + t.test('ApiKey (string)', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200'), + auth: { apiKey: 'Zm9vOmJhcg==' } + }) + + t.deepEqual(connection.headers, { authorization: 'ApiKey Zm9vOmJhcg==' }) + + t.end() + }) + + t.test('ApiKey (object)', t => { + const connection = new Connection({ + url: new URL('http://localhost:9200'), + auth: { apiKey: { id: 'foo', api_key: 'bar' } } + }) + + t.deepEqual(connection.headers, { authorization: 'ApiKey Zm9vOmJhcg==' }) + + t.end() + }) + + t.end() +}) + test('Should not add agent and ssl to the serialized connection', t => { const connection = new Connection({ url: new URL('http://localhost:9200') @@ -818,7 +865,7 @@ test('Should not add agent and ssl to the serialized connection', t => { t.strictEqual( JSON.stringify(connection), - '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":null,"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true,"ml":false}}' + '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":{},"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true,"ml":false}}' ) t.end() From e93f94521c2becdf00993d3f74f42cd10594bf35 Mon Sep 17 00:00:00 2001 From: Christopher Blanchard Date: Mon, 22 Jul 2019 10:39:42 +0200 Subject: [PATCH 73/84] fix(Typings): sniffInterval can also be boolean (#914) --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index caee77c8e..154bcb256 100644 --- a/index.d.ts +++ b/index.d.ts @@ -97,7 +97,7 @@ interface ClientOptions { maxRetries?: number; requestTimeout?: number; pingTimeout?: number; - sniffInterval?: number; + sniffInterval?: number | boolean; sniffOnStart?: boolean; sniffEndpoint?: string; sniffOnConnectionFault?: boolean; From 22209d65b6ba9929bf8559d3993c6dd6eb9c2be4 Mon Sep 17 00:00:00 2001 From: Christopher Blanchard Date: Mon, 22 Jul 2019 10:39:42 +0200 Subject: [PATCH 74/84] fix(Typings): sniffInterval can also be boolean (#914) --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index caee77c8e..154bcb256 100644 --- a/index.d.ts +++ b/index.d.ts @@ -97,7 +97,7 @@ interface ClientOptions { maxRetries?: number; requestTimeout?: number; pingTimeout?: number; - sniffInterval?: number; + sniffInterval?: number | boolean; sniffOnStart?: boolean; sniffEndpoint?: string; sniffOnConnectionFault?: boolean; From 35b54bb6733188974026db40cd481cd23c2b62a2 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 22 Jul 2019 10:42:07 +0200 Subject: [PATCH 75/84] Added job configuration for Jenkins pipelines (#911) * Added job configuration for Jenkins pipelines * Added job name --- ...tic+elasticsearch-js+jenkins-pipelines.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml diff --git a/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml b/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml new file mode 100644 index 000000000..9ca82a9b4 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml @@ -0,0 +1,54 @@ +--- +- job: + name: elastic+elasticsearch-js+jenkins-pipelines + display-name: 'elastic / elasticsearch-js # jenkins-pipelines' + description: Testing the elasticsearch-js jenkins-pipelines branch. + project-type: multibranch + logrotate: + daysToKeep: 30 + numToKeep: 100 + number-to-keep: '5' + days-to-keep: '1' + concurrent: true + node: linux + script-path: Jenkinsfile + scm: + - github: + branch-discovery: all + discover-pr-forks-strategy: merge-current + discover-pr-forks-trust: permission + discover-pr-origin: merge-current + discover-tags: true + repo: elasticsearch-js + repo-owner: elastic + credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken + ssh-checkout: + credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba + build-strategies: + - tags: + ignore-tags-older-than: -1 + ignore-tags-newer-than: -1 + - regular-branches: true + - change-request: + ignore-target-only-changes: false + clean: + after: true + before: true + prune: true + shallow-clone: true + depth: 3 + do-not-fetch-tags: true + submodule: + disable: false + recursive: true + parent-credentials: true + timeout: 100 + timeout: '15' + use-author: true + wipe-workspace: 'True' + periodic-folder-trigger: 1d + prune-dead-branches: true + publishers: + - email: + recipients: infra-root+build@elastic.co + From 36a1666cc8e1c3689c9ff6e078597fc3548f4291 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 22 Jul 2019 11:46:59 +0200 Subject: [PATCH 76/84] Updated license header (#915) --- api/api/bulk.js | 21 ++-------- api/api/cat.aliases.js | 21 ++-------- api/api/cat.allocation.js | 21 ++-------- api/api/cat.count.js | 21 ++-------- api/api/cat.fielddata.js | 21 ++-------- api/api/cat.health.js | 21 ++-------- api/api/cat.help.js | 21 ++-------- api/api/cat.indices.js | 21 ++-------- api/api/cat.master.js | 21 ++-------- api/api/cat.nodeattrs.js | 21 ++-------- api/api/cat.nodes.js | 21 ++-------- api/api/cat.pending_tasks.js | 21 ++-------- api/api/cat.plugins.js | 21 ++-------- api/api/cat.recovery.js | 21 ++-------- api/api/cat.repositories.js | 21 ++-------- api/api/cat.segments.js | 21 ++-------- api/api/cat.shards.js | 21 ++-------- api/api/cat.snapshots.js | 21 ++-------- api/api/cat.tasks.js | 21 ++-------- api/api/cat.templates.js | 21 ++-------- api/api/cat.thread_pool.js | 21 ++-------- api/api/ccr.delete_auto_follow_pattern.js | 21 ++-------- api/api/ccr.follow.js | 21 ++-------- api/api/ccr.follow_info.js | 21 ++-------- api/api/ccr.follow_stats.js | 21 ++-------- api/api/ccr.forget_follower.js | 21 ++-------- api/api/ccr.get_auto_follow_pattern.js | 21 ++-------- api/api/ccr.pause_follow.js | 21 ++-------- api/api/ccr.put_auto_follow_pattern.js | 21 ++-------- api/api/ccr.resume_follow.js | 21 ++-------- api/api/ccr.stats.js | 21 ++-------- api/api/ccr.unfollow.js | 21 ++-------- api/api/clear_scroll.js | 21 ++-------- api/api/cluster.allocation_explain.js | 21 ++-------- api/api/cluster.get_settings.js | 21 ++-------- api/api/cluster.health.js | 21 ++-------- api/api/cluster.pending_tasks.js | 21 ++-------- api/api/cluster.put_settings.js | 21 ++-------- api/api/cluster.remote_info.js | 21 ++-------- api/api/cluster.reroute.js | 21 ++-------- api/api/cluster.state.js | 21 ++-------- api/api/cluster.stats.js | 21 ++-------- api/api/count.js | 21 ++-------- api/api/create.js | 21 ++-------- .../data_frame.delete_data_frame_transform.js | 21 ++-------- .../data_frame.get_data_frame_transform.js | 21 ++-------- ...ta_frame.get_data_frame_transform_stats.js | 21 ++-------- ...data_frame.preview_data_frame_transform.js | 21 ++-------- .../data_frame.put_data_frame_transform.js | 21 ++-------- .../data_frame.start_data_frame_transform.js | 21 ++-------- .../data_frame.stop_data_frame_transform.js | 21 ++-------- api/api/delete.js | 21 ++-------- api/api/delete_by_query.js | 21 ++-------- api/api/delete_by_query_rethrottle.js | 21 ++-------- api/api/delete_script.js | 21 ++-------- api/api/exists.js | 21 ++-------- api/api/exists_source.js | 21 ++-------- api/api/explain.js | 21 ++-------- api/api/field_caps.js | 21 ++-------- api/api/get.js | 21 ++-------- api/api/get_script.js | 21 ++-------- api/api/get_source.js | 21 ++-------- api/api/graph.explore.js | 21 ++-------- api/api/ilm.delete_lifecycle.js | 21 ++-------- api/api/ilm.explain_lifecycle.js | 21 ++-------- api/api/ilm.get_lifecycle.js | 21 ++-------- api/api/ilm.get_status.js | 21 ++-------- api/api/ilm.move_to_step.js | 21 ++-------- api/api/ilm.put_lifecycle.js | 21 ++-------- api/api/ilm.remove_policy.js | 21 ++-------- api/api/ilm.retry.js | 21 ++-------- api/api/ilm.start.js | 21 ++-------- api/api/ilm.stop.js | 21 ++-------- api/api/index.js | 21 ++-------- api/api/indices.analyze.js | 21 ++-------- api/api/indices.clear_cache.js | 21 ++-------- api/api/indices.close.js | 21 ++-------- api/api/indices.create.js | 21 ++-------- api/api/indices.delete.js | 21 ++-------- api/api/indices.delete_alias.js | 21 ++-------- api/api/indices.delete_template.js | 21 ++-------- api/api/indices.exists.js | 21 ++-------- api/api/indices.exists_alias.js | 21 ++-------- api/api/indices.exists_template.js | 21 ++-------- api/api/indices.exists_type.js | 21 ++-------- api/api/indices.flush.js | 21 ++-------- api/api/indices.flush_synced.js | 21 ++-------- api/api/indices.forcemerge.js | 21 ++-------- api/api/indices.freeze.js | 21 ++-------- api/api/indices.get.js | 21 ++-------- api/api/indices.get_alias.js | 21 ++-------- api/api/indices.get_field_mapping.js | 21 ++-------- api/api/indices.get_mapping.js | 21 ++-------- api/api/indices.get_settings.js | 21 ++-------- api/api/indices.get_template.js | 21 ++-------- api/api/indices.get_upgrade.js | 21 ++-------- api/api/indices.open.js | 21 ++-------- api/api/indices.put_alias.js | 21 ++-------- api/api/indices.put_mapping.js | 21 ++-------- api/api/indices.put_settings.js | 21 ++-------- api/api/indices.put_template.js | 21 ++-------- api/api/indices.recovery.js | 21 ++-------- api/api/indices.refresh.js | 21 ++-------- api/api/indices.reload_search_analyzers.js | 21 ++-------- api/api/indices.rollover.js | 21 ++-------- api/api/indices.segments.js | 21 ++-------- api/api/indices.shard_stores.js | 21 ++-------- api/api/indices.shrink.js | 21 ++-------- api/api/indices.split.js | 21 ++-------- api/api/indices.stats.js | 21 ++-------- api/api/indices.unfreeze.js | 21 ++-------- api/api/indices.update_aliases.js | 21 ++-------- api/api/indices.upgrade.js | 21 ++-------- api/api/indices.validate_query.js | 21 ++-------- api/api/info.js | 21 ++-------- api/api/ingest.delete_pipeline.js | 21 ++-------- api/api/ingest.get_pipeline.js | 21 ++-------- api/api/ingest.processor_grok.js | 21 ++-------- api/api/ingest.put_pipeline.js | 21 ++-------- api/api/ingest.simulate.js | 21 ++-------- api/api/license.delete.js | 21 ++-------- api/api/license.get.js | 21 ++-------- api/api/license.get_basic_status.js | 21 ++-------- api/api/license.get_trial_status.js | 21 ++-------- api/api/license.post.js | 21 ++-------- api/api/license.post_start_basic.js | 21 ++-------- api/api/license.post_start_trial.js | 21 ++-------- api/api/mget.js | 21 ++-------- api/api/migration.deprecations.js | 21 ++-------- api/api/ml.close_job.js | 21 ++-------- api/api/ml.delete_calendar.js | 21 ++-------- api/api/ml.delete_calendar_event.js | 21 ++-------- api/api/ml.delete_calendar_job.js | 21 ++-------- api/api/ml.delete_data_frame_analytics.js | 21 ++-------- api/api/ml.delete_datafeed.js | 21 ++-------- api/api/ml.delete_expired_data.js | 21 ++-------- api/api/ml.delete_filter.js | 21 ++-------- api/api/ml.delete_forecast.js | 21 ++-------- api/api/ml.delete_job.js | 21 ++-------- api/api/ml.delete_model_snapshot.js | 21 ++-------- api/api/ml.evaluate_data_frame.js | 21 ++-------- api/api/ml.find_file_structure.js | 21 ++-------- api/api/ml.flush_job.js | 21 ++-------- api/api/ml.forecast.js | 21 ++-------- api/api/ml.get_buckets.js | 21 ++-------- api/api/ml.get_calendar_events.js | 21 ++-------- api/api/ml.get_calendars.js | 21 ++-------- api/api/ml.get_categories.js | 21 ++-------- api/api/ml.get_data_frame_analytics.js | 21 ++-------- api/api/ml.get_data_frame_analytics_stats.js | 21 ++-------- api/api/ml.get_datafeed_stats.js | 21 ++-------- api/api/ml.get_datafeeds.js | 21 ++-------- api/api/ml.get_filters.js | 21 ++-------- api/api/ml.get_influencers.js | 21 ++-------- api/api/ml.get_job_stats.js | 21 ++-------- api/api/ml.get_jobs.js | 21 ++-------- api/api/ml.get_model_snapshots.js | 21 ++-------- api/api/ml.get_overall_buckets.js | 21 ++-------- api/api/ml.get_records.js | 21 ++-------- api/api/ml.info.js | 21 ++-------- api/api/ml.open_job.js | 21 ++-------- api/api/ml.post_calendar_events.js | 21 ++-------- api/api/ml.post_data.js | 21 ++-------- api/api/ml.preview_datafeed.js | 21 ++-------- api/api/ml.put_calendar.js | 21 ++-------- api/api/ml.put_calendar_job.js | 21 ++-------- api/api/ml.put_data_frame_analytics.js | 21 ++-------- api/api/ml.put_datafeed.js | 21 ++-------- api/api/ml.put_filter.js | 21 ++-------- api/api/ml.put_job.js | 21 ++-------- api/api/ml.revert_model_snapshot.js | 21 ++-------- api/api/ml.set_upgrade_mode.js | 21 ++-------- api/api/ml.start_data_frame_analytics.js | 21 ++-------- api/api/ml.start_datafeed.js | 21 ++-------- api/api/ml.stop_data_frame_analytics.js | 21 ++-------- api/api/ml.stop_datafeed.js | 21 ++-------- api/api/ml.update_datafeed.js | 21 ++-------- api/api/ml.update_filter.js | 21 ++-------- api/api/ml.update_job.js | 21 ++-------- api/api/ml.update_model_snapshot.js | 21 ++-------- api/api/ml.validate.js | 21 ++-------- api/api/ml.validate_detector.js | 21 ++-------- api/api/monitoring.bulk.js | 21 ++-------- api/api/msearch.js | 21 ++-------- api/api/msearch_template.js | 21 ++-------- api/api/mtermvectors.js | 21 ++-------- api/api/nodes.hot_threads.js | 21 ++-------- api/api/nodes.info.js | 21 ++-------- api/api/nodes.reload_secure_settings.js | 21 ++-------- api/api/nodes.stats.js | 21 ++-------- api/api/nodes.usage.js | 21 ++-------- api/api/ping.js | 21 ++-------- api/api/put_script.js | 21 ++-------- api/api/rank_eval.js | 21 ++-------- api/api/reindex.js | 21 ++-------- api/api/reindex_rethrottle.js | 21 ++-------- api/api/render_search_template.js | 21 ++-------- api/api/rollup.delete_job.js | 21 ++-------- api/api/rollup.get_jobs.js | 21 ++-------- api/api/rollup.get_rollup_caps.js | 21 ++-------- api/api/rollup.get_rollup_index_caps.js | 21 ++-------- api/api/rollup.put_job.js | 21 ++-------- api/api/rollup.rollup_search.js | 21 ++-------- api/api/rollup.start_job.js | 21 ++-------- api/api/rollup.stop_job.js | 21 ++-------- api/api/scripts_painless_execute.js | 21 ++-------- api/api/scroll.js | 21 ++-------- api/api/search.js | 21 ++-------- api/api/search_shards.js | 21 ++-------- api/api/search_template.js | 21 ++-------- api/api/security.authenticate.js | 21 ++-------- api/api/security.change_password.js | 21 ++-------- api/api/security.clear_cached_realms.js | 21 ++-------- api/api/security.clear_cached_roles.js | 21 ++-------- api/api/security.create_api_key.js | 21 ++-------- api/api/security.delete_privileges.js | 21 ++-------- api/api/security.delete_role.js | 21 ++-------- api/api/security.delete_role_mapping.js | 21 ++-------- api/api/security.delete_user.js | 21 ++-------- api/api/security.disable_user.js | 21 ++-------- api/api/security.enable_user.js | 21 ++-------- api/api/security.get_api_key.js | 21 ++-------- api/api/security.get_builtin_privileges.js | 21 ++-------- api/api/security.get_privileges.js | 21 ++-------- api/api/security.get_role.js | 21 ++-------- api/api/security.get_role_mapping.js | 21 ++-------- api/api/security.get_token.js | 21 ++-------- api/api/security.get_user.js | 21 ++-------- api/api/security.get_user_privileges.js | 21 ++-------- api/api/security.has_privileges.js | 21 ++-------- api/api/security.invalidate_api_key.js | 21 ++-------- api/api/security.invalidate_token.js | 21 ++-------- api/api/security.put_privileges.js | 21 ++-------- api/api/security.put_role.js | 21 ++-------- api/api/security.put_role_mapping.js | 21 ++-------- api/api/security.put_user.js | 21 ++-------- api/api/snapshot.create.js | 21 ++-------- api/api/snapshot.create_repository.js | 21 ++-------- api/api/snapshot.delete.js | 21 ++-------- api/api/snapshot.delete_repository.js | 21 ++-------- api/api/snapshot.get.js | 21 ++-------- api/api/snapshot.get_repository.js | 21 ++-------- api/api/snapshot.restore.js | 21 ++-------- api/api/snapshot.status.js | 21 ++-------- api/api/snapshot.verify_repository.js | 21 ++-------- api/api/sql.clear_cursor.js | 21 ++-------- api/api/sql.query.js | 21 ++-------- api/api/sql.translate.js | 21 ++-------- api/api/ssl.certificates.js | 21 ++-------- api/api/tasks.cancel.js | 21 ++-------- api/api/tasks.get.js | 21 ++-------- api/api/tasks.list.js | 21 ++-------- api/api/termvectors.js | 21 ++-------- api/api/update.js | 21 ++-------- api/api/update_by_query.js | 21 ++-------- api/api/update_by_query_rethrottle.js | 21 ++-------- api/api/watcher.ack_watch.js | 21 ++-------- api/api/watcher.activate_watch.js | 21 ++-------- api/api/watcher.deactivate_watch.js | 21 ++-------- api/api/watcher.delete_watch.js | 21 ++-------- api/api/watcher.execute_watch.js | 21 ++-------- api/api/watcher.get_watch.js | 21 ++-------- api/api/watcher.put_watch.js | 21 ++-------- api/api/watcher.start.js | 21 ++-------- api/api/watcher.stats.js | 21 ++-------- api/api/watcher.stop.js | 21 ++-------- api/api/xpack.info.js | 21 ++-------- api/api/xpack.usage.js | 21 ++-------- api/index.js | 21 ++-------- api/requestParams.d.ts | 21 ++-------- index.d.ts | 21 ++-------- index.js | 21 ++-------- lib/Connection.d.ts | 21 ++-------- lib/Connection.js | 21 ++-------- lib/ConnectionPool.d.ts | 21 ++-------- lib/ConnectionPool.js | 21 ++-------- lib/Serializer.d.ts | 21 ++-------- lib/Serializer.js | 21 ++-------- lib/Transport.d.ts | 21 ++-------- lib/Transport.js | 21 ++-------- lib/errors.d.ts | 21 ++-------- lib/errors.js | 21 ++-------- scripts/generate.js | 21 ++-------- scripts/utils/clone-es.js | 21 ++-------- scripts/utils/generateApis.js | 42 +++---------------- scripts/utils/generateDocs.js | 21 ++-------- scripts/utils/generateMain.js | 42 +++---------------- scripts/utils/generateRequestTypes.js | 42 +++---------------- scripts/utils/index.js | 21 ++-------- test/behavior/resurrect.test.js | 21 ++-------- test/behavior/sniff.test.js | 21 ++-------- test/integration/helper.js | 21 ++-------- test/integration/index.js | 21 ++-------- test/integration/test-runner.js | 21 ++-------- test/types/index.ts | 21 ++-------- test/unit/api-async.js | 21 ++-------- test/unit/api.test.js | 21 ++-------- test/unit/child.test.js | 21 ++-------- test/unit/client.test.js | 21 ++-------- test/unit/connection-pool.test.js | 21 ++-------- test/unit/connection.test.js | 21 ++-------- test/unit/errors.test.js | 21 ++-------- test/unit/events.test.js | 21 ++-------- test/unit/selectors.test.js | 21 ++-------- test/unit/serializer.test.js | 21 ++-------- test/unit/transport.test.js | 21 ++-------- test/utils/MockConnection.js | 21 ++-------- test/utils/buildCluster.js | 21 ++-------- test/utils/buildServer.js | 21 ++-------- test/utils/index.js | 21 ++-------- 310 files changed, 939 insertions(+), 5634 deletions(-) diff --git a/api/api/bulk.js b/api/api/bulk.js index 505fe99ec..2b6fb9497 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index c5dd54002..00951c792 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index 0813c9adf..25c3995b3 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.count.js b/api/api/cat.count.js index 79e6ba665..8b5264993 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index 2871e8276..c658fc069 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.health.js b/api/api/cat.health.js index ee9088774..b84fd68d0 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.help.js b/api/api/cat.help.js index 3129b9892..31d10821f 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index b262476a7..a49c38657 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.master.js b/api/api/cat.master.js index 859eaa3a0..71c074274 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index 94b6c5a03..edaa13e91 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index 024a85d9c..22a59ee89 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index 399fa8df0..102fa0458 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index accfcd225..bbef01c8b 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index 1e2673d45..dcfe6cf64 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index a5fccaf72..73735720f 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index 80289fab2..eb4c5110e 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index 8a558a3f6..23c524c3b 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index dd13a1a3b..0c8cc3f4e 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index 7de46c56a..f8ccf8e53 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index 13ab47f23..fd0ea5c0e 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index d1dcde6f1..34e7b8572 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index d9d8dbf8c..5ce4323f2 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index f98f46dab..0295d3c3f 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js index 2599c47eb..deb5342e0 100644 --- a/api/api/ccr.follow_info.js +++ b/api/api/ccr.follow_info.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 6d4b118d7..d448530ce 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index a13fed2f7..727ca2e7c 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 4408c4fc9..59059304d 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 36038853a..892bb5c3e 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index c01ceeeae..dcfd15dde 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index 6a55c779d..53907341d 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index 4297da6c7..af425bef2 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index 50601072b..79fae2f3b 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index f76c58114..ed025087e 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index f7d18de2c..e937b89f9 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index 7bf393d80..3c58bad77 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 12e495377..ec3d44b13 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index c8bdd8ca3..58b7d5063 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index 06a07efa0..bbe424a8c 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 5c3b65f54..b254d8126 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index c7e083bf8..db4b1b0bb 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index b4eaa7995..2a3e724e5 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index f90bdd11f..5025eb888 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/count.js b/api/api/count.js index 3ab8ebadb..b3ce1cfba 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/create.js b/api/api/create.js index c1480fbea..16ea50d19 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 68fb7118d..dd33f4ec8 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index 1d58d4321..4b31b5ce6 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index ad6fac084..5c7b3d7e4 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index c51772d8f..1828a2443 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index 30993de05..ff34e6b23 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index 2bffd5d50..55a0da21f 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index 34d65ae76..6e549481c 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/delete.js b/api/api/delete.js index 8055d48d3..f8f313691 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 997909dea..4d48e525a 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index 6759b1d4a..e97a4f269 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/delete_script.js b/api/api/delete_script.js index 4efd049d2..8af6475be 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/exists.js b/api/api/exists.js index 4ee50bdfa..95ff36acd 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 8d1b4d31a..0ff4e52ee 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/explain.js b/api/api/explain.js index 243b9f248..ffd054db7 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/field_caps.js b/api/api/field_caps.js index d30fbe70b..66d7b86ba 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/get.js b/api/api/get.js index 8f6e6300b..729fbe743 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/get_script.js b/api/api/get_script.js index b02c02455..0430ae374 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/get_source.js b/api/api/get_source.js index 40e21e431..8fb652dcb 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 2f626c42b..5c94eebfa 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index 6ae64f5ae..0c3181937 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index 7317c5af5..34eb2c9e2 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index 05050040c..836c4269c 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index 5cbb2bc12..dba3f2e86 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index 3f699d25d..45a81a2f2 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index 8f875547a..afda60149 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index 0ad388fc0..f498dcbcb 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 30ee6a8ea..053e9e3b0 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index 2dcd08d4b..770fc6d91 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index d22d2491a..381f984dc 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/index.js b/api/api/index.js index c012359b3..91f602917 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index 718a3e094..f24228c8a 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index ee4dc3f9c..0a0fc1106 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.close.js b/api/api/indices.close.js index f5be95a27..cade47315 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.create.js b/api/api/indices.create.js index 1005977d0..44a2a5277 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index 277ecd916..ad713cf77 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index b32076509..588ff0558 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index 2304f0127..7bdac9798 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index 72386351a..4ea6592ea 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index a86badbf2..75ed83d8b 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index e05a64740..26ef8ae6a 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index b7adfa719..2fcfd50c2 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index cb4712260..e8b3b97db 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index 239e07b20..4b47dd478 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index 175d010ae..06a54aa61 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index b5e239f45..14b06f576 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get.js b/api/api/indices.get.js index 4aa5f5bae..5391ec0ab 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index e462915ae..b54ba2bdd 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 1c2df81ef..639808cca 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index a6b004ee4..2e444b87a 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index 8d876e932..632298010 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index 31e49a339..3d107ed29 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index 61f9bc4dd..6428123ca 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.open.js b/api/api/indices.open.js index 7a77de7dd..f99ab3fb2 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index d38dd6d83..298159370 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 561274e12..a1b2f5e51 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index 82984834d..f6ae5ef8f 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index 12c08451f..e97c52429 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index f373a3236..f4349cf70 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index 7f11d2faa..22b785ad0 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.reload_search_analyzers.js b/api/api/indices.reload_search_analyzers.js index c4d36be6a..3e8e75417 100644 --- a/api/api/indices.reload_search_analyzers.js +++ b/api/api/indices.reload_search_analyzers.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index bb5e45ebe..3a5a32b2d 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index aabd9e7df..0cc86e011 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index dccc29561..69614b170 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index b3e42dcbe..43a407b96 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.split.js b/api/api/indices.split.js index bbf9c25e9..f84325006 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index 581dd8815..db072d28b 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index 6004938fa..9b2c5c084 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index 69836c820..50176a135 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index 72cba50ca..0981f9834 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 4615cd2eb..82ab4d804 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/info.js b/api/api/info.js index b43a6c1d3..d6c37f28e 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index a03e89b05..4ab191757 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index ce094a2c4..01c251058 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index 697356aa9..7bfca5015 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index f20822d7d..b04278d42 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index 7a1374d31..aa55a4a50 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.delete.js b/api/api/license.delete.js index cce9d75e5..6f65c2994 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.get.js b/api/api/license.get.js index ae139fffd..ffbb55f01 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index ec41252bf..83fd3643f 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index af6b35917..16541a174 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.post.js b/api/api/license.post.js index 0c1ac7d07..51980ac92 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index 5fa1373fb..176bbeafd 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index d68c00f90..70c1a7640 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/mget.js b/api/api/mget.js index b32742a97..3be4268ce 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index e074c1bdb..04e483dff 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.close_job.js b/api/api/ml.close_job.js index 361d14971..b6c66f136 100644 --- a/api/api/ml.close_job.js +++ b/api/api/ml.close_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js index 71f7505f8..9c832ecfe 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/ml.delete_calendar.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js index cd4d751d3..6ab551143 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/ml.delete_calendar_event.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js index 19823d1af..9ace778c7 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/ml.delete_calendar_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_data_frame_analytics.js b/api/api/ml.delete_data_frame_analytics.js index f1f9c10bb..397b1feb8 100644 --- a/api/api/ml.delete_data_frame_analytics.js +++ b/api/api/ml.delete_data_frame_analytics.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js index e245dbbb7..c1a3383f9 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/ml.delete_datafeed.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js index c2c5edca7..12d863847 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/ml.delete_expired_data.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js index 46ae221ab..ae9f8a64a 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/ml.delete_filter.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js index 1b6616590..7c34b090d 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/ml.delete_forecast.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js index dae7db48c..49b1d846d 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/ml.delete_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js index 6f5cb1c43..77b8db921 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/ml.delete_model_snapshot.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.evaluate_data_frame.js b/api/api/ml.evaluate_data_frame.js index 861a649c0..f8ed9923e 100644 --- a/api/api/ml.evaluate_data_frame.js +++ b/api/api/ml.evaluate_data_frame.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index 6371e36a6..ba78444f7 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js index 670aa49a5..9ffc26acb 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/ml.flush_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js index ce19e9e65..e46953043 100644 --- a/api/api/ml.forecast.js +++ b/api/api/ml.forecast.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js index 4e8a3e68d..825e1042a 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/ml.get_buckets.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js index 45752948d..0462538d4 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/ml.get_calendar_events.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 549f5530f..006cec7d0 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js index 381ebb54c..e584312a8 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/ml.get_categories.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_data_frame_analytics.js b/api/api/ml.get_data_frame_analytics.js index 809a46682..fbd8ed979 100644 --- a/api/api/ml.get_data_frame_analytics.js +++ b/api/api/ml.get_data_frame_analytics.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_data_frame_analytics_stats.js b/api/api/ml.get_data_frame_analytics_stats.js index a926eedb7..957dcb17e 100644 --- a/api/api/ml.get_data_frame_analytics_stats.js +++ b/api/api/ml.get_data_frame_analytics_stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js index 4f042ce05..a8324ef92 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/ml.get_datafeed_stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js index 709418c6a..51448fdc6 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/ml.get_datafeeds.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js index bac797feb..baa005d85 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/ml.get_filters.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js index e128965d1..93dc49f65 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/ml.get_influencers.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js index af2096023..6c268e571 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/ml.get_job_stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js index a61691dff..6586ee72d 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/ml.get_jobs.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js index efc1b770c..ed05a2bf3 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/ml.get_model_snapshots.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js index 03798dbe4..bf9649e66 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/ml.get_overall_buckets.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js index 00cdbf7ec..5862b57ec 100644 --- a/api/api/ml.get_records.js +++ b/api/api/ml.get_records.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.info.js b/api/api/ml.info.js index f21bbc95d..9140a95ee 100644 --- a/api/api/ml.info.js +++ b/api/api/ml.info.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js index a5bb89244..94130ce56 100644 --- a/api/api/ml.open_job.js +++ b/api/api/ml.open_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js index 17112d594..f9eb3bd60 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/ml.post_calendar_events.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js index 54d5dba4d..7cd6f9096 100644 --- a/api/api/ml.post_data.js +++ b/api/api/ml.post_data.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js index e4e64c0f6..2e7fc065a 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/ml.preview_datafeed.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js index f3bf2a1a6..2772965cb 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/ml.put_calendar.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js index 87fecf728..3d7aa4aff 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/ml.put_calendar_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.put_data_frame_analytics.js b/api/api/ml.put_data_frame_analytics.js index f18e7912e..a924cc0a6 100644 --- a/api/api/ml.put_data_frame_analytics.js +++ b/api/api/ml.put_data_frame_analytics.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js index 14745042c..09592689e 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/ml.put_datafeed.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js index 3ce82f6b8..3aae67458 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/ml.put_filter.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js index 45ce0d481..6e0933e8b 100644 --- a/api/api/ml.put_job.js +++ b/api/api/ml.put_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js index 9b9f7b3d4..a9f0e7191 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/ml.revert_model_snapshot.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js index cae1b7cbf..6d893be48 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/ml.set_upgrade_mode.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.start_data_frame_analytics.js b/api/api/ml.start_data_frame_analytics.js index df5ff817f..e91d121b5 100644 --- a/api/api/ml.start_data_frame_analytics.js +++ b/api/api/ml.start_data_frame_analytics.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js index ade441af4..e1b48eef3 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/ml.start_datafeed.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.stop_data_frame_analytics.js b/api/api/ml.stop_data_frame_analytics.js index 212a59b9f..209380504 100644 --- a/api/api/ml.stop_data_frame_analytics.js +++ b/api/api/ml.stop_data_frame_analytics.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js index 61ce3876d..457af0c19 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/ml.stop_datafeed.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js index 492310dfa..35be651fa 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/ml.update_datafeed.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js index 03e03b014..95e5612c4 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/ml.update_filter.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js index d51325d13..ea6e005df 100644 --- a/api/api/ml.update_job.js +++ b/api/api/ml.update_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js index 117cb7fb0..3bf1d821d 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/ml.update_model_snapshot.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js index 3f3ca43f4..9e7040708 100644 --- a/api/api/ml.validate.js +++ b/api/api/ml.validate.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js index 8dcea86d3..d3145633e 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/ml.validate_detector.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 872e48e1d..57da036f0 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/msearch.js b/api/api/msearch.js index ead9e13b5..deebceb40 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 527de8da3..7d97022f6 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index 8462fd231..c6e660e46 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 44e3688f7..fcbc70c94 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index 26e7421ea..aec8bc045 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index 948910a44..50c9ef315 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index 7a8a1db36..7250fc02d 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index 159b09f7c..e9bacd230 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ping.js b/api/api/ping.js index 7aa59fb5e..9c0bd1615 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/put_script.js b/api/api/put_script.js index 9f17d8316..e02c0b6a8 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index 98242a4cd..7512e9cc6 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/reindex.js b/api/api/reindex.js index 812a88bd4..5f50aaed2 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 7f9e0bc67..70a4941ba 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 9ec822538..236807503 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index a6d7b8800..62ccc9168 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index 8bb1f2e71..3cb39179d 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index b0e8d288c..85e25d6f6 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index cde9a275a..3d94ca092 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index b117f198c..3a06b0c20 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 4310e49f9..7a9bf2737 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index bf39647a7..06ac9431c 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index e4b2e1cc2..ec32445a3 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index db99454e1..ec41bdf86 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/scroll.js b/api/api/scroll.js index 3d8e35b2f..7c8ebe097 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/search.js b/api/api/search.js index 885dd59b0..da144c2d7 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/search_shards.js b/api/api/search_shards.js index b819d66b2..96da5907c 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/search_template.js b/api/api/search_template.js index dc9431d05..49aa7df0e 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js index c2f5ea868..25320447a 100644 --- a/api/api/security.authenticate.js +++ b/api/api/security.authenticate.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js index 831f013a7..d42f3bb9e 100644 --- a/api/api/security.change_password.js +++ b/api/api/security.change_password.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js index b5483c8c4..584059c42 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/security.clear_cached_realms.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js index 13eee568b..ac18472a5 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/security.clear_cached_roles.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js index a2e6a2e29..d8172e003 100644 --- a/api/api/security.create_api_key.js +++ b/api/api/security.create_api_key.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.delete_privileges.js b/api/api/security.delete_privileges.js index 72efa3bdd..f9bb5e945 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/security.delete_privileges.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js index 6401406c1..05e9ba4d8 100644 --- a/api/api/security.delete_role.js +++ b/api/api/security.delete_role.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js index b9f69494c..6fd53711e 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/security.delete_role_mapping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js index da25eda5e..7a72e0c42 100644 --- a/api/api/security.delete_user.js +++ b/api/api/security.delete_user.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index c12de072d..47372eabf 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index b59558acb..523915cea 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js index eea2eb066..081fd2479 100644 --- a/api/api/security.get_api_key.js +++ b/api/api/security.get_api_key.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_builtin_privileges.js b/api/api/security.get_builtin_privileges.js index 3a9bbf4d7..3f2990e6f 100644 --- a/api/api/security.get_builtin_privileges.js +++ b/api/api/security.get_builtin_privileges.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index ca19de5cb..ec7aad0fb 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js index f4c757bf6..7a92f6a5f 100644 --- a/api/api/security.get_role.js +++ b/api/api/security.get_role.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js index fc58769f6..b186df43c 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/security.get_role_mapping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js index 1f4c8c761..09669490b 100644 --- a/api/api/security.get_token.js +++ b/api/api/security.get_token.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js index 590661f6b..10328de16 100644 --- a/api/api/security.get_user.js +++ b/api/api/security.get_user.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index dc8e3f803..17f5f8231 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js index cea2e5a13..d3bff79ac 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/security.has_privileges.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js index 16f0bf3f1..b325dec5b 100644 --- a/api/api/security.invalidate_api_key.js +++ b/api/api/security.invalidate_api_key.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.invalidate_token.js b/api/api/security.invalidate_token.js index 262d82ce4..e22f2316f 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/security.invalidate_token.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js index 80cf7976f..c0b38d504 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/security.put_privileges.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js index 62d8dae4d..c416c428a 100644 --- a/api/api/security.put_role.js +++ b/api/api/security.put_role.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index 091d7b477..4514a0936 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js index 7b8b04f54..d27f1dbe0 100644 --- a/api/api/security.put_user.js +++ b/api/api/security.put_user.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index d11ff8931..883a056a7 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index c779a0f07..e02dee9e4 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index a7338d088..f2e88ea18 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index af9c5a287..49e5cb904 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index 86a18d362..cdc1efb2f 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index 3de7b4b7e..7f0235d16 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 5694aa4ec..04434bc42 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index 6a8213b16..69ca8f563 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index fcf6a1caa..16af02dab 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index ab620ca6a..6b62c9856 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 87246c23e..7a81261d2 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index cb5d62754..d923f2a7a 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ssl.certificates.js b/api/api/ssl.certificates.js index 706bf117d..6350064d0 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/ssl.certificates.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 1dbd66ac4..d01fdf729 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index d4e886adb..24bae3bb1 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index e8a69211f..8b204ae7d 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 445d13d85..6f9a91ca8 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/update.js b/api/api/update.js index 6130b7aa4..cdf6ad46b 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 8a7330c4c..3d9aaa74a 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index 59a72a6e5..f0985b0a8 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index 323ba16d7..3f795d9b2 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index 31640579a..53bdb25e5 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index 54501a2f0..3b836e99d 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index 1e7add318..3634dad2b 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 8a7865d2a..6472096de 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index f40151c35..0c11c294d 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index 05ba4edfe..ee4d58753 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 5221faf23..1498bea5b 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index 792a895c1..c9c742ef2 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index 5eea1055c..7122f6669 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index 504e3543d..202bbd3d8 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index e7f3971a3..1fdfec331 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/index.js b/api/index.js index 9ad5a45c8..86752a00f 100644 --- a/api/index.js +++ b/api/index.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index e92877535..d44881883 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information export interface Generic { method?: string; diff --git a/index.d.ts b/index.d.ts index 154bcb256..9610adfc0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information /// diff --git a/index.js b/index.js index 742b50c9e..e3d6dcbdb 100644 --- a/index.js +++ b/index.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index 4d1e4c0b4..9f3e6d9cf 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information /// diff --git a/lib/Connection.js b/lib/Connection.js index 8a6a97700..06a0e87bb 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/lib/ConnectionPool.d.ts b/lib/ConnectionPool.d.ts index 669ec7824..b1e77f0fc 100644 --- a/lib/ConnectionPool.d.ts +++ b/lib/ConnectionPool.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information /// diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js index e467e2b01..c1f2d6720 100644 --- a/lib/ConnectionPool.js +++ b/lib/ConnectionPool.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/lib/Serializer.d.ts b/lib/Serializer.d.ts index bf8453ab3..a5a8f8d27 100644 --- a/lib/Serializer.d.ts +++ b/lib/Serializer.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information export default class Serializer { serialize(object: any): string; diff --git a/lib/Serializer.js b/lib/Serializer.js index 6b96b956e..8bb298a79 100644 --- a/lib/Serializer.js +++ b/lib/Serializer.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 83981cf32..98ab2d43a 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information import ConnectionPool from './ConnectionPool'; import Connection from './Connection'; diff --git a/lib/Transport.js b/lib/Transport.js index 265f006f6..76862b98c 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/lib/errors.d.ts b/lib/errors.d.ts index 68b215725..f9f122ac2 100644 --- a/lib/errors.d.ts +++ b/lib/errors.d.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information import { ApiResponse } from './Transport' diff --git a/lib/errors.js b/lib/errors.js index 3f4fddb39..27abb9794 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/scripts/generate.js b/scripts/generate.js index 79b7e2b17..8246a625a 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/scripts/utils/clone-es.js b/scripts/utils/clone-es.js index 05608eeaa..d412ccc98 100644 --- a/scripts/utils/clone-es.js +++ b/scripts/utils/clone-es.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index bde344e03..8da7b307c 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information /* eslint camelcase: 0 */ @@ -169,24 +154,9 @@ function generate (version, spec, common) { `.trim() // always call trim to avoid newlines const fn = dedent` - /* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ + // Licensed to Elasticsearch B.V under one or more agreements. + // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. + // See the LICENSE file in the project root for more information 'use strict' diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index 837be9ce1..b17fc3b45 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/scripts/utils/generateMain.js b/scripts/utils/generateMain.js index 99d24f9a9..c785385c6 100644 --- a/scripts/utils/generateMain.js +++ b/scripts/utils/generateMain.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information /* eslint-disable no-template-curly-in-string */ @@ -95,24 +80,9 @@ function genFactory (folder) { .replace(/,/g, '') const fn = dedent` - /* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ + // Licensed to Elasticsearch B.V under one or more agreements. + // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. + // See the LICENSE file in the project root for more information 'use strict' diff --git a/scripts/utils/generateRequestTypes.js b/scripts/utils/generateRequestTypes.js index b1e2bc72d..fc46dc205 100644 --- a/scripts/utils/generateRequestTypes.js +++ b/scripts/utils/generateRequestTypes.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' @@ -24,24 +9,9 @@ const deprecatedParameters = require('./patch.json') function generate (version, api) { const release = semver.valid(version) ? semver.major(version) : version - var types = `/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ + var types = `// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information export interface Generic { method?: string; diff --git a/scripts/utils/index.js b/scripts/utils/index.js index 77578cf9a..bdfa4956b 100644 --- a/scripts/utils/index.js +++ b/scripts/utils/index.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/behavior/resurrect.test.js b/test/behavior/resurrect.test.js index 6b1a28cfd..18bb4c164 100644 --- a/test/behavior/resurrect.test.js +++ b/test/behavior/resurrect.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/behavior/sniff.test.js b/test/behavior/sniff.test.js index c3071ead6..9377496b1 100644 --- a/test/behavior/sniff.test.js +++ b/test/behavior/sniff.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/integration/helper.js b/test/integration/helper.js index 0cfb8eba3..b8b0a7dfa 100644 --- a/test/integration/helper.js +++ b/test/integration/helper.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/integration/index.js b/test/integration/index.js index 2280de5ef..04249196d 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js index fecb93635..fa0b8130e 100644 --- a/test/integration/test-runner.js +++ b/test/integration/test-runner.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/types/index.ts b/test/types/index.ts index a50932d1c..81d79dc6f 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/api-async.js b/test/unit/api-async.js index 437c00abf..1821836a2 100644 --- a/test/unit/api-async.js +++ b/test/unit/api-async.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/api.test.js b/test/unit/api.test.js index 3a0192cd8..f24906981 100644 --- a/test/unit/api.test.js +++ b/test/unit/api.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/child.test.js b/test/unit/child.test.js index 110a7e866..e6a2b91ea 100644 --- a/test/unit/child.test.js +++ b/test/unit/child.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/client.test.js b/test/unit/client.test.js index cac05919f..2c7bcc683 100644 --- a/test/unit/client.test.js +++ b/test/unit/client.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index 2136d83dc..25bb6deec 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 9029afdea..385dce8ca 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/errors.test.js b/test/unit/errors.test.js index 0e8c2d7c0..5c7001e70 100644 --- a/test/unit/errors.test.js +++ b/test/unit/errors.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/events.test.js b/test/unit/events.test.js index 486526cfc..9562e231d 100644 --- a/test/unit/events.test.js +++ b/test/unit/events.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/selectors.test.js b/test/unit/selectors.test.js index 8985f90fe..2cfd1687f 100644 --- a/test/unit/selectors.test.js +++ b/test/unit/selectors.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/serializer.test.js b/test/unit/serializer.test.js index cce887e7a..329762785 100644 --- a/test/unit/serializer.test.js +++ b/test/unit/serializer.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/unit/transport.test.js b/test/unit/transport.test.js index 867483863..03adcce72 100644 --- a/test/unit/transport.test.js +++ b/test/unit/transport.test.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/utils/MockConnection.js b/test/utils/MockConnection.js index 3b41567b1..770ce79cc 100644 --- a/test/utils/MockConnection.js +++ b/test/utils/MockConnection.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/utils/buildCluster.js b/test/utils/buildCluster.js index 25614f5ef..dbbaf04ab 100644 --- a/test/utils/buildCluster.js +++ b/test/utils/buildCluster.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/utils/buildServer.js b/test/utils/buildServer.js index 28f7509be..97c7cab58 100644 --- a/test/utils/buildServer.js +++ b/test/utils/buildServer.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/test/utils/index.js b/test/utils/index.js index e36ea2290..74b6102e0 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' From 6eeb3aeffa18a9ecc80ad20cf850f72c35e46336 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 11:58:14 +0200 Subject: [PATCH 77/84] API generation --- api/api/bulk.js | 4 - api/api/ccr.forget_follower.js | 21 -- api/api/clear_scroll.js | 2 +- api/api/count.js | 10 +- .../data_frame.delete_data_frame_transform.js | 21 -- .../data_frame.get_data_frame_transform.js | 21 -- ...ta_frame.get_data_frame_transform_stats.js | 21 -- ...data_frame.preview_data_frame_transform.js | 21 -- .../data_frame.put_data_frame_transform.js | 21 -- .../data_frame.start_data_frame_transform.js | 21 -- .../data_frame.stop_data_frame_transform.js | 21 -- api/api/delete_by_query.js | 27 +-- api/api/exists.js | 4 - api/api/exists_source.js | 4 - api/api/explain.js | 4 - api/api/get.js | 12 - api/api/get_source.js | 4 - api/api/graph.explore.js | 21 +- api/api/indices.flush_synced.js | 2 +- api/api/indices.reload_search_analyzers.js | 21 +- api/api/indices.shrink.js | 3 + api/api/indices.split.js | 3 + api/api/license.delete.js | 21 +- api/api/license.get.js | 21 +- api/api/license.get_basic_status.js | 21 +- api/api/license.get_trial_status.js | 21 +- api/api/license.post.js | 21 +- api/api/license.post_start_basic.js | 21 +- api/api/license.post_start_trial.js | 21 +- api/api/mget.js | 4 - api/api/migration.deprecations.js | 21 +- api/api/ml.delete_data_frame_analytics.js | 21 -- api/api/ml.evaluate_data_frame.js | 21 -- api/api/ml.get_data_frame_analytics.js | 21 -- api/api/ml.get_data_frame_analytics_stats.js | 21 -- api/api/ml.put_data_frame_analytics.js | 21 -- api/api/ml.start_data_frame_analytics.js | 21 -- api/api/ml.stop_data_frame_analytics.js | 21 -- api/api/msearch.js | 15 +- api/api/msearch_template.js | 15 +- api/api/mtermvectors.js | 15 +- api/api/rollup.delete_job.js | 21 +- api/api/rollup.get_jobs.js | 21 +- api/api/rollup.get_rollup_caps.js | 21 +- api/api/rollup.get_rollup_index_caps.js | 21 +- api/api/rollup.put_job.js | 21 +- api/api/rollup.rollup_search.js | 21 +- api/api/rollup.start_job.js | 21 +- api/api/rollup.stop_job.js | 21 +- api/api/scroll.js | 2 +- api/api/search.js | 19 +- api/api/search_template.js | 15 +- api/api/security.get_builtin_privileges.js | 21 -- api/api/sql.clear_cursor.js | 21 +- api/api/sql.query.js | 21 +- api/api/sql.translate.js | 21 +- api/api/termvectors.js | 11 +- api/api/update.js | 4 - api/api/update_by_query.js | 27 +-- api/api/watcher.ack_watch.js | 21 +- api/api/watcher.activate_watch.js | 21 +- api/api/watcher.deactivate_watch.js | 21 +- api/api/watcher.delete_watch.js | 21 +- api/api/watcher.execute_watch.js | 21 +- api/api/watcher.get_watch.js | 21 +- api/api/watcher.put_watch.js | 21 +- api/api/watcher.start.js | 21 +- api/api/watcher.stats.js | 21 +- api/api/watcher.stop.js | 21 +- api/requestParams.d.ts | 44 +--- docs/reference.asciidoc | 216 +++--------------- 71 files changed, 234 insertions(+), 1219 deletions(-) diff --git a/api/api/bulk.js b/api/api/bulk.js index 2b6fb9497..20c327980 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -35,9 +35,7 @@ function buildBulk (opts) { 'type', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'pipeline', 'pretty', 'human', @@ -49,9 +47,7 @@ function buildBulk (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index be37869fe..727ca2e7c 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index ed025087e..a060f3539 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -11,7 +11,7 @@ function buildClearScroll (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#search-request-scroll) request + * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll) request * * @param {list} scroll_id - A comma-separated list of scroll IDs to clear * @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter diff --git a/api/api/count.js b/api/api/count.js index b3ce1cfba..a5530bb6f 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -79,6 +79,12 @@ function buildCount (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -100,7 +106,9 @@ function buildCount (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_count' } else { path = '/' + '_count' diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 2594ea615..dd33f4ec8 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index db9f0a84c..4b31b5ce6 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 98656094b..5c7b3d7e4 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index 189556b71..1828a2443 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index ddeab629f..ff34e6b23 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index 289f12da9..55a0da21f 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index f1e96f083..6e549481c 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 484ede52f..ce077845d 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -14,6 +14,7 @@ function buildDeleteByQuery (opts) { * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {enum} default_operator - The default operator for query string query (AND or OR) @@ -30,10 +31,7 @@ function buildDeleteByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. -<<<<<<< HEAD * @param {number} size - Deprecated, please use `max_docs` instead -======= ->>>>>>> master * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return @@ -70,17 +68,12 @@ function buildDeleteByQuery (opts) { 'scroll', 'search_type', 'search_timeout', -<<<<<<< HEAD 'size', -======= ->>>>>>> master 'max_docs', 'sort', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'terminate_after', 'stats', 'version', @@ -109,9 +102,7 @@ function buildDeleteByQuery (opts) { searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', @@ -144,6 +135,12 @@ function buildDeleteByQuery (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -151,11 +148,7 @@ function buildDeleteByQuery (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -169,7 +162,11 @@ function buildDeleteByQuery (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' + } // build request object const request = { diff --git a/api/api/exists.js b/api/api/exists.js index 95ff36acd..4f179077d 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -36,9 +36,7 @@ function buildExists (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -51,9 +49,7 @@ function buildExists (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 0ff4e52ee..cdd66ba60 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -34,9 +34,7 @@ function buildExistsSource (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -48,9 +46,7 @@ function buildExistsSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/explain.js b/api/api/explain.js index ffd054db7..c5cd067f4 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -43,9 +43,7 @@ function buildExplain (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'pretty', 'human', 'error_trace', @@ -58,9 +56,7 @@ function buildExplain (opts) { defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/get.js b/api/api/get.js index 48e7f69fd..48c31e384 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -36,13 +36,7 @@ function buildGet (opts) { 'routing', '_source', '_source_excludes', -<<<<<<< HEAD '_source_includes', -======= - '_source_exclude', - '_source_includes', - '_source_include', ->>>>>>> master 'version', 'version_type', 'pretty', @@ -55,13 +49,7 @@ function buildGet (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', -<<<<<<< HEAD - _sourceIncludes: '_source_includes', -======= - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', ->>>>>>> master versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/get_source.js b/api/api/get_source.js index 8fb652dcb..1b5b8d9ab 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -34,9 +34,7 @@ function buildGetSource (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'version', 'version_type', 'pretty', @@ -48,9 +46,7 @@ function buildGetSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 2f626c42b..5c94eebfa 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index 4b47dd478..1168477c3 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -11,7 +11,7 @@ function buildIndicesFlushSynced (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request + * Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html#synced-flush-api) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string for all indices * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) diff --git a/api/api/indices.reload_search_analyzers.js b/api/api/indices.reload_search_analyzers.js index c4d36be6a..3e8e75417 100644 --- a/api/api/indices.reload_search_analyzers.js +++ b/api/api/indices.reload_search_analyzers.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index 43a407b96..5e13af686 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -15,6 +15,7 @@ function buildIndicesShrink (opts) { * * @param {string} index - The name of the source index to shrink * @param {string} target - The name of the target index to shrink into + * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -22,6 +23,7 @@ function buildIndicesShrink (opts) { */ const acceptedQuerystring = [ + 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -33,6 +35,7 @@ function buildIndicesShrink (opts) { ] const snakeCase = { + copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', diff --git a/api/api/indices.split.js b/api/api/indices.split.js index f84325006..2b3d028b7 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -15,6 +15,7 @@ function buildIndicesSplit (opts) { * * @param {string} index - The name of the source index to split * @param {string} target - The name of the target index to split into + * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -22,6 +23,7 @@ function buildIndicesSplit (opts) { */ const acceptedQuerystring = [ + 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -33,6 +35,7 @@ function buildIndicesSplit (opts) { ] const snakeCase = { + copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', diff --git a/api/api/license.delete.js b/api/api/license.delete.js index cce9d75e5..6f65c2994 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.get.js b/api/api/license.get.js index ae139fffd..ffbb55f01 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index ec41252bf..83fd3643f 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index af6b35917..16541a174 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.post.js b/api/api/license.post.js index 0c1ac7d07..51980ac92 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index 5fa1373fb..176bbeafd 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index d68c00f90..70c1a7640 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/mget.js b/api/api/mget.js index 3be4268ce..1de080c3e 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -34,9 +34,7 @@ function buildMget (opts) { 'routing', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'pretty', 'human', 'error_trace', @@ -47,9 +45,7 @@ function buildMget (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index e074c1bdb..04e483dff 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/ml.delete_data_frame_analytics.js b/api/api/ml.delete_data_frame_analytics.js index 90daa7cc5..397b1feb8 100644 --- a/api/api/ml.delete_data_frame_analytics.js +++ b/api/api/ml.delete_data_frame_analytics.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/ml.evaluate_data_frame.js b/api/api/ml.evaluate_data_frame.js index c4a8c72c2..f8ed9923e 100644 --- a/api/api/ml.evaluate_data_frame.js +++ b/api/api/ml.evaluate_data_frame.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/ml.get_data_frame_analytics.js b/api/api/ml.get_data_frame_analytics.js index 53db7491c..fbd8ed979 100644 --- a/api/api/ml.get_data_frame_analytics.js +++ b/api/api/ml.get_data_frame_analytics.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/ml.get_data_frame_analytics_stats.js b/api/api/ml.get_data_frame_analytics_stats.js index dd2798a49..957dcb17e 100644 --- a/api/api/ml.get_data_frame_analytics_stats.js +++ b/api/api/ml.get_data_frame_analytics_stats.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/ml.put_data_frame_analytics.js b/api/api/ml.put_data_frame_analytics.js index 55e45ea30..a924cc0a6 100644 --- a/api/api/ml.put_data_frame_analytics.js +++ b/api/api/ml.put_data_frame_analytics.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/ml.start_data_frame_analytics.js b/api/api/ml.start_data_frame_analytics.js index 890bee019..e91d121b5 100644 --- a/api/api/ml.start_data_frame_analytics.js +++ b/api/api/ml.start_data_frame_analytics.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/ml.stop_data_frame_analytics.js b/api/api/ml.stop_data_frame_analytics.js index eb75c0cb5..209380504 100644 --- a/api/api/ml.stop_data_frame_analytics.js +++ b/api/api/ml.stop_data_frame_analytics.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/msearch.js b/api/api/msearch.js index 0e202fcda..c9a015278 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -14,6 +14,7 @@ function buildMsearch (opts) { * Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request * * @param {list} index - A comma-separated list of index names to use as default + * @param {list} type - A comma-separated list of document types to use as default * @param {enum} search_type - Search operation type * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response @@ -69,6 +70,12 @@ function buildMsearch (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -76,11 +83,7 @@ function buildMsearch (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -94,7 +97,9 @@ function buildMsearch (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' } else { path = '/' + '_msearch' diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 2bb3b28cb..a6f0ea1ea 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -14,6 +14,7 @@ function buildMsearchTemplate (opts) { * Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request * * @param {list} index - A comma-separated list of index names to use as default + * @param {list} type - A comma-separated list of document types to use as default * @param {enum} search_type - Search operation type * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute @@ -63,6 +64,12 @@ function buildMsearchTemplate (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -70,11 +77,7 @@ function buildMsearchTemplate (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -88,7 +91,9 @@ function buildMsearchTemplate (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template' } else { path = '/' + '_msearch' + '/' + 'template' diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index 909579758..de5664780 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -14,6 +14,7 @@ function buildMtermvectors (opts) { * Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request * * @param {string} index - The index in which the document resides. + * @param {string} type - The type of the document. * @param {list} ids - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body * @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". * @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". @@ -69,6 +70,12 @@ function buildMtermvectors (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -76,11 +83,7 @@ function buildMtermvectors (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -94,7 +97,9 @@ function buildMtermvectors (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors' } else { path = '/' + '_mtermvectors' diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index a6d7b8800..62ccc9168 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index 8bb1f2e71..3cb39179d 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index b0e8d288c..85e25d6f6 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index cde9a275a..3d94ca092 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index b117f198c..3a06b0c20 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 4310e49f9..7a9bf2737 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index bf39647a7..06ac9431c 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index e4b2e1cc2..ec32445a3 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/scroll.js b/api/api/scroll.js index 7c8ebe097..09c35ac49 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -11,7 +11,7 @@ function buildScroll (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** - * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#search-request-scroll) request + * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll) request * * @param {string} scroll_id - The scroll ID * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search diff --git a/api/api/search.js b/api/api/search.js index 4a980f6bc..5393c3a8e 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -14,6 +14,7 @@ function buildSearch (opts) { * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution @@ -83,9 +84,7 @@ function buildSearch (opts) { 'sort', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'terminate_after', 'stats', 'suggest_field', @@ -123,9 +122,7 @@ function buildSearch (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', @@ -157,6 +154,12 @@ function buildSearch (opts) { options = {} } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -164,11 +167,7 @@ function buildSearch (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -182,7 +181,9 @@ function buildSearch (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' } else { path = '/' + '_search' diff --git a/api/api/search_template.js b/api/api/search_template.js index 1eebf7120..951630b55 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -14,6 +14,7 @@ function buildSearchTemplate (opts) { * Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) @@ -82,6 +83,12 @@ function buildSearchTemplate (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -89,11 +96,7 @@ function buildSearchTemplate (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -107,7 +110,9 @@ function buildSearchTemplate (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template' } else { path = '/' + '_search' + '/' + 'template' diff --git a/api/api/security.get_builtin_privileges.js b/api/api/security.get_builtin_privileges.js index b8747d2d2..3f2990e6f 100644 --- a/api/api/security.get_builtin_privileges.js +++ b/api/api/security.get_builtin_privileges.js @@ -1,27 +1,6 @@ -<<<<<<< HEAD -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -======= // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information ->>>>>>> master 'use strict' diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index ab620ca6a..6b62c9856 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 87246c23e..7a81261d2 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index cb5d62754..d923f2a7a 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 28d051872..52e25bdbf 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -14,6 +14,7 @@ function buildTermvectors (opts) { * Perform a [termvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html) request * * @param {string} index - The index in which the document resides. + * @param {string} type - The type of the document. * @param {string} id - The id of the document, when not specified a doc param should be supplied. * @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned. * @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. @@ -81,11 +82,7 @@ function buildTermvectors (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, id, ...querystring } = params -======= - var { method, body, index, id, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -99,8 +96,12 @@ function buildTermvectors (opts) { var path = '' - if ((index) != null && (id) != null) { + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors' + } else if ((index) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id) + } else if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' } else { path = '/' + encodeURIComponent(index) + '/' + '_termvectors' } diff --git a/api/api/update.js b/api/api/update.js index cdf6ad46b..4245a0857 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -34,9 +34,7 @@ function buildUpdate (opts) { 'wait_for_active_shards', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'lang', 'refresh', 'retry_on_conflict', @@ -54,9 +52,7 @@ function buildUpdate (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 46058203a..8e3eb7429 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -14,6 +14,7 @@ function buildUpdateByQuery (opts) { * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {enum} default_operator - The default operator for query string query (AND or OR) @@ -31,10 +32,7 @@ function buildUpdateByQuery (opts) { * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout. -<<<<<<< HEAD * @param {number} size - Deprecated, please use `max_docs` instead -======= ->>>>>>> master * @param {number} max_docs - Maximum number of documents to process (default: all documents) * @param {list} sort - A comma-separated list of : pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return @@ -73,17 +71,12 @@ function buildUpdateByQuery (opts) { 'scroll', 'search_type', 'search_timeout', -<<<<<<< HEAD 'size', -======= ->>>>>>> master 'max_docs', 'sort', '_source', '_source_excludes', - '_source_exclude', '_source_includes', - '_source_include', 'terminate_after', 'stats', 'version', @@ -113,9 +106,7 @@ function buildUpdateByQuery (opts) { searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', - _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', - _sourceInclude: '_source_include', terminateAfter: 'terminate_after', versionType: 'version_type', requestCache: 'request_cache', @@ -145,6 +136,12 @@ function buildUpdateByQuery (opts) { return handleError(err, callback) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + const err = new ConfigurationError('Missing required parameter of the url: index') + return handleError(err, callback) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) @@ -152,11 +149,7 @@ function buildUpdateByQuery (opts) { } var warnings = [] -<<<<<<< HEAD var { method, body, index, type, ...querystring } = params -======= - var { method, body, index, ...querystring } = params ->>>>>>> master querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { @@ -170,7 +163,11 @@ function buildUpdateByQuery (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query' + } else { + path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' + } // build request object const request = { diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index 323ba16d7..3f795d9b2 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index 31640579a..53bdb25e5 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index 54501a2f0..3b836e99d 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index 1e7add318..3634dad2b 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 8a7865d2a..6472096de 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index f40151c35..0c11c294d 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index 05ba4edfe..ee4d58753 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 5221faf23..1498bea5b 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index 792a895c1..c9c742ef2 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index 5eea1055c..7122f6669 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -1,21 +1,6 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information 'use strict' diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index f2e00b33a..b69a442e7 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -15,8 +15,6 @@ export interface Generic { export interface Bulk extends Generic { index?: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; wait_for_active_shards?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; @@ -372,8 +370,7 @@ export interface Delete extends Generic { export interface DeleteByQuery extends Generic { index: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; + type?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; @@ -390,10 +387,7 @@ export interface DeleteByQuery extends Generic { scroll?: string; search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; -<<<<<<< HEAD size?: number; -======= ->>>>>>> master max_docs?: number; sort?: string | string[]; _source?: string | string[]; @@ -428,8 +422,6 @@ export interface Exists extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -446,11 +438,6 @@ export interface ExistsSource extends Generic { id: string; index: string; type?: string; -<<<<<<< HEAD -======= - _source_exclude?: string | string[]; - _source_include?: string | string[]; ->>>>>>> master preference?: string; realtime?: boolean; refresh?: boolean; @@ -466,8 +453,6 @@ export interface Explain extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; analyze_wildcard?: boolean; analyzer?: string; default_operator?: 'AND' | 'OR'; @@ -496,8 +481,6 @@ export interface Get extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -519,11 +502,6 @@ export interface GetSource extends Generic { id: string; index: string; type?: string; -<<<<<<< HEAD -======= - _source_exclude?: string | string[]; - _source_include?: string | string[]; ->>>>>>> master preference?: string; realtime?: boolean; refresh?: boolean; @@ -837,6 +815,7 @@ export interface IndicesShardStores extends Generic { export interface IndicesShrink extends Generic { index: string; target: string; + copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -846,6 +825,7 @@ export interface IndicesShrink extends Generic { export interface IndicesSplit extends Generic { index: string; target: string; + copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -933,8 +913,6 @@ export interface IngestSimulate extends Generic { export interface Mget extends Generic { index?: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -948,6 +926,7 @@ export interface Mget extends Generic { export interface Msearch extends Generic { index?: string | string[]; + type?: string | string[]; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; max_concurrent_searches?: number; typed_keys?: boolean; @@ -960,6 +939,7 @@ export interface Msearch extends Generic { export interface MsearchTemplate extends Generic { index?: string | string[]; + type?: string | string[]; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; typed_keys?: boolean; max_concurrent_searches?: number; @@ -970,6 +950,7 @@ export interface MsearchTemplate extends Generic { export interface Mtermvectors extends Generic { index?: string; + type?: string; ids?: string | string[]; term_statistics?: boolean; field_statistics?: boolean; @@ -1081,8 +1062,7 @@ export interface Scroll extends Generic { export interface Search extends Generic { index?: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; + type?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; ccs_minimize_roundtrips?: boolean; @@ -1140,6 +1120,7 @@ export interface SearchShards extends Generic { export interface SearchTemplate extends Generic { index?: string | string[]; + type?: string | string[]; ignore_unavailable?: boolean; ignore_throttled?: boolean; allow_no_indices?: boolean; @@ -1244,6 +1225,7 @@ export interface TasksList extends Generic { export interface Termvectors extends Generic { index: string; + type?: string; id?: string; term_statistics?: boolean; field_statistics?: boolean; @@ -1263,8 +1245,6 @@ export interface Update extends Generic { id: string; index: string; type?: string; - _source_exclude?: string | string[]; - _source_include?: string | string[]; wait_for_active_shards?: string; _source?: string | string[]; _source_excludes?: string | string[]; @@ -1281,8 +1261,7 @@ export interface Update extends Generic { export interface UpdateByQuery extends Generic { index: string | string[]; - _source_exclude?: string | string[]; - _source_include?: string | string[]; + type?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; @@ -1300,10 +1279,7 @@ export interface UpdateByQuery extends Generic { scroll?: string; search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; search_timeout?: string; -<<<<<<< HEAD size?: number; -======= ->>>>>>> master max_docs?: number; sort?: string | string[]; _source?: string | string[]; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 7c93f2bcd..a16bd64be 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -757,7 +757,7 @@ link:{ref}/cat-thread-pool.html[Reference] ---- client.clearScroll([params] [, options] [, callback]) ---- -link:{ref}/search-request-scroll.html[Reference] +link:{ref}/search-request-body.html#request-body-search-scroll[Reference] [cols=2*] |=== |`scroll_id` or `scrollId` @@ -1154,6 +1154,9 @@ link:{ref}/docs-delete-by-query.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`type` +|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types + |`analyzer` |`string` - The analyzer to use for the query string @@ -1205,12 +1208,9 @@ _Default:_ `open` |`search_timeout` or `searchTimeout` |`string` - Explicit timeout for each search request. Defaults to no timeout. -<<<<<<< HEAD |`size` |`number` - Deprecated, please use `max_docs` instead -======= ->>>>>>> master |`max_docs` or `maxDocs` |`number` - Maximum number of documents to process (default: all documents) @@ -1982,7 +1982,7 @@ _Default:_ `open` ---- client.indices.flushSynced([params] [, options] [, callback]) ---- -link:{ref}/indices-synced-flush.html[Reference] +link:{ref}/indices-flush.html#synced-flush-api[Reference] [cols=2*] |=== |`index` @@ -2567,6 +2567,9 @@ link:{ref}/indices-shrink-index.html[Reference] |`target` |`string` - The name of the target index to shrink into +|`copy_settings` or `copySettings` +|`boolean` - whether or not to copy settings from the source index (defaults to false) + |`timeout` |`string` - Explicit operation timeout @@ -2595,6 +2598,9 @@ link:{ref}/indices-split-index.html[Reference] |`target` |`string` - The name of the target index to split into +|`copy_settings` or `copySettings` +|`boolean` - whether or not to copy settings from the source index (defaults to false) + |`timeout` |`string` - Explicit operation timeout @@ -2909,6 +2915,9 @@ link:{ref}/search-multi-search.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to use as default +|`type` +|`string, string[]` - A comma-separated list of document types to use as default + |`search_type` or `searchType` |`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type @@ -2949,6 +2958,9 @@ link:{ref}/search-multi-search.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to use as default +|`type` +|`string, string[]` - A comma-separated list of document types to use as default + |`search_type` or `searchType` |`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type @@ -2981,6 +2993,9 @@ link:{ref}/docs-multi-termvectors.html[Reference] |`index` |`string` - The index in which the document resides. +|`type` +|`string` - The type of the document. + |`ids` |`string, string[]` - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body @@ -3311,7 +3326,7 @@ link:https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-exec ---- client.scroll([params] [, options] [, callback]) ---- -link:{ref}/search-request-scroll.html[Reference] +link:{ref}/search-request-body.html#request-body-search-scroll[Reference] [cols=2*] |=== |`scroll_id` or `scrollId` @@ -3342,6 +3357,9 @@ link:{ref}/search-search.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`type` +|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types + |`analyzer` |`string` - The analyzer to use for the query string @@ -3524,6 +3542,9 @@ link:{ref}/search-template.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`type` +|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types + |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -3852,6 +3873,9 @@ link:{ref}/docs-termvectors.html[Reference] |`index` |`string` - The index in which the document resides. +|`type` +|`string` - The type of the document. + |`id` |`string` - The id of the document, when not specified a doc param should be supplied. @@ -3963,6 +3987,9 @@ link:{ref}/docs-update-by-query.html[Reference] |`index` |`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`type` +|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types + |`analyzer` |`string` - The analyzer to use for the query string @@ -4017,12 +4044,9 @@ _Default:_ `open` |`search_timeout` or `searchTimeout` |`string` - Explicit timeout for each search request. Defaults to no timeout. -<<<<<<< HEAD |`size` |`number` - Deprecated, please use `max_docs` instead -======= ->>>>>>> master |`max_docs` or `maxDocs` |`number` - Maximum number of documents to process (default: all documents) @@ -4278,15 +4302,6 @@ link:{ref}/get-data-frame-transform.html[Reference] |`from` |`number` - skips a number of transform configs, defaults to 0 -<<<<<<< HEAD - -|`size` -|`number` - specifies a max number of transforms to get, defaults to 100 - -|`allow_no_match` or `allowNoMatch` -|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) - -======= |`size` |`number` - specifies a max number of transforms to get, defaults to 100 @@ -4294,17 +4309,12 @@ link:{ref}/get-data-frame-transform.html[Reference] |`allow_no_match` or `allowNoMatch` |`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) ->>>>>>> master |=== === dataFrame.getDataFrameTransformStats [source,js] ---- client.dataFrame.getDataFrameTransformStats([params] [, options] [, callback]) -<<<<<<< HEAD ----- -link:{ref}/get-data-frame-transform-stats.html[Reference] -======= ---- link:{ref}/get-data-frame-transform-stats.html[Reference] [cols=2*] @@ -4415,164 +4425,6 @@ link:{ref}/graph-explore-api.html[Reference] |=== -=== ilm.deleteLifecycle -[source,js] ----- -client.ilm.deleteLifecycle([params] [, options] [, callback]) ----- -link:{ref}/ilm-delete-lifecycle.html[Reference] ->>>>>>> master -[cols=2*] -|=== -|`transform_id` or `transformId` -|`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms - -|`from` -|`number` - skips a number of transform stats, defaults to 0 - -|`size` -|`number` - specifies a max number of transform stats to get, defaults to 100 - -|`allow_no_match` or `allowNoMatch` -|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) - -|=== - -<<<<<<< HEAD -=== dataFrame.previewDataFrameTransform -[source,js] ----- -client.dataFrame.previewDataFrameTransform([params] [, options] [, callback]) ----- -link:{ref}/preview-data-frame-transform.html[Reference] -[cols=2*] -|=== -|`body` -|`object` - The definition for the data_frame transform to preview - -|=== - -=== dataFrame.putDataFrameTransform -======= -=== ilm.explainLifecycle -[source,js] ----- -client.ilm.explainLifecycle([params] [, options] [, callback]) ----- -link:{ref}/ilm-explain-lifecycle.html[Reference] -[cols=2*] -|=== -|`index` -|`string` - The name of the index to explain - -|=== - -=== ilm.getLifecycle -[source,js] ----- -client.ilm.getLifecycle([params] [, options] [, callback]) ----- -link:{ref}/ilm-get-lifecycle.html[Reference] -[cols=2*] -|=== -|`policy` -|`string` - The name of the index lifecycle policy - -|=== - -=== ilm.getStatus -[source,js] ----- -client.ilm.getStatus([params] [, options] [, callback]) ----- -link:{ref}/ilm-get-status.html[Reference] - - -=== ilm.moveToStep ->>>>>>> master -[source,js] ----- -client.dataFrame.putDataFrameTransform([params] [, options] [, callback]) ----- -<<<<<<< HEAD -link:{ref}/put-data-frame-transform.html[Reference] -======= -link:{ref}/ilm-move-to-step.html[Reference] ->>>>>>> master -[cols=2*] -|=== -|`transform_id` or `transformId` -|`string` - The id of the new transform. - -|`body` -|`object` - The data frame transform definition - -|=== - -<<<<<<< HEAD -=== dataFrame.startDataFrameTransform -[source,js] ----- -client.dataFrame.startDataFrameTransform([params] [, options] [, callback]) ----- -link:{ref}/start-data-frame-transform.html[Reference] -[cols=2*] -|=== -|`transform_id` or `transformId` -|`string` - The id of the transform to start - -|`timeout` -|`string` - Controls the time to wait for the transform to start - -|=== - -=== dataFrame.stopDataFrameTransform -[source,js] ----- -client.dataFrame.stopDataFrameTransform([params] [, options] [, callback]) ----- -link:{ref}/stop-data-frame-transform.html[Reference] -[cols=2*] -|=== -|`transform_id` or `transformId` -|`string` - The id of the transform to stop - -|`wait_for_completion` or `waitForCompletion` -|`boolean` - Whether to wait for the transform to fully stop before returning or not. Default to false - -|`timeout` -|`string` - Controls the time to wait until the transform has stopped. Default to 30 seconds - -|`allow_no_match` or `allowNoMatch` -|`boolean` - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified) - -|=== - -=== graph.explore -[source,js] ----- -client.graph.explore([params] [, options] [, callback]) ----- -link:{ref}/graph-explore-api.html[Reference] -[cols=2*] -|=== -|`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - -|`routing` -|`string` - Specific routing value - -|`timeout` -|`string` - Explicit operation timeout - -|`body` -|`object` - Graph Query DSL - -|=== - === ilm.deleteLifecycle [source,js] ---- @@ -4636,8 +4488,6 @@ link:{ref}/ilm-move-to-step.html[Reference] |=== -======= ->>>>>>> master === ilm.putLifecycle [source,js] ---- From 7149fe98b4456fdcecd70cb2ff9587019b53577a Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 12:16:56 +0200 Subject: [PATCH 78/84] Fix conflict --- docs/index.asciidoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 5caf8c70e..0b6ae63c9 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -1,10 +1,6 @@ = Elasticsearch Node.js client -<<<<<<< HEAD :branch: 7.x -======= -:branch: master ->>>>>>> master include::{asciidoc-dir}/../../shared/attributes.asciidoc[] include::introduction.asciidoc[] From d2f7d736c1aaa6cf82e0571ac5aec7aefc5bb370 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 13:56:58 +0200 Subject: [PATCH 79/84] Fix conflict --- .ci/test-matrix.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index e7d0dae22..cade51d79 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -1,10 +1,6 @@ --- ELASTICSEARCH_VERSION: -<<<<<<< HEAD - 7.3-SNAPSHOT -======= - - 8.0.0-SNAPSHOT ->>>>>>> master NODE_JS_VERSION: - 12 From 77c191ee1a0b5538e8ac43105dc6f1503a610130 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 25 Jul 2019 10:57:47 +0200 Subject: [PATCH 80/84] =?UTF-8?q?Updated=20automatically=20the=20main=20ty?= =?UTF-8?q?pings=20file=20with=20the=20generated=20t=E2=80=A6=20(#919)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updated automatically the main typings file with the generated types * Removed useless log --- .gitignore | 4 ---- index.d.ts | 2 ++ scripts/generate.js | 14 +++++++++----- scripts/utils/generateMain.js | 8 +++++++- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index a5768f2f9..85b6dce46 100644 --- a/.gitignore +++ b/.gitignore @@ -50,10 +50,6 @@ package-lock.json # elasticsearch repo or binary files elasticsearch* -# Generated typings, we don't commit them -# because we should copy them in the main .d.ts file -api/generated.d.ts - test/benchmarks/macro/fixtures/* *-junit.xml diff --git a/index.d.ts b/index.d.ts index 9610adfc0..5d3a05e8f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -113,6 +113,7 @@ declare class Client extends EventEmitter { extend: ClientExtends; child(opts?: ClientOptions): Client; close(callback?: Function): Promise | void; + /* GENERATED */ bulk: ApiMethod cat: { aliases: ApiMethod @@ -612,6 +613,7 @@ declare class Client extends EventEmitter { info: ApiMethod usage: ApiMethod } + /* /GENERATED */ } declare const events: { diff --git a/scripts/generate.js b/scripts/generate.js index 8246a625a..15f6a5497 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -5,7 +5,7 @@ 'use strict' const { join } = require('path') -const { readdirSync, writeFileSync } = require('fs') +const { readdirSync, readFileSync, writeFileSync } = require('fs') const minimist = require('minimist') const semver = require('semver') const ora = require('ora') @@ -32,7 +32,7 @@ function start (opts) { const packageFolder = join(__dirname, '..', 'api') const apiOutputFolder = join(packageFolder, 'api') const mainOutputFile = join(packageFolder, 'index.js') - const typesOutputFile = join(packageFolder, 'generated.d.ts') + const typeDefFile = join(__dirname, '..', 'index.d.ts') const docOutputFile = join(__dirname, '..', 'docs', 'reference.asciidoc') const requestParamsOutputFile = join(packageFolder, 'requestParams.d.ts') const allSpec = [] @@ -64,9 +64,14 @@ function start (opts) { factory, { encoding: 'utf8' } ) + + const oldTypeDefString = readFileSync(typeDefFile, 'utf8') + const start = oldTypeDefString.indexOf('/* GENERATED */') + const end = oldTypeDefString.indexOf('/* /GENERATED */') + const newTypeDefString = oldTypeDefString.slice(0, start + 15) + '\n' + types + '\n ' + oldTypeDefString.slice(end) writeFileSync( - typesOutputFile, - types, + typeDefFile, + newTypeDefString, { encoding: 'utf8' } ) @@ -82,7 +87,6 @@ function start (opts) { ) log.succeed('Done!') - console.log('Remember to copy the generated types into the index.d.ts file') }) }) diff --git a/scripts/utils/generateMain.js b/scripts/utils/generateMain.js index c785385c6..6f9694fa8 100644 --- a/scripts/utils/generateMain.js +++ b/scripts/utils/generateMain.js @@ -73,7 +73,13 @@ function genFactory (folder) { // serialize the type object const typesStr = Object.keys(types) - .map(key => `${key}: ${JSON.stringify(types[key], null, 2)}`) + .map(key => { + const line = ` ${key}: ${JSON.stringify(types[key], null, 4)}` + if (line.slice(-1) === '}') { + return line.slice(0, -1) + ' }' + } + return line + }) .join('\n') // remove useless quotes and commas .replace(/"/g, '') From 5d97b0e408ef718fe70efb78e3ef4729c9401093 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 25 Jul 2019 11:08:18 +0200 Subject: [PATCH 81/84] Better reference code examples (#920) * Updated documentation genertation script to build small code snippets * Updated docs reference * Removed slm doc * Add commas and remove empty objects --- docs/reference.asciidoc | 3343 ++++++++++++++++++++++++--------- scripts/utils/generateDocs.js | 26 +- 2 files changed, 2454 insertions(+), 915 deletions(-) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index a16bd64be..32c83f727 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -4,7 +4,9 @@ //////// This documentation is generated by running: -node scripts/run.js --tag v7.0.0-beta +node scripts/run.js --tag tagName +or +node scripts/run.js --branch branchName //////// @@ -32,9 +34,22 @@ link:{ref}/common-options.html[Reference] |=== === bulk -[source,js] ----- -client.bulk([params] [, options] [, callback]) +[source,ts] +---- +client.bulk({ + index: string, + type: string, + wait_for_active_shards: string, + refresh: 'true' | 'false' | 'wait_for', + routing: string, + timeout: string, + type: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + pipeline: string, + body: object +}) ---- link:{ref}/docs-bulk.html[Reference] [cols=2*] @@ -49,7 +64,7 @@ link:{ref}/docs-bulk.html[Reference] |`string` - Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |`refresh` -|`'true', 'false', 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |`routing` |`string` - Specific routing value @@ -61,13 +76,13 @@ link:{ref}/docs-bulk.html[Reference] |`string` - Default document type for items which don't provide one |`_source` -|`string, string[]` - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request +|`string \| string[]` - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request +|`string \| string[]` - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request |`_source_includes` or `_sourceIncludes` -|`string, string[]` - Default list of fields to extract and return from the _source field, can be overridden on each sub-request +|`string \| string[]` - Default list of fields to extract and return from the _source field, can be overridden on each sub-request |`pipeline` |`string` - The pipeline id to preprocess incoming documents with @@ -78,15 +93,24 @@ link:{ref}/docs-bulk.html[Reference] |=== === cat.aliases -[source,js] ----- -client.cat.aliases([params] [, options] [, callback]) +[source,ts] +---- +client.cat.aliases({ + name: string | string[], + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-alias.html[Reference] [cols=2*] |=== |`name` -|`string, string[]` - A comma-separated list of alias names to return +|`string \| string[]` - A comma-separated list of alias names to return |`format` |`string` - a short version of the Accept header, e.g. json, yaml @@ -98,13 +122,13 @@ link:{ref}/cat-alias.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -112,21 +136,31 @@ link:{ref}/cat-alias.html[Reference] |=== === cat.allocation -[source,js] ----- -client.cat.allocation([params] [, options] [, callback]) +[source,ts] +---- +client.cat.allocation({ + node_id: string | string[], + format: string, + bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-allocation.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`bytes` -|`'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'` - The unit in which to display byte values +|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -135,13 +169,13 @@ link:{ref}/cat-allocation.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -149,15 +183,24 @@ link:{ref}/cat-allocation.html[Reference] |=== === cat.count -[source,js] ----- -client.cat.count([params] [, options] [, callback]) +[source,ts] +---- +client.cat.count({ + index: string | string[], + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-count.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to limit the returned information +|`string \| string[]` - A comma-separated list of index names to limit the returned information |`format` |`string` - a short version of the Accept header, e.g. json, yaml @@ -169,13 +212,13 @@ link:{ref}/cat-count.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -183,21 +226,32 @@ link:{ref}/cat-count.html[Reference] |=== === cat.fielddata -[source,js] ----- -client.cat.fielddata([params] [, options] [, callback]) +[source,ts] +---- +client.cat.fielddata({ + fields: string | string[], + format: string, + bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean, + fields: string | string[] +}) ---- link:{ref}/cat-fielddata.html[Reference] [cols=2*] |=== |`fields` -|`string, string[]` - A comma-separated list of fields to return the fielddata size +|`string \| string[]` - A comma-separated list of fields to return the fielddata size |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`bytes` -|`'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'` - The unit in which to display byte values +|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -206,26 +260,35 @@ link:{ref}/cat-fielddata.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers |`fields` -|`string, string[]` - A comma-separated list of fields to return in the output +|`string \| string[]` - A comma-separated list of fields to return in the output |=== === cat.health -[source,js] ----- -client.cat.health([params] [, options] [, callback]) +[source,ts] +---- +client.cat.health({ + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + ts: boolean, + v: boolean +}) ---- link:{ref}/cat-health.html[Reference] [cols=2*] @@ -240,13 +303,13 @@ link:{ref}/cat-health.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`ts` |`boolean` - Set to false to disable timestamping + @@ -258,9 +321,12 @@ _Default:_ `true` |=== === cat.help -[source,js] +[source,ts] ---- -client.cat.help([params] [, options] [, callback]) +client.cat.help({ + help: boolean, + s: string | string[] +}) ---- link:{ref}/cat.html[Reference] [cols=2*] @@ -269,26 +335,39 @@ link:{ref}/cat.html[Reference] |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |=== === cat.indices -[source,js] ----- -client.cat.indices([params] [, options] [, callback]) +[source,ts] +---- +client.cat.indices({ + index: string | string[], + format: string, + bytes: 'b' | 'k' | 'm' | 'g', + local: boolean, + master_timeout: string, + h: string | string[], + health: 'green' | 'yellow' | 'red', + help: boolean, + pri: boolean, + s: string | string[], + v: boolean, + include_unloaded_segments: boolean +}) ---- link:{ref}/cat-indices.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to limit the returned information +|`string \| string[]` - A comma-separated list of index names to limit the returned information |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`bytes` -|`'b', 'k', 'm', 'g'` - The unit in which to display byte values +|`'b' \| 'k' \| 'm' \| 'g'` - The unit in which to display byte values |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -297,10 +376,10 @@ link:{ref}/cat-indices.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`health` -|`'green', 'yellow', 'red'` - A health status ("green", "yellow", or "red" to filter only indices matching the specified health status +|`'green' \| 'yellow' \| 'red'` - A health status ("green", "yellow", or "red" to filter only indices matching the specified health status |`help` |`boolean` - Return help information @@ -309,7 +388,7 @@ link:{ref}/cat-indices.html[Reference] |`boolean` - Set to true to return stats only for primary shards |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -320,9 +399,17 @@ link:{ref}/cat-indices.html[Reference] |=== === cat.master -[source,js] ----- -client.cat.master([params] [, options] [, callback]) +[source,ts] +---- +client.cat.master({ + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-master.html[Reference] [cols=2*] @@ -337,13 +424,13 @@ link:{ref}/cat-master.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -351,9 +438,17 @@ link:{ref}/cat-master.html[Reference] |=== === cat.nodeattrs -[source,js] ----- -client.cat.nodeattrs([params] [, options] [, callback]) +[source,ts] +---- +client.cat.nodeattrs({ + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-nodeattrs.html[Reference] [cols=2*] @@ -368,13 +463,13 @@ link:{ref}/cat-nodeattrs.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -382,9 +477,18 @@ link:{ref}/cat-nodeattrs.html[Reference] |=== === cat.nodes -[source,js] ----- -client.cat.nodes([params] [, options] [, callback]) +[source,ts] +---- +client.cat.nodes({ + format: string, + full_id: boolean, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-nodes.html[Reference] [cols=2*] @@ -402,13 +506,13 @@ link:{ref}/cat-nodes.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -416,9 +520,17 @@ link:{ref}/cat-nodes.html[Reference] |=== === cat.pendingTasks -[source,js] ----- -client.cat.pendingTasks([params] [, options] [, callback]) +[source,ts] +---- +client.cat.pendingTasks({ + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-pending-tasks.html[Reference] [cols=2*] @@ -433,13 +545,13 @@ link:{ref}/cat-pending-tasks.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -447,9 +559,17 @@ link:{ref}/cat-pending-tasks.html[Reference] |=== === cat.plugins -[source,js] ----- -client.cat.plugins([params] [, options] [, callback]) +[source,ts] +---- +client.cat.plugins({ + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-plugins.html[Reference] [cols=2*] @@ -464,13 +584,13 @@ link:{ref}/cat-plugins.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -478,33 +598,42 @@ link:{ref}/cat-plugins.html[Reference] |=== === cat.recovery -[source,js] ----- -client.cat.recovery([params] [, options] [, callback]) +[source,ts] +---- +client.cat.recovery({ + index: string | string[], + format: string, + bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-recovery.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to limit the returned information +|`string \| string[]` - A comma-separated list of index names to limit the returned information |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`bytes` -|`'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'` - The unit in which to display byte values +|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values |`master_timeout` or `masterTimeout` |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -512,9 +641,17 @@ link:{ref}/cat-recovery.html[Reference] |=== === cat.repositories -[source,js] ----- -client.cat.repositories([params] [, options] [, callback]) +[source,ts] +---- +client.cat.repositories({ + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-repositories.html[Reference] [cols=2*] @@ -529,13 +666,13 @@ link:{ref}/cat-repositories.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -543,30 +680,38 @@ link:{ref}/cat-repositories.html[Reference] |=== === cat.segments -[source,js] ----- -client.cat.segments([params] [, options] [, callback]) +[source,ts] +---- +client.cat.segments({ + index: string | string[], + format: string, + bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-segments.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to limit the returned information +|`string \| string[]` - A comma-separated list of index names to limit the returned information |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`bytes` -|`'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'` - The unit in which to display byte values +|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -574,21 +719,31 @@ link:{ref}/cat-segments.html[Reference] |=== === cat.shards -[source,js] ----- -client.cat.shards([params] [, options] [, callback]) +[source,ts] +---- +client.cat.shards({ + index: string | string[], + format: string, + bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-shards.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to limit the returned information +|`string \| string[]` - A comma-separated list of index names to limit the returned information |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`bytes` -|`'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'` - The unit in which to display byte values +|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -597,13 +752,13 @@ link:{ref}/cat-shards.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -611,15 +766,24 @@ link:{ref}/cat-shards.html[Reference] |=== === cat.snapshots -[source,js] ----- -client.cat.snapshots([params] [, options] [, callback]) +[source,ts] +---- +client.cat.snapshots({ + repository: string | string[], + format: string, + ignore_unavailable: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-snapshots.html[Reference] [cols=2*] |=== |`repository` -|`string, string[]` - Name of repository from which to fetch the snapshot information +|`string \| string[]` - Name of repository from which to fetch the snapshot information |`format` |`string` - a short version of the Accept header, e.g. json, yaml @@ -631,13 +795,13 @@ link:{ref}/cat-snapshots.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -645,9 +809,19 @@ link:{ref}/cat-snapshots.html[Reference] |=== === cat.tasks -[source,js] ----- -client.cat.tasks([params] [, options] [, callback]) +[source,ts] +---- +client.cat.tasks({ + format: string, + node_id: string | string[], + actions: string | string[], + detailed: boolean, + parent_task: number, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/tasks.html[Reference] [cols=2*] @@ -656,10 +830,10 @@ link:{ref}/tasks.html[Reference] |`string` - a short version of the Accept header, e.g. json, yaml |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`actions` -|`string, string[]` - A comma-separated list of actions that should be returned. Leave empty to return all. +|`string \| string[]` - A comma-separated list of actions that should be returned. Leave empty to return all. |`detailed` |`boolean` - Return detailed task information (default: false) @@ -668,13 +842,13 @@ link:{ref}/tasks.html[Reference] |`number` - Return tasks with specified parent task id. Set to -1 to return all. |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -682,9 +856,18 @@ link:{ref}/tasks.html[Reference] |=== === cat.templates -[source,js] ----- -client.cat.templates([params] [, options] [, callback]) +[source,ts] +---- +client.cat.templates({ + name: string, + format: string, + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-templates.html[Reference] [cols=2*] @@ -702,13 +885,13 @@ link:{ref}/cat-templates.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -716,21 +899,31 @@ link:{ref}/cat-templates.html[Reference] |=== === cat.threadPool -[source,js] ----- -client.cat.threadPool([params] [, options] [, callback]) +[source,ts] +---- +client.cat.threadPool({ + thread_pool_patterns: string | string[], + format: string, + size: '' | 'k' | 'm' | 'g' | 't' | 'p', + local: boolean, + master_timeout: string, + h: string | string[], + help: boolean, + s: string | string[], + v: boolean +}) ---- link:{ref}/cat-thread-pool.html[Reference] [cols=2*] |=== |`thread_pool_patterns` or `threadPoolPatterns` -|`string, string[]` - A comma-separated list of regular-expressions to filter the thread pools in the output +|`string \| string[]` - A comma-separated list of regular-expressions to filter the thread pools in the output |`format` |`string` - a short version of the Accept header, e.g. json, yaml |`size` -|`'', 'k', 'm', 'g', 't', 'p'` - The multiplier in which to display values +|`'' \| 'k' \| 'm' \| 'g' \| 't' \| 'p'` - The multiplier in which to display values |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -739,13 +932,13 @@ link:{ref}/cat-thread-pool.html[Reference] |`string` - Explicit operation timeout for connection to master node |`h` -|`string, string[]` - Comma-separated list of column names to display +|`string \| string[]` - Comma-separated list of column names to display |`help` |`boolean` - Return help information |`s` -|`string, string[]` - Comma-separated list of column names or column aliases to sort by +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by |`v` |`boolean` - Verbose mode. Display column headers @@ -753,15 +946,18 @@ link:{ref}/cat-thread-pool.html[Reference] |=== === clearScroll -[source,js] +[source,ts] ---- -client.clearScroll([params] [, options] [, callback]) +client.clearScroll({ + scroll_id: string | string[], + body: object +}) ---- link:{ref}/search-request-body.html#request-body-search-scroll[Reference] [cols=2*] |=== |`scroll_id` or `scrollId` -|`string, string[]` - A comma-separated list of scroll IDs to clear +|`string \| string[]` - A comma-separated list of scroll IDs to clear |`body` |`object` - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter @@ -769,9 +965,13 @@ link:{ref}/search-request-body.html#request-body-search-scroll[Reference] |=== === cluster.allocationExplain -[source,js] +[source,ts] ---- -client.cluster.allocationExplain([params] [, options] [, callback]) +client.cluster.allocationExplain({ + include_yes_decisions: boolean, + include_disk_info: boolean, + body: object +}) ---- link:{ref}/cluster-allocation-explain.html[Reference] [cols=2*] @@ -788,9 +988,14 @@ link:{ref}/cluster-allocation-explain.html[Reference] |=== === cluster.getSettings -[source,js] +[source,ts] ---- -client.cluster.getSettings([params] [, options] [, callback]) +client.cluster.getSettings({ + flat_settings: boolean, + master_timeout: string, + timeout: string, + include_defaults: boolean +}) ---- link:{ref}/cluster-update-settings.html[Reference] [cols=2*] @@ -810,22 +1015,35 @@ link:{ref}/cluster-update-settings.html[Reference] |=== === cluster.health -[source,js] ----- -client.cluster.health([params] [, options] [, callback]) +[source,ts] +---- +client.cluster.health({ + index: string | string[], + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + level: 'cluster' | 'indices' | 'shards', + local: boolean, + master_timeout: string, + timeout: string, + wait_for_active_shards: string, + wait_for_nodes: string, + wait_for_events: 'immediate' | 'urgent' | 'high' | 'normal' | 'low' | 'languid', + wait_for_no_relocating_shards: boolean, + wait_for_no_initializing_shards: boolean, + wait_for_status: 'green' | 'yellow' | 'red' +}) ---- link:{ref}/cluster-health.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - Limit the information returned to a specific index +|`string \| string[]` - Limit the information returned to a specific index |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `all` |`level` -|`'cluster', 'indices', 'shards'` - Specify the level of detail for returned information + +|`'cluster' \| 'indices' \| 'shards'` - Specify the level of detail for returned information + _Default:_ `cluster` |`local` @@ -844,7 +1062,7 @@ _Default:_ `cluster` |`string` - Wait until the specified number of nodes is available |`wait_for_events` or `waitForEvents` -|`'immediate', 'urgent', 'high', 'normal', 'low', 'languid'` - Wait until all currently queued events with the given priority are processed +|`'immediate' \| 'urgent' \| 'high' \| 'normal' \| 'low' \| 'languid'` - Wait until all currently queued events with the given priority are processed |`wait_for_no_relocating_shards` or `waitForNoRelocatingShards` |`boolean` - Whether to wait until there are no relocating shards in the cluster @@ -853,14 +1071,17 @@ _Default:_ `cluster` |`boolean` - Whether to wait until there are no initializing shards in the cluster |`wait_for_status` or `waitForStatus` -|`'green', 'yellow', 'red'` - Wait until cluster is in a specific state +|`'green' \| 'yellow' \| 'red'` - Wait until cluster is in a specific state |=== === cluster.pendingTasks -[source,js] +[source,ts] ---- -client.cluster.pendingTasks([params] [, options] [, callback]) +client.cluster.pendingTasks({ + local: boolean, + master_timeout: string +}) ---- link:{ref}/cluster-pending.html[Reference] [cols=2*] @@ -874,9 +1095,14 @@ link:{ref}/cluster-pending.html[Reference] |=== === cluster.putSettings -[source,js] +[source,ts] ---- -client.cluster.putSettings([params] [, options] [, callback]) +client.cluster.putSettings({ + flat_settings: boolean, + master_timeout: string, + timeout: string, + body: object +}) ---- link:{ref}/cluster-update-settings.html[Reference] [cols=2*] @@ -896,17 +1122,25 @@ link:{ref}/cluster-update-settings.html[Reference] |=== === cluster.remoteInfo -[source,js] +[source,ts] ---- -client.cluster.remoteInfo([params] [, options] [, callback]) +client.cluster.remoteInfo() ---- link:{ref}/cluster-remote-info.html[Reference] === cluster.reroute -[source,js] ----- -client.cluster.reroute([params] [, options] [, callback]) +[source,ts] +---- +client.cluster.reroute({ + dry_run: boolean, + explain: boolean, + retry_failed: boolean, + metric: string | string[], + master_timeout: string, + timeout: string, + body: object +}) ---- link:{ref}/cluster-reroute.html[Reference] [cols=2*] @@ -921,7 +1155,7 @@ link:{ref}/cluster-reroute.html[Reference] |`boolean` - Retries allocation of shards that are blocked due to too many subsequent allocation failures |`metric` -|`string, string[]` - Limit the information returned to the specified metrics. Defaults to all but metadata +|`string \| string[]` - Limit the information returned to the specified metrics. Defaults to all but metadata |`master_timeout` or `masterTimeout` |`string` - Explicit operation timeout for connection to master node @@ -935,18 +1169,29 @@ link:{ref}/cluster-reroute.html[Reference] |=== === cluster.state -[source,js] ----- -client.cluster.state([params] [, options] [, callback]) +[source,ts] +---- +client.cluster.state({ + index: string | string[], + metric: string | string[], + local: boolean, + master_timeout: string, + flat_settings: boolean, + wait_for_metadata_version: number, + wait_for_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/cluster-state.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`metric` -|`string, string[]` - Limit the information returned to the specified metrics +|`string \| string[]` - Limit the information returned to the specified metrics |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -970,21 +1215,25 @@ link:{ref}/cluster-state.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === cluster.stats -[source,js] +[source,ts] ---- -client.cluster.stats([params] [, options] [, callback]) +client.cluster.stats({ + node_id: string | string[], + flat_settings: boolean, + timeout: string +}) ---- link:{ref}/cluster-stats.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -995,18 +1244,36 @@ link:{ref}/cluster-stats.html[Reference] |=== === count -[source,js] ----- -client.count([params] [, options] [, callback]) +[source,ts] +---- +client.count({ + index: string | string[], + type: string | string[], + ignore_unavailable: boolean, + ignore_throttled: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + min_score: number, + preference: string, + routing: string | string[], + q: string, + analyzer: string, + analyze_wildcard: boolean, + default_operator: 'AND' | 'OR', + df: string, + lenient: boolean, + terminate_after: number, + body: object +}) ---- link:{ref}/search-count.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of indices to restrict the results +|`string \| string[]` - A comma-separated list of indices to restrict the results |`type` -|`string, string[]` - A comma-separated list of types to restrict the results +|`string \| string[]` - A comma-separated list of types to restrict the results |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -1018,7 +1285,7 @@ link:{ref}/search-count.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`min_score` or `minScore` @@ -1028,7 +1295,7 @@ _Default:_ `open` |`string` - Specify the node or shard the operation should be performed on (default: random) |`routing` -|`string, string[]` - A comma-separated list of specific routing values +|`string \| string[]` - A comma-separated list of specific routing values |`q` |`string` - Query in the Lucene query string syntax @@ -1040,7 +1307,7 @@ _Default:_ `open` |`boolean` - Specify whether wildcard and prefix queries should be analyzed (default: false) |`default_operator` or `defaultOperator` -|`'AND', 'OR'` - The default operator for query string query (AND or OR) + +|`'AND' \| 'OR'` - The default operator for query string query (AND or OR) + _Default:_ `OR` |`df` @@ -1058,9 +1325,21 @@ _Default:_ `OR` |=== === create -[source,js] ----- -client.create([params] [, options] [, callback]) +[source,ts] +---- +client.create({ + id: string, + index: string, + type: string, + wait_for_active_shards: string, + refresh: 'true' | 'false' | 'wait_for', + routing: string, + timeout: string, + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force', + pipeline: string, + body: object +}) ---- link:{ref}/docs-index_.html[Reference] [cols=2*] @@ -1078,7 +1357,7 @@ link:{ref}/docs-index_.html[Reference] |`string` - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |`refresh` -|`'true', 'false', 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |`routing` |`string` - Specific routing value @@ -1090,7 +1369,7 @@ link:{ref}/docs-index_.html[Reference] |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |`pipeline` |`string` - The pipeline id to preprocess incoming documents with @@ -1101,9 +1380,21 @@ link:{ref}/docs-index_.html[Reference] |=== === delete -[source,js] ----- -client.delete([params] [, options] [, callback]) +[source,ts] +---- +client.delete({ + id: string, + index: string, + type: string, + wait_for_active_shards: string, + refresh: 'true' | 'false' | 'wait_for', + routing: string, + timeout: string, + if_seq_no: number, + if_primary_term: number, + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force' +}) ---- link:{ref}/docs-delete.html[Reference] [cols=2*] @@ -1121,7 +1412,7 @@ link:{ref}/docs-delete.html[Reference] |`string` - Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |`refresh` -|`'true', 'false', 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |`routing` |`string` - Specific routing value @@ -1139,20 +1430,55 @@ link:{ref}/docs-delete.html[Reference] |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |=== === deleteByQuery -[source,js] ----- -client.deleteByQuery([params] [, options] [, callback]) +[source,ts] +---- +client.deleteByQuery({ + index: string | string[], + analyzer: string, + analyze_wildcard: boolean, + default_operator: 'AND' | 'OR', + df: string, + from: number, + ignore_unavailable: boolean, + allow_no_indices: boolean, + conflicts: 'abort' | 'proceed', + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + lenient: boolean, + preference: string, + q: string, + routing: string | string[], + scroll: string, + search_type: 'query_then_fetch' | 'dfs_query_then_fetch', + search_timeout: string, + max_docs: number, + sort: string | string[], + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + terminate_after: number, + stats: string | string[], + version: boolean, + request_cache: boolean, + refresh: boolean, + timeout: string, + wait_for_active_shards: string, + scroll_size: number, + wait_for_completion: boolean, + requests_per_second: number, + slices: number, + body: object +}) ---- link:{ref}/docs-delete-by-query.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` |`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -1164,7 +1490,7 @@ link:{ref}/docs-delete-by-query.html[Reference] |`boolean` - Specify whether wildcard and prefix queries should be analyzed (default: false) |`default_operator` or `defaultOperator` -|`'AND', 'OR'` - The default operator for query string query (AND or OR) + +|`'AND' \| 'OR'` - The default operator for query string query (AND or OR) + _Default:_ `OR` |`df` @@ -1180,11 +1506,11 @@ _Default:_ `OR` |`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) |`conflicts` -|`'abort', 'proceed'` - What to do when the delete by query hits version conflicts? + +|`'abort' \| 'proceed'` - What to do when the delete by query hits version conflicts? + _Default:_ `abort` |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`lenient` @@ -1197,13 +1523,13 @@ _Default:_ `open` |`string` - Query in the Lucene query string syntax |`routing` -|`string, string[]` - A comma-separated list of specific routing values +|`string \| string[]` - A comma-separated list of specific routing values |`scroll` |`string` - Specify how long a consistent view of the index should be maintained for scrolled search |`search_type` or `searchType` -|`'query_then_fetch', 'dfs_query_then_fetch'` - Search operation type +|`'query_then_fetch' \| 'dfs_query_then_fetch'` - Search operation type |`search_timeout` or `searchTimeout` |`string` - Explicit timeout for each search request. Defaults to no timeout. @@ -1215,22 +1541,22 @@ _Default:_ `open` |`number` - Maximum number of documents to process (default: all documents) |`sort` -|`string, string[]` - A comma-separated list of : pairs +|`string \| string[]` - A comma-separated list of : pairs |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`terminate_after` or `terminateAfter` |`number` - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |`stats` -|`string, string[]` - Specific 'tag' of the request for logging and statistical purposes +|`string \| string[]` - Specific 'tag' of the request for logging and statistical purposes |`version` |`boolean` - Specify whether to return document version as part of a hit @@ -1268,9 +1594,12 @@ _Default:_ `1` |=== === deleteByQueryRethrottle -[source,js] +[source,ts] ---- -client.deleteByQueryRethrottle([params] [, options] [, callback]) +client.deleteByQueryRethrottle({ + task_id: string, + requests_per_second: number +}) ---- link:{ref}/docs-delete-by-query.html[Reference] [cols=2*] @@ -1284,9 +1613,13 @@ link:{ref}/docs-delete-by-query.html[Reference] |=== === deleteScript -[source,js] +[source,ts] ---- -client.deleteScript([params] [, options] [, callback]) +client.deleteScript({ + id: string, + timeout: string, + master_timeout: string +}) ---- link:{ref}/modules-scripting.html[Reference] [cols=2*] @@ -1303,9 +1636,23 @@ link:{ref}/modules-scripting.html[Reference] |=== === exists -[source,js] ----- -client.exists([params] [, options] [, callback]) +[source,ts] +---- +client.exists({ + id: string, + index: string, + type: string, + stored_fields: string | string[], + preference: string, + realtime: boolean, + refresh: boolean, + routing: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force' +}) ---- link:{ref}/docs-get.html[Reference] [cols=2*] @@ -1320,7 +1667,7 @@ link:{ref}/docs-get.html[Reference] |`string` - The type of the document (use `_all` to fetch the first document matching the ID across all types) |`stored_fields` or `storedFields` -|`string, string[]` - A comma-separated list of stored fields to return in the response +|`string \| string[]` - A comma-separated list of stored fields to return in the response |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1335,26 +1682,39 @@ link:{ref}/docs-get.html[Reference] |`string` - Specific routing value |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`version` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |=== === existsSource -[source,js] ----- -client.existsSource([params] [, options] [, callback]) +[source,ts] +---- +client.existsSource({ + id: string, + index: string, + type: string, + preference: string, + realtime: boolean, + refresh: boolean, + routing: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force' +}) ---- link:{ref}/docs-get.html[Reference] [cols=2*] @@ -1381,26 +1741,43 @@ link:{ref}/docs-get.html[Reference] |`string` - Specific routing value |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`version` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |=== === explain -[source,js] ----- -client.explain([params] [, options] [, callback]) +[source,ts] +---- +client.explain({ + id: string, + index: string, + type: string, + analyze_wildcard: boolean, + analyzer: string, + default_operator: 'AND' | 'OR', + df: string, + stored_fields: string | string[], + lenient: boolean, + preference: string, + q: string, + routing: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + body: object +}) ---- link:{ref}/search-explain.html[Reference] [cols=2*] @@ -1421,14 +1798,14 @@ link:{ref}/search-explain.html[Reference] |`string` - The analyzer for the query string query |`default_operator` or `defaultOperator` -|`'AND', 'OR'` - The default operator for query string query (AND or OR) + +|`'AND' \| 'OR'` - The default operator for query string query (AND or OR) + _Default:_ `OR` |`df` |`string` - The default field for query string query (default: _all) |`stored_fields` or `storedFields` -|`string, string[]` - A comma-separated list of stored fields to return in the response +|`string \| string[]` - A comma-separated list of stored fields to return in the response |`lenient` |`boolean` - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored @@ -1443,13 +1820,13 @@ _Default:_ `OR` |`string` - Specific routing value |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`body` |`object` - The query definition using the Query DSL @@ -1457,18 +1834,25 @@ _Default:_ `OR` |=== === fieldCaps -[source,js] +[source,ts] ---- -client.fieldCaps([params] [, options] [, callback]) +client.fieldCaps({ + index: string | string[], + fields: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + include_unmapped: boolean +}) ---- link:{ref}/search-field-caps.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`fields` -|`string, string[]` - A comma-separated list of field names +|`string \| string[]` - A comma-separated list of field names |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -1477,7 +1861,7 @@ link:{ref}/search-field-caps.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`include_unmapped` or `includeUnmapped` @@ -1486,9 +1870,23 @@ _Default:_ `open` |=== === get -[source,js] ----- -client.get([params] [, options] [, callback]) +[source,ts] +---- +client.get({ + id: string, + index: string, + type: string, + stored_fields: string | string[], + preference: string, + realtime: boolean, + refresh: boolean, + routing: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force' +}) ---- link:{ref}/docs-get.html[Reference] [cols=2*] @@ -1503,7 +1901,7 @@ link:{ref}/docs-get.html[Reference] |`string` - The type of the document (use `_all` to fetch the first document matching the ID across all types) |`stored_fields` or `storedFields` -|`string, string[]` - A comma-separated list of stored fields to return in the response +|`string \| string[]` - A comma-separated list of stored fields to return in the response |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -1518,26 +1916,29 @@ link:{ref}/docs-get.html[Reference] |`string` - Specific routing value |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`version` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |=== === getScript -[source,js] +[source,ts] ---- -client.getScript([params] [, options] [, callback]) +client.getScript({ + id: string, + master_timeout: string +}) ---- link:{ref}/modules-scripting.html[Reference] [cols=2*] @@ -1551,9 +1952,22 @@ link:{ref}/modules-scripting.html[Reference] |=== === getSource -[source,js] ----- -client.getSource([params] [, options] [, callback]) +[source,ts] +---- +client.getSource({ + id: string, + index: string, + type: string, + preference: string, + realtime: boolean, + refresh: boolean, + routing: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force' +}) ---- link:{ref}/docs-get.html[Reference] [cols=2*] @@ -1580,26 +1994,41 @@ link:{ref}/docs-get.html[Reference] |`string` - Specific routing value |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`version` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |=== === index -[source,js] ----- -client.index([params] [, options] [, callback]) +[source,ts] +---- +client.index({ + id: string, + index: string, + type: string, + wait_for_active_shards: string, + op_type: 'index' | 'create', + refresh: 'true' | 'false' | 'wait_for', + routing: string, + timeout: string, + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force', + if_seq_no: number, + if_primary_term: number, + pipeline: string, + body: object +}) ---- link:{ref}/docs-index_.html[Reference] [cols=2*] @@ -1617,11 +2046,11 @@ link:{ref}/docs-index_.html[Reference] |`string` - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |`op_type` or `opType` -|`'index', 'create'` - Explicit operation type + +|`'index' \| 'create'` - Explicit operation type + _Default:_ `index` |`refresh` -|`'true', 'false', 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |`routing` |`string` - Specific routing value @@ -1633,7 +2062,7 @@ _Default:_ `index` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |`if_seq_no` or `ifSeqNo` |`number` - only perform the index operation if the last operation that has changed the document has the specified sequence number @@ -1650,9 +2079,13 @@ _Default:_ `index` |=== === indices.analyze -[source,js] +[source,ts] ---- -client.indices.analyze([params] [, options] [, callback]) +client.indices.analyze({ + index: string, + index: string, + body: object +}) ---- link:{ref}/indices-analyze.html[Reference] [cols=2*] @@ -1669,21 +2102,31 @@ link:{ref}/indices-analyze.html[Reference] |=== === indices.clearCache -[source,js] ----- -client.indices.clearCache([params] [, options] [, callback]) +[source,ts] +---- +client.indices.clearCache({ + index: string | string[], + fielddata: boolean, + fields: string | string[], + query: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + index: string | string[], + request: boolean +}) ---- link:{ref}/indices-clearcache.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index name to limit the operation +|`string \| string[]` - A comma-separated list of index name to limit the operation |`fielddata` |`boolean` - Clear field data |`fields` -|`string, string[]` - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) +|`string \| string[]` - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) |`query` |`boolean` - Clear query caches @@ -1695,11 +2138,11 @@ link:{ref}/indices-clearcache.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`index` -|`string, string[]` - A comma-separated list of index name to limit the operation +|`string \| string[]` - A comma-separated list of index name to limit the operation |`request` |`boolean` - Clear request cache @@ -1707,15 +2150,23 @@ _Default:_ `open` |=== === indices.close -[source,js] ----- -client.indices.close([params] [, options] [, callback]) +[source,ts] +---- +client.indices.close({ + index: string | string[], + timeout: string, + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + wait_for_active_shards: string +}) ---- link:{ref}/indices-open-close.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma separated list of indices to close +|`string \| string[]` - A comma separated list of indices to close |`timeout` |`string` - Explicit operation timeout @@ -1730,7 +2181,7 @@ link:{ref}/indices-open-close.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`wait_for_active_shards` or `waitForActiveShards` @@ -1739,9 +2190,16 @@ _Default:_ `open` |=== === indices.create -[source,js] +[source,ts] ---- -client.indices.create([params] [, options] [, callback]) +client.indices.create({ + index: string, + include_type_name: boolean, + wait_for_active_shards: string, + timeout: string, + master_timeout: string, + body: object +}) ---- link:{ref}/indices-create-index.html[Reference] [cols=2*] @@ -1767,15 +2225,22 @@ link:{ref}/indices-create-index.html[Reference] |=== === indices.delete -[source,js] +[source,ts] ---- -client.indices.delete([params] [, options] [, callback]) +client.indices.delete({ + index: string | string[], + timeout: string, + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-delete-index.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices +|`string \| string[]` - A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices |`timeout` |`string` - Explicit operation timeout @@ -1790,24 +2255,29 @@ link:{ref}/indices-delete-index.html[Reference] |`boolean` - Ignore if a wildcard expression resolves to no concrete indices (default: false) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + _Default:_ `open` |=== === indices.deleteAlias -[source,js] +[source,ts] ---- -client.indices.deleteAlias([params] [, options] [, callback]) +client.indices.deleteAlias({ + index: string | string[], + name: string | string[], + timeout: string, + master_timeout: string +}) ---- link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names (supports wildcards); use `_all` for all indices +|`string \| string[]` - A comma-separated list of index names (supports wildcards); use `_all` for all indices |`name` -|`string, string[]` - A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. +|`string \| string[]` - A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. |`timeout` |`string` - Explicit timestamp for the document @@ -1818,9 +2288,13 @@ link:{ref}/indices-aliases.html[Reference] |=== === indices.deleteTemplate -[source,js] +[source,ts] ---- -client.indices.deleteTemplate([params] [, options] [, callback]) +client.indices.deleteTemplate({ + name: string, + timeout: string, + master_timeout: string +}) ---- link:{ref}/indices-templates.html[Reference] [cols=2*] @@ -1837,15 +2311,23 @@ link:{ref}/indices-templates.html[Reference] |=== === indices.exists -[source,js] ----- -client.indices.exists([params] [, options] [, callback]) +[source,ts] +---- +client.indices.exists({ + index: string | string[], + local: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + flat_settings: boolean, + include_defaults: boolean +}) ---- link:{ref}/indices-exists.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names +|`string \| string[]` - A comma-separated list of index names |`local` |`boolean` - Return local information, do not retrieve the state from master node (default: false) @@ -1857,7 +2339,7 @@ link:{ref}/indices-exists.html[Reference] |`boolean` - Ignore if a wildcard expression resolves to no concrete indices (default: false) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + _Default:_ `open` |`flat_settings` or `flatSettings` @@ -1869,18 +2351,25 @@ _Default:_ `open` |=== === indices.existsAlias -[source,js] +[source,ts] ---- -client.indices.existsAlias([params] [, options] [, callback]) +client.indices.existsAlias({ + index: string | string[], + name: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + local: boolean +}) ---- link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to filter aliases +|`string \| string[]` - A comma-separated list of index names to filter aliases |`name` -|`string, string[]` - A comma-separated list of alias names to return +|`string \| string[]` - A comma-separated list of alias names to return |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -1889,7 +2378,7 @@ link:{ref}/indices-aliases.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `all` |`local` @@ -1898,15 +2387,20 @@ _Default:_ `all` |=== === indices.existsTemplate -[source,js] +[source,ts] ---- -client.indices.existsTemplate([params] [, options] [, callback]) +client.indices.existsTemplate({ + name: string | string[], + flat_settings: boolean, + master_timeout: string, + local: boolean +}) ---- link:{ref}/indices-templates.html[Reference] [cols=2*] |=== |`name` -|`string, string[]` - The comma separated names of the index templates +|`string \| string[]` - The comma separated names of the index templates |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -1920,18 +2414,25 @@ link:{ref}/indices-templates.html[Reference] |=== === indices.existsType -[source,js] +[source,ts] ---- -client.indices.existsType([params] [, options] [, callback]) +client.indices.existsType({ + index: string | string[], + type: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + local: boolean +}) ---- link:{ref}/indices-types-exists.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` to check the types across all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` to check the types across all indices |`type` -|`string, string[]` - A comma-separated list of document types to check +|`string \| string[]` - A comma-separated list of document types to check |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -1940,7 +2441,7 @@ link:{ref}/indices-types-exists.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`local` @@ -1949,15 +2450,22 @@ _Default:_ `open` |=== === indices.flush -[source,js] +[source,ts] ---- -client.indices.flush([params] [, options] [, callback]) +client.indices.flush({ + index: string | string[], + force: boolean, + wait_if_ongoing: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-flush.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string for all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string for all indices |`force` |`boolean` - Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) @@ -1972,21 +2480,26 @@ link:{ref}/indices-flush.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === indices.flushSynced -[source,js] +[source,ts] ---- -client.indices.flushSynced([params] [, options] [, callback]) +client.indices.flushSynced({ + index: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-flush.html#synced-flush-api[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string for all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string for all indices |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -1995,21 +2508,29 @@ link:{ref}/indices-flush.html#synced-flush-api[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === indices.forcemerge -[source,js] ----- -client.indices.forcemerge([params] [, options] [, callback]) +[source,ts] +---- +client.indices.forcemerge({ + index: string | string[], + flush: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + max_num_segments: number, + only_expunge_deletes: boolean +}) ---- link:{ref}/indices-forcemerge.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`flush` |`boolean` - Specify whether the index should be flushed after performing the operation (default: true) @@ -2021,7 +2542,7 @@ link:{ref}/indices-forcemerge.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`max_num_segments` or `maxNumSegments` @@ -2033,15 +2554,25 @@ _Default:_ `open` |=== === indices.get -[source,js] ----- -client.indices.get([params] [, options] [, callback]) +[source,ts] +---- +client.indices.get({ + index: string | string[], + include_type_name: boolean, + local: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + flat_settings: boolean, + include_defaults: boolean, + master_timeout: string +}) ---- link:{ref}/indices-get-index.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names +|`string \| string[]` - A comma-separated list of index names |`include_type_name` or `includeTypeName` |`boolean` - Whether to add the type name to the response (default: false) @@ -2056,7 +2587,7 @@ link:{ref}/indices-get-index.html[Reference] |`boolean` - Ignore if a wildcard expression resolves to no concrete indices (default: false) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) + _Default:_ `open` |`flat_settings` or `flatSettings` @@ -2071,18 +2602,25 @@ _Default:_ `open` |=== === indices.getAlias -[source,js] +[source,ts] ---- -client.indices.getAlias([params] [, options] [, callback]) +client.indices.getAlias({ + index: string | string[], + name: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + local: boolean +}) ---- link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to filter aliases +|`string \| string[]` - A comma-separated list of index names to filter aliases |`name` -|`string, string[]` - A comma-separated list of alias names to return +|`string \| string[]` - A comma-separated list of alias names to return |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -2091,7 +2629,7 @@ link:{ref}/indices-aliases.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `all` |`local` @@ -2100,21 +2638,31 @@ _Default:_ `all` |=== === indices.getFieldMapping -[source,js] ----- -client.indices.getFieldMapping([params] [, options] [, callback]) +[source,ts] +---- +client.indices.getFieldMapping({ + index: string | string[], + type: string | string[], + fields: string | string[], + include_type_name: boolean, + include_defaults: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + local: boolean +}) ---- link:{ref}/indices-get-field-mapping.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names +|`string \| string[]` - A comma-separated list of index names |`type` -|`string, string[]` - A comma-separated list of document types +|`string \| string[]` - A comma-separated list of document types |`fields` -|`string, string[]` - A comma-separated list of fields +|`string \| string[]` - A comma-separated list of fields |`include_type_name` or `includeTypeName` |`boolean` - Whether a type should be returned in the body of the mappings. @@ -2129,7 +2677,7 @@ link:{ref}/indices-get-field-mapping.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`local` @@ -2138,18 +2686,27 @@ _Default:_ `open` |=== === indices.getMapping -[source,js] ----- -client.indices.getMapping([params] [, options] [, callback]) +[source,ts] +---- +client.indices.getMapping({ + index: string | string[], + type: string | string[], + include_type_name: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + master_timeout: string, + local: boolean +}) ---- link:{ref}/indices-get-mapping.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names +|`string \| string[]` - A comma-separated list of index names |`type` -|`string, string[]` - A comma-separated list of document types +|`string \| string[]` - A comma-separated list of document types |`include_type_name` or `includeTypeName` |`boolean` - Whether to add the type name to the response (default: false) @@ -2161,7 +2718,7 @@ link:{ref}/indices-get-mapping.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`master_timeout` or `masterTimeout` @@ -2173,18 +2730,28 @@ _Default:_ `open` |=== === indices.getSettings -[source,js] ----- -client.indices.getSettings([params] [, options] [, callback]) +[source,ts] +---- +client.indices.getSettings({ + index: string | string[], + name: string | string[], + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + flat_settings: boolean, + local: boolean, + include_defaults: boolean +}) ---- link:{ref}/indices-get-settings.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`name` -|`string, string[]` - The name of the settings that should be included +|`string \| string[]` - The name of the settings that should be included |`master_timeout` or `masterTimeout` |`string` - Specify timeout for connection to master @@ -2196,7 +2763,7 @@ link:{ref}/indices-get-settings.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open,closed` |`flat_settings` or `flatSettings` @@ -2211,15 +2778,21 @@ _Default:_ `open,closed` |=== === indices.getTemplate -[source,js] +[source,ts] ---- -client.indices.getTemplate([params] [, options] [, callback]) +client.indices.getTemplate({ + name: string | string[], + include_type_name: boolean, + flat_settings: boolean, + master_timeout: string, + local: boolean +}) ---- link:{ref}/indices-templates.html[Reference] [cols=2*] |=== |`name` -|`string, string[]` - The comma separated names of the index templates +|`string \| string[]` - The comma separated names of the index templates |`include_type_name` or `includeTypeName` |`boolean` - Whether a type should be returned in the body of the mappings. @@ -2236,15 +2809,20 @@ link:{ref}/indices-templates.html[Reference] |=== === indices.getUpgrade -[source,js] +[source,ts] ---- -client.indices.getUpgrade([params] [, options] [, callback]) +client.indices.getUpgrade({ + index: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-upgrade.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -2253,21 +2831,29 @@ link:{ref}/indices-upgrade.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === indices.open -[source,js] ----- -client.indices.open([params] [, options] [, callback]) +[source,ts] +---- +client.indices.open({ + index: string | string[], + timeout: string, + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + wait_for_active_shards: string +}) ---- link:{ref}/indices-open-close.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma separated list of indices to open +|`string \| string[]` - A comma separated list of indices to open |`timeout` |`string` - Explicit operation timeout @@ -2282,7 +2868,7 @@ link:{ref}/indices-open-close.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `closed` |`wait_for_active_shards` or `waitForActiveShards` @@ -2291,15 +2877,21 @@ _Default:_ `closed` |=== === indices.putAlias -[source,js] +[source,ts] ---- -client.indices.putAlias([params] [, options] [, callback]) +client.indices.putAlias({ + index: string | string[], + name: string, + timeout: string, + master_timeout: string, + body: object +}) ---- link:{ref}/indices-aliases.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. +|`string \| string[]` - A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. |`name` |`string` - The name of the alias to be created or updated @@ -2316,15 +2908,25 @@ link:{ref}/indices-aliases.html[Reference] |=== === indices.putMapping -[source,js] ----- -client.indices.putMapping([params] [, options] [, callback]) +[source,ts] +---- +client.indices.putMapping({ + index: string | string[], + type: string, + include_type_name: boolean, + timeout: string, + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + body: object +}) ---- link:{ref}/indices-put-mapping.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. +|`string \| string[]` - A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. |`type` |`string` - The name of the document type @@ -2345,7 +2947,7 @@ link:{ref}/indices-put-mapping.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`body` @@ -2354,15 +2956,25 @@ _Default:_ `open` |=== === indices.putSettings -[source,js] ----- -client.indices.putSettings([params] [, options] [, callback]) +[source,ts] +---- +client.indices.putSettings({ + index: string | string[], + master_timeout: string, + timeout: string, + preserve_existing: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + flat_settings: boolean, + body: object +}) ---- link:{ref}/indices-update-settings.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`master_timeout` or `masterTimeout` |`string` - Specify timeout for connection to master @@ -2380,7 +2992,7 @@ link:{ref}/indices-update-settings.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`flat_settings` or `flatSettings` @@ -2392,9 +3004,18 @@ _Default:_ `open` |=== === indices.putTemplate -[source,js] ----- -client.indices.putTemplate([params] [, options] [, callback]) +[source,ts] +---- +client.indices.putTemplate({ + name: string, + include_type_name: boolean, + order: number, + create: boolean, + timeout: string, + master_timeout: string, + flat_settings: boolean, + body: object +}) ---- link:{ref}/indices-templates.html[Reference] [cols=2*] @@ -2426,15 +3047,19 @@ link:{ref}/indices-templates.html[Reference] |=== === indices.recovery -[source,js] +[source,ts] ---- -client.indices.recovery([params] [, options] [, callback]) +client.indices.recovery({ + index: string | string[], + detailed: boolean, + active_only: boolean +}) ---- link:{ref}/indices-recovery.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`detailed` |`boolean` - Whether to display detailed information about shard recovery @@ -2445,15 +3070,20 @@ link:{ref}/indices-recovery.html[Reference] |=== === indices.refresh -[source,js] +[source,ts] ---- -client.indices.refresh([params] [, options] [, callback]) +client.indices.refresh({ + index: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-refresh.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -2462,15 +3092,24 @@ link:{ref}/indices-refresh.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === indices.rollover -[source,js] ----- -client.indices.rollover([params] [, options] [, callback]) +[source,ts] +---- +client.indices.rollover({ + alias: string, + new_index: string, + include_type_name: boolean, + timeout: string, + dry_run: boolean, + master_timeout: string, + wait_for_active_shards: string, + body: object +}) ---- link:{ref}/indices-rollover-index.html[Reference] [cols=2*] @@ -2502,15 +3141,21 @@ link:{ref}/indices-rollover-index.html[Reference] |=== === indices.segments -[source,js] +[source,ts] ---- -client.indices.segments([params] [, options] [, callback]) +client.indices.segments({ + index: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + verbose: boolean +}) ---- link:{ref}/indices-segments.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -2519,7 +3164,7 @@ link:{ref}/indices-segments.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`verbose` @@ -2528,18 +3173,24 @@ _Default:_ `open` |=== === indices.shardStores -[source,js] +[source,ts] ---- -client.indices.shardStores([params] [, options] [, callback]) +client.indices.shardStores({ + index: string | string[], + status: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-shards-stores.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`status` -|`string, string[]` - A comma-separated list of statuses used to filter on shards to get store information for +|`string \| string[]` - A comma-separated list of statuses used to filter on shards to get store information for |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -2548,15 +3199,22 @@ link:{ref}/indices-shards-stores.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === indices.shrink -[source,js] +[source,ts] ---- -client.indices.shrink([params] [, options] [, callback]) +client.indices.shrink({ + index: string, + target: string, + timeout: string, + master_timeout: string, + wait_for_active_shards: string, + body: object +}) ---- link:{ref}/indices-shrink-index.html[Reference] [cols=2*] @@ -2585,9 +3243,16 @@ link:{ref}/indices-shrink-index.html[Reference] |=== === indices.split -[source,js] +[source,ts] ---- -client.indices.split([params] [, options] [, callback]) +client.indices.split({ + index: string, + target: string, + timeout: string, + master_timeout: string, + wait_for_active_shards: string, + body: object +}) ---- link:{ref}/indices-split-index.html[Reference] [cols=2*] @@ -2616,37 +3281,50 @@ link:{ref}/indices-split-index.html[Reference] |=== === indices.stats -[source,js] ----- -client.indices.stats([params] [, options] [, callback]) +[source,ts] +---- +client.indices.stats({ + index: string | string[], + metric: string | string[], + completion_fields: string | string[], + fielddata_fields: string | string[], + fields: string | string[], + groups: string | string[], + level: 'cluster' | 'indices' | 'shards', + types: string | string[], + include_segment_file_sizes: boolean, + include_unloaded_segments: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + forbid_closed_indices: boolean +}) ---- link:{ref}/indices-stats.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`metric` -|`string, string[]` - Limit the information returned the specific metrics. +|`string \| string[]` - Limit the information returned the specific metrics. |`completion_fields` or `completionFields` -|`string, string[]` - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) +|`string \| string[]` - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) |`fielddata_fields` or `fielddataFields` -|`string, string[]` - A comma-separated list of fields for `fielddata` index metric (supports wildcards) +|`string \| string[]` - A comma-separated list of fields for `fielddata` index metric (supports wildcards) |`fields` -|`string, string[]` - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) +|`string \| string[]` - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) |`groups` -|`string, string[]` - A comma-separated list of search groups for `search` index metric +|`string \| string[]` - A comma-separated list of search groups for `search` index metric |`level` -|`'cluster', 'indices', 'shards'` - Return stats aggregated at cluster, index or shard level + +|`'cluster' \| 'indices' \| 'shards'` - Return stats aggregated at cluster, index or shard level + _Default:_ `indices` |`types` -|`string, string[]` - A comma-separated list of document types for the `indexing` index metric +|`string \| string[]` - A comma-separated list of document types for the `indexing` index metric |`include_segment_file_sizes` or `includeSegmentFileSizes` |`boolean` - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) @@ -2655,7 +3333,7 @@ _Default:_ `indices` |`boolean` - If set to true segment stats will include stats for segments that are not currently loaded into memory |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`forbid_closed_indices` or `forbidClosedIndices` @@ -2665,9 +3343,13 @@ _Default:_ `true` |=== === indices.updateAliases -[source,js] +[source,ts] ---- -client.indices.updateAliases([params] [, options] [, callback]) +client.indices.updateAliases({ + timeout: string, + master_timeout: string, + body: object +}) ---- link:{ref}/indices-aliases.html[Reference] [cols=2*] @@ -2684,21 +3366,28 @@ link:{ref}/indices-aliases.html[Reference] |=== === indices.upgrade -[source,js] +[source,ts] ---- -client.indices.upgrade([params] [, options] [, callback]) +client.indices.upgrade({ + index: string | string[], + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + ignore_unavailable: boolean, + wait_for_completion: boolean, + only_ancient_segments: boolean +}) ---- link:{ref}/indices-upgrade.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |`allow_no_indices` or `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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`ignore_unavailable` or `ignoreUnavailable` @@ -2713,18 +3402,34 @@ _Default:_ `open` |=== === indices.validateQuery -[source,js] ----- -client.indices.validateQuery([params] [, options] [, callback]) +[source,ts] +---- +client.indices.validateQuery({ + index: string | string[], + type: string | string[], + explain: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + q: string, + analyzer: string, + analyze_wildcard: boolean, + default_operator: 'AND' | 'OR', + df: string, + lenient: boolean, + rewrite: boolean, + all_shards: boolean, + body: object +}) ---- link:{ref}/search-validate.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices |`type` -|`string, string[]` - A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types +|`string \| string[]` - A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types |`explain` |`boolean` - Return detailed information about the error @@ -2736,7 +3441,7 @@ link:{ref}/search-validate.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`q` @@ -2749,7 +3454,7 @@ _Default:_ `open` |`boolean` - Specify whether wildcard and prefix queries should be analyzed (default: false) |`default_operator` or `defaultOperator` -|`'AND', 'OR'` - The default operator for query string query (AND or OR) + +|`'AND' \| 'OR'` - The default operator for query string query (AND or OR) + _Default:_ `OR` |`df` @@ -2770,17 +3475,21 @@ _Default:_ `OR` |=== === info -[source,js] +[source,ts] ---- -client.info([params] [, options] [, callback]) +client.info() ---- link:http://www.elastic.co/guide/[Reference] === ingest.deletePipeline -[source,js] +[source,ts] ---- -client.ingest.deletePipeline([params] [, options] [, callback]) +client.ingest.deletePipeline({ + id: string, + master_timeout: string, + timeout: string +}) ---- link:{ref}/delete-pipeline-api.html[Reference] [cols=2*] @@ -2797,9 +3506,12 @@ link:{ref}/delete-pipeline-api.html[Reference] |=== === ingest.getPipeline -[source,js] +[source,ts] ---- -client.ingest.getPipeline([params] [, options] [, callback]) +client.ingest.getPipeline({ + id: string, + master_timeout: string +}) ---- link:{ref}/get-pipeline-api.html[Reference] [cols=2*] @@ -2813,17 +3525,22 @@ link:{ref}/get-pipeline-api.html[Reference] |=== === ingest.processorGrok -[source,js] +[source,ts] ---- -client.ingest.processorGrok([params] [, options] [, callback]) +client.ingest.processorGrok() ---- link:{ref}/grok-processor.html#grok-processor-rest-get[Reference] === ingest.putPipeline -[source,js] +[source,ts] ---- -client.ingest.putPipeline([params] [, options] [, callback]) +client.ingest.putPipeline({ + id: string, + master_timeout: string, + timeout: string, + body: object +}) ---- link:{ref}/put-pipeline-api.html[Reference] [cols=2*] @@ -2843,9 +3560,13 @@ link:{ref}/put-pipeline-api.html[Reference] |=== === ingest.simulate -[source,js] +[source,ts] ---- -client.ingest.simulate([params] [, options] [, callback]) +client.ingest.simulate({ + id: string, + verbose: boolean, + body: object +}) ---- link:{ref}/simulate-pipeline-api.html[Reference] [cols=2*] @@ -2862,9 +3583,21 @@ link:{ref}/simulate-pipeline-api.html[Reference] |=== === mget -[source,js] ----- -client.mget([params] [, options] [, callback]) +[source,ts] +---- +client.mget({ + index: string, + type: string, + stored_fields: string | string[], + preference: string, + realtime: boolean, + refresh: boolean, + routing: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + body: object +}) ---- link:{ref}/docs-multi-get.html[Reference] [cols=2*] @@ -2876,7 +3609,7 @@ link:{ref}/docs-multi-get.html[Reference] |`string` - The type of the document |`stored_fields` or `storedFields` -|`string, string[]` - A comma-separated list of stored fields to return in the response +|`string \| string[]` - A comma-separated list of stored fields to return in the response |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -2891,13 +3624,13 @@ link:{ref}/docs-multi-get.html[Reference] |`string` - Specific routing value |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`body` |`object` - Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. @@ -2905,21 +3638,31 @@ link:{ref}/docs-multi-get.html[Reference] |=== === msearch -[source,js] ----- -client.msearch([params] [, options] [, callback]) +[source,ts] +---- +client.msearch({ + index: string | string[], + search_type: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch', + max_concurrent_searches: number, + typed_keys: boolean, + pre_filter_shard_size: number, + max_concurrent_shard_requests: number, + rest_total_hits_as_int: boolean, + ccs_minimize_roundtrips: boolean, + body: object +}) ---- link:{ref}/search-multi-search.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to use as default +|`string \| string[]` - A comma-separated list of index names to use as default |`type` |`string, string[]` - A comma-separated list of document types to use as default |`search_type` or `searchType` -|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type +|`'query_then_fetch' \| 'query_and_fetch' \| 'dfs_query_then_fetch' \| 'dfs_query_and_fetch'` - Search operation type |`max_concurrent_searches` or `maxConcurrentSearches` |`number` - Controls the maximum number of concurrent searches the multi search api will execute @@ -2948,21 +3691,29 @@ _Default:_ `true` |=== === msearchTemplate -[source,js] ----- -client.msearchTemplate([params] [, options] [, callback]) +[source,ts] +---- +client.msearchTemplate({ + index: string | string[], + search_type: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch', + typed_keys: boolean, + max_concurrent_searches: number, + rest_total_hits_as_int: boolean, + ccs_minimize_roundtrips: boolean, + body: object +}) ---- link:{ref}/search-multi-search.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to use as default +|`string \| string[]` - A comma-separated list of index names to use as default |`type` |`string, string[]` - A comma-separated list of document types to use as default |`search_type` or `searchType` -|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type +|`'query_then_fetch' \| 'query_and_fetch' \| 'dfs_query_then_fetch' \| 'dfs_query_and_fetch'` - Search operation type |`typed_keys` or `typedKeys` |`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response @@ -2983,9 +3734,24 @@ _Default:_ `true` |=== === mtermvectors -[source,js] ----- -client.mtermvectors([params] [, options] [, callback]) +[source,ts] +---- +client.mtermvectors({ + index: string, + ids: string | string[], + term_statistics: boolean, + field_statistics: boolean, + fields: string | string[], + offsets: boolean, + positions: boolean, + payloads: boolean, + preference: string, + routing: string, + realtime: boolean, + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force', + body: object +}) ---- link:{ref}/docs-multi-termvectors.html[Reference] [cols=2*] @@ -2997,7 +3763,7 @@ link:{ref}/docs-multi-termvectors.html[Reference] |`string` - The type of the document. |`ids` -|`string, string[]` - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body +|`string \| string[]` - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body |`term_statistics` or `termStatistics` |`boolean` - Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". @@ -3007,7 +3773,7 @@ link:{ref}/docs-multi-termvectors.html[Reference] _Default:_ `true` |`fields` -|`string, string[]` - A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". +|`string \| string[]` - A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". |`offsets` |`boolean` - Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + @@ -3034,7 +3800,7 @@ _Default:_ `true` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |`body` |`object` - Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. @@ -3042,15 +3808,23 @@ _Default:_ `true` |=== === nodes.hotThreads -[source,js] ----- -client.nodes.hotThreads([params] [, options] [, callback]) +[source,ts] +---- +client.nodes.hotThreads({ + node_id: string | string[], + interval: string, + snapshots: number, + threads: number, + ignore_idle_threads: boolean, + type: 'cpu' | 'wait' | 'block', + timeout: string +}) ---- link:{ref}/cluster-nodes-hot-threads.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`interval` |`string` - The interval for the second sampling of threads @@ -3065,7 +3839,7 @@ link:{ref}/cluster-nodes-hot-threads.html[Reference] |`boolean` - Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) |`type` -|`'cpu', 'wait', 'block'` - The type to sample (default: cpu) +|`'cpu' \| 'wait' \| 'block'` - The type to sample (default: cpu) |`timeout` |`string` - Explicit operation timeout @@ -3073,18 +3847,23 @@ link:{ref}/cluster-nodes-hot-threads.html[Reference] |=== === nodes.info -[source,js] +[source,ts] ---- -client.nodes.info([params] [, options] [, callback]) +client.nodes.info({ + node_id: string | string[], + metric: string | string[], + flat_settings: boolean, + timeout: string +}) ---- link:{ref}/cluster-nodes-info.html[Reference] [cols=2*] |=== |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`metric` -|`string, string[]` - A comma-separated list of metrics you wish returned. Leave empty to return all. +|`string \| string[]` - A comma-separated list of metrics you wish returned. Leave empty to return all. |`flat_settings` or `flatSettings` |`boolean` - Return settings in flat format (default: false) @@ -3095,15 +3874,18 @@ link:{ref}/cluster-nodes-info.html[Reference] |=== === nodes.reloadSecureSettings -[source,js] +[source,ts] ---- -client.nodes.reloadSecureSettings([params] [, options] [, callback]) +client.nodes.reloadSecureSettings({ + node_id: string | string[], + timeout: string +}) ---- link:{ref}/secure-settings.html#reloadable-secure-settings[Reference] [cols=2*] |=== |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. +|`string \| string[]` - A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. |`timeout` |`string` - Explicit operation timeout @@ -3111,40 +3893,52 @@ link:{ref}/secure-settings.html#reloadable-secure-settings[Reference] |=== === nodes.stats -[source,js] ----- -client.nodes.stats([params] [, options] [, callback]) +[source,ts] +---- +client.nodes.stats({ + metric: string | string[], + index_metric: string | string[], + node_id: string | string[], + completion_fields: string | string[], + fielddata_fields: string | string[], + fields: string | string[], + groups: boolean, + level: 'indices' | 'node' | 'shards', + types: string | string[], + timeout: string, + include_segment_file_sizes: boolean +}) ---- link:{ref}/cluster-nodes-stats.html[Reference] [cols=2*] |=== |`metric` -|`string, string[]` - Limit the information returned to the specified metrics +|`string \| string[]` - Limit the information returned to the specified metrics |`index_metric` or `indexMetric` -|`string, string[]` - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. +|`string \| string[]` - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`completion_fields` or `completionFields` -|`string, string[]` - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) +|`string \| string[]` - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) |`fielddata_fields` or `fielddataFields` -|`string, string[]` - A comma-separated list of fields for `fielddata` index metric (supports wildcards) +|`string \| string[]` - A comma-separated list of fields for `fielddata` index metric (supports wildcards) |`fields` -|`string, string[]` - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) +|`string \| string[]` - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) |`groups` |`boolean` - A comma-separated list of search groups for `search` index metric |`level` -|`'indices', 'node', 'shards'` - Return indices stats aggregated at index, node or shard level + +|`'indices' \| 'node' \| 'shards'` - Return indices stats aggregated at index, node or shard level + _Default:_ `node` |`types` -|`string, string[]` - A comma-separated list of document types for the `indexing` index metric +|`string \| string[]` - A comma-separated list of document types for the `indexing` index metric |`timeout` |`string` - Explicit operation timeout @@ -3155,18 +3949,22 @@ _Default:_ `node` |=== === nodes.usage -[source,js] +[source,ts] ---- -client.nodes.usage([params] [, options] [, callback]) +client.nodes.usage({ + metric: string | string[], + node_id: string | string[], + timeout: string +}) ---- link:{ref}/cluster-nodes-usage.html[Reference] [cols=2*] |=== |`metric` -|`string, string[]` - Limit the information returned to the specified metrics +|`string \| string[]` - Limit the information returned to the specified metrics |`node_id` or `nodeId` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`timeout` |`string` - Explicit operation timeout @@ -3174,17 +3972,24 @@ link:{ref}/cluster-nodes-usage.html[Reference] |=== === ping -[source,js] +[source,ts] ---- -client.ping([params] [, options] [, callback]) +client.ping() ---- link:http://www.elastic.co/guide/[Reference] === putScript -[source,js] +[source,ts] ---- -client.putScript([params] [, options] [, callback]) +client.putScript({ + id: string, + context: string, + timeout: string, + master_timeout: string, + context: string, + body: object +}) ---- link:{ref}/modules-scripting.html[Reference] [cols=2*] @@ -3210,15 +4015,21 @@ link:{ref}/modules-scripting.html[Reference] |=== === rankEval -[source,js] +[source,ts] ---- -client.rankEval([params] [, options] [, callback]) +client.rankEval({ + index: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + body: object +}) ---- link:{ref}/search-rank-eval.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -3227,7 +4038,7 @@ link:{ref}/search-rank-eval.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`body` @@ -3236,9 +4047,19 @@ _Default:_ `open` |=== === reindex -[source,js] ----- -client.reindex([params] [, options] [, callback]) +[source,ts] +---- +client.reindex({ + refresh: boolean, + timeout: string, + wait_for_active_shards: string, + wait_for_completion: boolean, + requests_per_second: number, + scroll: string, + slices: number, + max_docs: number, + body: object +}) ---- link:{ref}/docs-reindex.html[Reference] [cols=2*] @@ -3277,9 +4098,12 @@ _Default:_ `1` |=== === reindexRethrottle -[source,js] +[source,ts] ---- -client.reindexRethrottle([params] [, options] [, callback]) +client.reindexRethrottle({ + task_id: string, + requests_per_second: number +}) ---- link:{ref}/docs-reindex.html[Reference] [cols=2*] @@ -3293,9 +4117,12 @@ link:{ref}/docs-reindex.html[Reference] |=== === renderSearchTemplate -[source,js] +[source,ts] ---- -client.renderSearchTemplate([params] [, options] [, callback]) +client.renderSearchTemplate({ + id: string, + body: object +}) ---- link:{ref}/search-template.html[Reference] [cols=2*] @@ -3309,9 +4136,11 @@ link:{ref}/search-template.html[Reference] |=== === scriptsPainlessExecute -[source,js] +[source,ts] ---- -client.scriptsPainlessExecute([params] [, options] [, callback]) +client.scriptsPainlessExecute({ + body: object +}) ---- link:https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html[Reference] [cols=2*] @@ -3322,9 +4151,15 @@ link:https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-exec |=== === scroll -[source,js] +[source,ts] ---- -client.scroll([params] [, options] [, callback]) +client.scroll({ + scroll_id: string, + scroll: string, + scroll_id: string, + rest_total_hits_as_int: boolean, + body: object +}) ---- link:{ref}/search-request-body.html#request-body-search-scroll[Reference] [cols=2*] @@ -3347,15 +4182,60 @@ link:{ref}/search-request-body.html#request-body-search-scroll[Reference] |=== === search -[source,js] ----- -client.search([params] [, options] [, callback]) +[source,ts] +---- +client.search({ + index: string | string[], + analyzer: string, + analyze_wildcard: boolean, + ccs_minimize_roundtrips: boolean, + default_operator: 'AND' | 'OR', + df: string, + explain: boolean, + stored_fields: string | string[], + docvalue_fields: string | string[], + from: number, + ignore_unavailable: boolean, + ignore_throttled: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + lenient: boolean, + preference: string, + q: string, + routing: string | string[], + scroll: string, + search_type: 'query_then_fetch' | 'dfs_query_then_fetch', + size: number, + sort: string | string[], + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + terminate_after: number, + stats: string | string[], + suggest_field: string, + suggest_mode: 'missing' | 'popular' | 'always', + suggest_size: number, + suggest_text: string, + timeout: string, + track_scores: boolean, + track_total_hits: boolean, + allow_partial_search_results: boolean, + typed_keys: boolean, + version: boolean, + seq_no_primary_term: boolean, + request_cache: boolean, + batched_reduce_size: number, + max_concurrent_shard_requests: number, + pre_filter_shard_size: number, + rest_total_hits_as_int: boolean, + body: object +}) ---- link:{ref}/search-search.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` |`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -3371,7 +4251,7 @@ link:{ref}/search-search.html[Reference] _Default:_ `true` |`default_operator` or `defaultOperator` -|`'AND', 'OR'` - The default operator for query string query (AND or OR) + +|`'AND' \| 'OR'` - The default operator for query string query (AND or OR) + _Default:_ `OR` |`df` @@ -3381,10 +4261,10 @@ _Default:_ `OR` |`boolean` - Specify whether to return detailed information about score computation as part of a hit |`stored_fields` or `storedFields` -|`string, string[]` - A comma-separated list of stored fields to return as part of a hit +|`string \| string[]` - A comma-separated list of stored fields to return as part of a hit |`docvalue_fields` or `docvalueFields` -|`string, string[]` - A comma-separated list of fields to return as the docvalue representation of a field for each hit +|`string \| string[]` - A comma-separated list of fields to return as the docvalue representation of a field for each hit |`from` |`number` - Starting offset (default: 0) @@ -3399,7 +4279,7 @@ _Default:_ `OR` |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`lenient` @@ -3412,40 +4292,40 @@ _Default:_ `open` |`string` - Query in the Lucene query string syntax |`routing` -|`string, string[]` - A comma-separated list of specific routing values +|`string \| string[]` - A comma-separated list of specific routing values |`scroll` |`string` - Specify how long a consistent view of the index should be maintained for scrolled search |`search_type` or `searchType` -|`'query_then_fetch', 'dfs_query_then_fetch'` - Search operation type +|`'query_then_fetch' \| 'dfs_query_then_fetch'` - Search operation type |`size` |`number` - Number of hits to return (default: 10) |`sort` -|`string, string[]` - A comma-separated list of : pairs +|`string \| string[]` - A comma-separated list of : pairs |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`terminate_after` or `terminateAfter` |`number` - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |`stats` -|`string, string[]` - Specific 'tag' of the request for logging and statistical purposes +|`string \| string[]` - Specific 'tag' of the request for logging and statistical purposes |`suggest_field` or `suggestField` |`string` - Specify which field to use for suggestions |`suggest_mode` or `suggestMode` -|`'missing', 'popular', 'always'` - Specify suggest mode + +|`'missing' \| 'popular' \| 'always'` - Specify suggest mode + _Default:_ `missing` |`suggest_size` or `suggestSize` @@ -3500,15 +4380,23 @@ _Default:_ `128` |=== === searchShards -[source,js] ----- -client.searchShards([params] [, options] [, callback]) +[source,ts] +---- +client.searchShards({ + index: string | string[], + preference: string, + routing: string, + local: boolean, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/search-shards.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) @@ -3526,21 +4414,37 @@ link:{ref}/search-shards.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === searchTemplate -[source,js] ----- -client.searchTemplate([params] [, options] [, callback]) +[source,ts] +---- +client.searchTemplate({ + index: string | string[], + ignore_unavailable: boolean, + ignore_throttled: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + preference: string, + routing: string | string[], + scroll: string, + search_type: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch', + explain: boolean, + profile: boolean, + typed_keys: boolean, + rest_total_hits_as_int: boolean, + ccs_minimize_roundtrips: boolean, + body: object +}) ---- link:{ref}/search-template.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` |`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -3555,20 +4459,20 @@ link:{ref}/search-template.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`preference` |`string` - Specify the node or shard the operation should be performed on (default: random) |`routing` -|`string, string[]` - A comma-separated list of specific routing values +|`string \| string[]` - A comma-separated list of specific routing values |`scroll` |`string` - Specify how long a consistent view of the index should be maintained for scrolled search |`search_type` or `searchType` -|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type +|`'query_then_fetch' \| 'query_and_fetch' \| 'dfs_query_then_fetch' \| 'dfs_query_and_fetch'` - Search operation type |`explain` |`boolean` - Specify whether to return detailed information about score computation as part of a hit @@ -3592,9 +4496,15 @@ _Default:_ `true` |=== === snapshot.create -[source,js] +[source,ts] ---- -client.snapshot.create([params] [, options] [, callback]) +client.snapshot.create({ + repository: string, + snapshot: string, + master_timeout: string, + wait_for_completion: boolean, + body: object +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3617,9 +4527,15 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.createRepository -[source,js] +[source,ts] ---- -client.snapshot.createRepository([params] [, options] [, callback]) +client.snapshot.createRepository({ + repository: string, + master_timeout: string, + timeout: string, + verify: boolean, + body: object +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3642,9 +4558,13 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.delete -[source,js] +[source,ts] ---- -client.snapshot.delete([params] [, options] [, callback]) +client.snapshot.delete({ + repository: string, + snapshot: string, + master_timeout: string +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3661,15 +4581,19 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.deleteRepository -[source,js] +[source,ts] ---- -client.snapshot.deleteRepository([params] [, options] [, callback]) +client.snapshot.deleteRepository({ + repository: string | string[], + master_timeout: string, + timeout: string +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` -|`string, string[]` - A comma-separated list of repository names +|`string \| string[]` - A comma-separated list of repository names |`master_timeout` or `masterTimeout` |`string` - Explicit operation timeout for connection to master node @@ -3680,9 +4604,15 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.get -[source,js] +[source,ts] ---- -client.snapshot.get([params] [, options] [, callback]) +client.snapshot.get({ + repository: string, + snapshot: string | string[], + master_timeout: string, + ignore_unavailable: boolean, + verbose: boolean +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3691,7 +4621,7 @@ link:{ref}/modules-snapshots.html[Reference] |`string` - A repository name |`snapshot` -|`string, string[]` - A comma-separated list of snapshot names +|`string \| string[]` - A comma-separated list of snapshot names |`master_timeout` or `masterTimeout` |`string` - Explicit operation timeout for connection to master node @@ -3705,15 +4635,19 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.getRepository -[source,js] +[source,ts] ---- -client.snapshot.getRepository([params] [, options] [, callback]) +client.snapshot.getRepository({ + repository: string | string[], + master_timeout: string, + local: boolean +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] |=== |`repository` -|`string, string[]` - A comma-separated list of repository names +|`string \| string[]` - A comma-separated list of repository names |`master_timeout` or `masterTimeout` |`string` - Explicit operation timeout for connection to master node @@ -3724,9 +4658,15 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.restore -[source,js] +[source,ts] ---- -client.snapshot.restore([params] [, options] [, callback]) +client.snapshot.restore({ + repository: string, + snapshot: string, + master_timeout: string, + wait_for_completion: boolean, + body: object +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3749,9 +4689,14 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.status -[source,js] +[source,ts] ---- -client.snapshot.status([params] [, options] [, callback]) +client.snapshot.status({ + repository: string, + snapshot: string | string[], + master_timeout: string, + ignore_unavailable: boolean +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3760,7 +4705,7 @@ link:{ref}/modules-snapshots.html[Reference] |`string` - A repository name |`snapshot` -|`string, string[]` - A comma-separated list of snapshot names +|`string \| string[]` - A comma-separated list of snapshot names |`master_timeout` or `masterTimeout` |`string` - Explicit operation timeout for connection to master node @@ -3771,9 +4716,13 @@ link:{ref}/modules-snapshots.html[Reference] |=== === snapshot.verifyRepository -[source,js] +[source,ts] ---- -client.snapshot.verifyRepository([params] [, options] [, callback]) +client.snapshot.verifyRepository({ + repository: string, + master_timeout: string, + timeout: string +}) ---- link:{ref}/modules-snapshots.html[Reference] [cols=2*] @@ -3790,9 +4739,14 @@ link:{ref}/modules-snapshots.html[Reference] |=== === tasks.cancel -[source,js] +[source,ts] ---- -client.tasks.cancel([params] [, options] [, callback]) +client.tasks.cancel({ + task_id: string, + nodes: string | string[], + actions: string | string[], + parent_task_id: string +}) ---- link:{ref}/tasks.html[Reference] [cols=2*] @@ -3801,10 +4755,10 @@ link:{ref}/tasks.html[Reference] |`string` - Cancel the task with specified task id (node_id:task_number) |`nodes` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`actions` -|`string, string[]` - A comma-separated list of actions that should be cancelled. Leave empty to cancel all. +|`string \| string[]` - A comma-separated list of actions that should be cancelled. Leave empty to cancel all. |`parent_task_id` or `parentTaskId` |`string` - Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. @@ -3812,9 +4766,13 @@ link:{ref}/tasks.html[Reference] |=== === tasks.get -[source,js] +[source,ts] ---- -client.tasks.get([params] [, options] [, callback]) +client.tasks.get({ + task_id: string, + wait_for_completion: boolean, + timeout: string +}) ---- link:{ref}/tasks.html[Reference] [cols=2*] @@ -3831,18 +4789,26 @@ link:{ref}/tasks.html[Reference] |=== === tasks.list -[source,js] ----- -client.tasks.list([params] [, options] [, callback]) +[source,ts] +---- +client.tasks.list({ + nodes: string | string[], + actions: string | string[], + detailed: boolean, + parent_task_id: string, + wait_for_completion: boolean, + group_by: 'nodes' | 'parents' | 'none', + timeout: string +}) ---- link:{ref}/tasks.html[Reference] [cols=2*] |=== |`nodes` -|`string, string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |`actions` -|`string, string[]` - A comma-separated list of actions that should be returned. Leave empty to return all. +|`string \| string[]` - A comma-separated list of actions that should be returned. Leave empty to return all. |`detailed` |`boolean` - Return detailed task information (default: false) @@ -3854,7 +4820,7 @@ link:{ref}/tasks.html[Reference] |`boolean` - Wait for the matching tasks to complete (default: false) |`group_by` or `groupBy` -|`'nodes', 'parents', 'none'` - Group tasks by nodes or parent/child relationships + +|`'nodes' \| 'parents' \| 'none'` - Group tasks by nodes or parent/child relationships + _Default:_ `nodes` |`timeout` @@ -3863,9 +4829,24 @@ _Default:_ `nodes` |=== === termvectors -[source,js] ----- -client.termvectors([params] [, options] [, callback]) +[source,ts] +---- +client.termvectors({ + index: string, + id: string, + term_statistics: boolean, + field_statistics: boolean, + fields: string | string[], + offsets: boolean, + positions: boolean, + payloads: boolean, + preference: string, + routing: string, + realtime: boolean, + version: number, + version_type: 'internal' | 'external' | 'external_gte' | 'force', + body: object +}) ---- link:{ref}/docs-termvectors.html[Reference] [cols=2*] @@ -3887,7 +4868,7 @@ link:{ref}/docs-termvectors.html[Reference] _Default:_ `true` |`fields` -|`string, string[]` - A comma-separated list of fields to return. +|`string \| string[]` - A comma-separated list of fields to return. |`offsets` |`boolean` - Specifies if term offsets should be returned. + @@ -3914,7 +4895,7 @@ _Default:_ `true` |`number` - Explicit version number for concurrency control |`version_type` or `versionType` -|`'internal', 'external', 'external_gte', 'force'` - Specific version type +|`'internal' \| 'external' \| 'external_gte' \| 'force'` - Specific version type |`body` |`object` - Define parameters and or supply a document to get termvectors for. See documentation. @@ -3922,9 +4903,25 @@ _Default:_ `true` |=== === update -[source,js] ----- -client.update([params] [, options] [, callback]) +[source,ts] +---- +client.update({ + id: string, + index: string, + type: string, + wait_for_active_shards: string, + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + lang: string, + refresh: 'true' | 'false' | 'wait_for', + retry_on_conflict: number, + routing: string, + timeout: string, + if_seq_no: number, + if_primary_term: number, + body: object +}) ---- link:{ref}/docs-update.html[Reference] [cols=2*] @@ -3942,19 +4939,19 @@ link:{ref}/docs-update.html[Reference] |`string` - Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`lang` |`string` - The script language (default: painless) |`refresh` -|`'true', 'false', 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |`retry_on_conflict` or `retryOnConflict` |`number` - Specify how many times should the operation be retried when a conflict occurs (default: 0) @@ -3977,15 +4974,52 @@ link:{ref}/docs-update.html[Reference] |=== === updateByQuery -[source,js] ----- -client.updateByQuery([params] [, options] [, callback]) +[source,ts] +---- +client.updateByQuery({ + index: string | string[], + analyzer: string, + analyze_wildcard: boolean, + default_operator: 'AND' | 'OR', + df: string, + from: number, + ignore_unavailable: boolean, + allow_no_indices: boolean, + conflicts: 'abort' | 'proceed', + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + lenient: boolean, + pipeline: string, + preference: string, + q: string, + routing: string | string[], + scroll: string, + search_type: 'query_then_fetch' | 'dfs_query_then_fetch', + search_timeout: string, + max_docs: number, + sort: string | string[], + _source: string | string[], + _source_excludes: string | string[], + _source_includes: string | string[], + terminate_after: number, + stats: string | string[], + version: boolean, + version_type: boolean, + request_cache: boolean, + refresh: boolean, + timeout: string, + wait_for_active_shards: string, + scroll_size: number, + wait_for_completion: boolean, + requests_per_second: number, + slices: number, + body: object +}) ---- link:{ref}/docs-update-by-query.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` |`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -3997,7 +5031,7 @@ link:{ref}/docs-update-by-query.html[Reference] |`boolean` - Specify whether wildcard and prefix queries should be analyzed (default: false) |`default_operator` or `defaultOperator` -|`'AND', 'OR'` - The default operator for query string query (AND or OR) + +|`'AND' \| 'OR'` - The default operator for query string query (AND or OR) + _Default:_ `OR` |`df` @@ -4013,11 +5047,11 @@ _Default:_ `OR` |`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) |`conflicts` -|`'abort', 'proceed'` - What to do when the update by query hits version conflicts? + +|`'abort' \| 'proceed'` - What to do when the update by query hits version conflicts? + _Default:_ `abort` |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |`lenient` @@ -4033,13 +5067,13 @@ _Default:_ `open` |`string` - Query in the Lucene query string syntax |`routing` -|`string, string[]` - A comma-separated list of specific routing values +|`string \| string[]` - A comma-separated list of specific routing values |`scroll` |`string` - Specify how long a consistent view of the index should be maintained for scrolled search |`search_type` or `searchType` -|`'query_then_fetch', 'dfs_query_then_fetch'` - Search operation type +|`'query_then_fetch' \| 'dfs_query_then_fetch'` - Search operation type |`search_timeout` or `searchTimeout` |`string` - Explicit timeout for each search request. Defaults to no timeout. @@ -4051,22 +5085,22 @@ _Default:_ `open` |`number` - Maximum number of documents to process (default: all documents) |`sort` -|`string, string[]` - A comma-separated list of : pairs +|`string \| string[]` - A comma-separated list of : pairs |`_source` -|`string, string[]` - True or false to return the _source field or not, or a list of fields to return +|`string \| string[]` - True or false to return the _source field or not, or a list of fields to return |`_source_excludes` or `_sourceExcludes` -|`string, string[]` - A list of fields to exclude from the returned _source field +|`string \| string[]` - A list of fields to exclude from the returned _source field |`_source_includes` or `_sourceIncludes` -|`string, string[]` - A list of fields to extract and return from the _source field +|`string \| string[]` - A list of fields to extract and return from the _source field |`terminate_after` or `terminateAfter` |`number` - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |`stats` -|`string, string[]` - Specific 'tag' of the request for logging and statistical purposes +|`string \| string[]` - Specific 'tag' of the request for logging and statistical purposes |`version` |`boolean` - Specify whether to return document version as part of a hit @@ -4107,9 +5141,12 @@ _Default:_ `1` |=== === updateByQueryRethrottle -[source,js] +[source,ts] ---- -client.updateByQueryRethrottle([params] [, options] [, callback]) +client.updateByQueryRethrottle({ + task_id: string, + requests_per_second: number +}) ---- link:{ref}/docs-update-by-query.html[Reference] [cols=2*] @@ -4123,9 +5160,11 @@ link:{ref}/docs-update-by-query.html[Reference] |=== === ccr.deleteAutoFollowPattern -[source,js] +[source,ts] ---- -client.ccr.deleteAutoFollowPattern([params] [, options] [, callback]) +client.ccr.deleteAutoFollowPattern({ + name: string +}) ---- link:{ref}/ccr-delete-auto-follow-pattern.html[Reference] [cols=2*] @@ -4136,9 +5175,13 @@ link:{ref}/ccr-delete-auto-follow-pattern.html[Reference] |=== === ccr.follow -[source,js] +[source,ts] ---- -client.ccr.follow([params] [, options] [, callback]) +client.ccr.follow({ + index: string, + wait_for_active_shards: string, + body: object +}) ---- link:{ref}/ccr-put-follow.html[Reference] [cols=2*] @@ -4156,35 +5199,42 @@ _Default:_ `0` |=== === ccr.followInfo -[source,js] +[source,ts] ---- -client.ccr.followInfo([params] [, options] [, callback]) +client.ccr.followInfo({ + index: string | string[] +}) ---- link:{ref}/ccr-get-follow-info.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index patterns; use `_all` to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index patterns; use `_all` to perform the operation on all indices |=== === ccr.followStats -[source,js] +[source,ts] ---- -client.ccr.followStats([params] [, options] [, callback]) +client.ccr.followStats({ + index: string | string[] +}) ---- link:{ref}/ccr-get-follow-stats.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index patterns; use `_all` to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index patterns; use `_all` to perform the operation on all indices |=== === ccr.forgetFollower -[source,js] +[source,ts] ---- -client.ccr.forgetFollower([params] [, options] [, callback]) +client.ccr.forgetFollower({ + index: string, + body: object +}) ---- link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] [cols=2*] @@ -4198,9 +5248,11 @@ link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] |=== === ccr.getAutoFollowPattern -[source,js] +[source,ts] ---- -client.ccr.getAutoFollowPattern([params] [, options] [, callback]) +client.ccr.getAutoFollowPattern({ + name: string +}) ---- link:{ref}/ccr-get-auto-follow-pattern.html[Reference] [cols=2*] @@ -4211,9 +5263,11 @@ link:{ref}/ccr-get-auto-follow-pattern.html[Reference] |=== === ccr.pauseFollow -[source,js] +[source,ts] ---- -client.ccr.pauseFollow([params] [, options] [, callback]) +client.ccr.pauseFollow({ + index: string +}) ---- link:{ref}/ccr-post-pause-follow.html[Reference] [cols=2*] @@ -4224,9 +5278,12 @@ link:{ref}/ccr-post-pause-follow.html[Reference] |=== === ccr.putAutoFollowPattern -[source,js] +[source,ts] ---- -client.ccr.putAutoFollowPattern([params] [, options] [, callback]) +client.ccr.putAutoFollowPattern({ + name: string, + body: object +}) ---- link:{ref}/ccr-put-auto-follow-pattern.html[Reference] [cols=2*] @@ -4240,9 +5297,12 @@ link:{ref}/ccr-put-auto-follow-pattern.html[Reference] |=== === ccr.resumeFollow -[source,js] +[source,ts] ---- -client.ccr.resumeFollow([params] [, options] [, callback]) +client.ccr.resumeFollow({ + index: string, + body: object +}) ---- link:{ref}/ccr-post-resume-follow.html[Reference] [cols=2*] @@ -4256,17 +5316,19 @@ link:{ref}/ccr-post-resume-follow.html[Reference] |=== === ccr.stats -[source,js] +[source,ts] ---- -client.ccr.stats([params] [, options] [, callback]) +client.ccr.stats() ---- link:{ref}/ccr-get-stats.html[Reference] === ccr.unfollow -[source,js] +[source,ts] ---- -client.ccr.unfollow([params] [, options] [, callback]) +client.ccr.unfollow({ + index: string +}) ---- link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] [cols=2*] @@ -4277,9 +5339,12 @@ link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] |=== === dataFrame.deleteDataFrameTransform -[source,js] +[source,ts] ---- -client.dataFrame.deleteDataFrameTransform([params] [, options] [, callback]) +client.dataFrame.deleteDataFrameTransform({ + transform_id: string, + force: boolean +}) ---- link:{ref}/delete-data-frame-transform.html[Reference] [cols=2*] @@ -4287,12 +5352,20 @@ link:{ref}/delete-data-frame-transform.html[Reference] |`transform_id` or `transformId` |`string` - The id of the transform to delete +|`force` +|`boolean` - When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted. + |=== === dataFrame.getDataFrameTransform -[source,js] +[source,ts] ---- -client.dataFrame.getDataFrameTransform([params] [, options] [, callback]) +client.dataFrame.getDataFrameTransform({ + transform_id: string, + from: number, + size: number, + allow_no_match: boolean +}) ---- link:{ref}/get-data-frame-transform.html[Reference] [cols=2*] @@ -4312,9 +5385,14 @@ link:{ref}/get-data-frame-transform.html[Reference] |=== === dataFrame.getDataFrameTransformStats -[source,js] +[source,ts] ---- -client.dataFrame.getDataFrameTransformStats([params] [, options] [, callback]) +client.dataFrame.getDataFrameTransformStats({ + transform_id: string, + from: number, + size: number, + allow_no_match: boolean +}) ---- link:{ref}/get-data-frame-transform-stats.html[Reference] [cols=2*] @@ -4334,9 +5412,11 @@ link:{ref}/get-data-frame-transform-stats.html[Reference] |=== === dataFrame.previewDataFrameTransform -[source,js] +[source,ts] ---- -client.dataFrame.previewDataFrameTransform([params] [, options] [, callback]) +client.dataFrame.previewDataFrameTransform({ + body: object +}) ---- link:{ref}/preview-data-frame-transform.html[Reference] [cols=2*] @@ -4347,9 +5427,13 @@ link:{ref}/preview-data-frame-transform.html[Reference] |=== === dataFrame.putDataFrameTransform -[source,js] +[source,ts] ---- -client.dataFrame.putDataFrameTransform([params] [, options] [, callback]) +client.dataFrame.putDataFrameTransform({ + transform_id: string, + defer_validation: boolean, + body: object +}) ---- link:{ref}/put-data-frame-transform.html[Reference] [cols=2*] @@ -4357,15 +5441,21 @@ link:{ref}/put-data-frame-transform.html[Reference] |`transform_id` or `transformId` |`string` - The id of the new transform. +|`defer_validation` or `deferValidation` +|`boolean` - If validations should be deferred until data frame transform starts, defaults to false. + |`body` |`object` - The data frame transform definition |=== === dataFrame.startDataFrameTransform -[source,js] +[source,ts] ---- -client.dataFrame.startDataFrameTransform([params] [, options] [, callback]) +client.dataFrame.startDataFrameTransform({ + transform_id: string, + timeout: string +}) ---- link:{ref}/start-data-frame-transform.html[Reference] [cols=2*] @@ -4379,9 +5469,14 @@ link:{ref}/start-data-frame-transform.html[Reference] |=== === dataFrame.stopDataFrameTransform -[source,js] +[source,ts] ---- -client.dataFrame.stopDataFrameTransform([params] [, options] [, callback]) +client.dataFrame.stopDataFrameTransform({ + transform_id: string, + wait_for_completion: boolean, + timeout: string, + allow_no_match: boolean +}) ---- link:{ref}/stop-data-frame-transform.html[Reference] [cols=2*] @@ -4401,18 +5496,24 @@ link:{ref}/stop-data-frame-transform.html[Reference] |=== === graph.explore -[source,js] +[source,ts] ---- -client.graph.explore([params] [, options] [, callback]) +client.graph.explore({ + index: string | string[], + type: string | string[], + routing: string, + timeout: string, + body: object +}) ---- link:{ref}/graph-explore-api.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices +|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types +|`string \| string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types |`routing` |`string` - Specific routing value @@ -4426,9 +5527,11 @@ link:{ref}/graph-explore-api.html[Reference] |=== === ilm.deleteLifecycle -[source,js] +[source,ts] ---- -client.ilm.deleteLifecycle([params] [, options] [, callback]) +client.ilm.deleteLifecycle({ + policy: string +}) ---- link:{ref}/ilm-delete-lifecycle.html[Reference] [cols=2*] @@ -4439,9 +5542,11 @@ link:{ref}/ilm-delete-lifecycle.html[Reference] |=== === ilm.explainLifecycle -[source,js] +[source,ts] ---- -client.ilm.explainLifecycle([params] [, options] [, callback]) +client.ilm.explainLifecycle({ + index: string +}) ---- link:{ref}/ilm-explain-lifecycle.html[Reference] [cols=2*] @@ -4452,9 +5557,11 @@ link:{ref}/ilm-explain-lifecycle.html[Reference] |=== === ilm.getLifecycle -[source,js] +[source,ts] ---- -client.ilm.getLifecycle([params] [, options] [, callback]) +client.ilm.getLifecycle({ + policy: string +}) ---- link:{ref}/ilm-get-lifecycle.html[Reference] [cols=2*] @@ -4465,17 +5572,20 @@ link:{ref}/ilm-get-lifecycle.html[Reference] |=== === ilm.getStatus -[source,js] +[source,ts] ---- -client.ilm.getStatus([params] [, options] [, callback]) +client.ilm.getStatus() ---- link:{ref}/ilm-get-status.html[Reference] === ilm.moveToStep -[source,js] +[source,ts] ---- -client.ilm.moveToStep([params] [, options] [, callback]) +client.ilm.moveToStep({ + index: string, + body: object +}) ---- link:{ref}/ilm-move-to-step.html[Reference] [cols=2*] @@ -4489,9 +5599,12 @@ link:{ref}/ilm-move-to-step.html[Reference] |=== === ilm.putLifecycle -[source,js] +[source,ts] ---- -client.ilm.putLifecycle([params] [, options] [, callback]) +client.ilm.putLifecycle({ + policy: string, + body: object +}) ---- link:{ref}/ilm-put-lifecycle.html[Reference] [cols=2*] @@ -4505,9 +5618,11 @@ link:{ref}/ilm-put-lifecycle.html[Reference] |=== === ilm.removePolicy -[source,js] +[source,ts] ---- -client.ilm.removePolicy([params] [, options] [, callback]) +client.ilm.removePolicy({ + index: string +}) ---- link:{ref}/ilm-remove-policy.html[Reference] [cols=2*] @@ -4518,9 +5633,11 @@ link:{ref}/ilm-remove-policy.html[Reference] |=== === ilm.retry -[source,js] +[source,ts] ---- -client.ilm.retry([params] [, options] [, callback]) +client.ilm.retry({ + index: string +}) ---- link:{ref}/ilm-retry-policy.html[Reference] [cols=2*] @@ -4531,25 +5648,33 @@ link:{ref}/ilm-retry-policy.html[Reference] |=== === ilm.start -[source,js] +[source,ts] ---- -client.ilm.start([params] [, options] [, callback]) +client.ilm.start() ---- link:{ref}/ilm-start.html[Reference] === ilm.stop -[source,js] +[source,ts] ---- -client.ilm.stop([params] [, options] [, callback]) +client.ilm.stop() ---- link:{ref}/ilm-stop.html[Reference] === indices.freeze -[source,js] ----- -client.indices.freeze([params] [, options] [, callback]) +[source,ts] +---- +client.indices.freeze({ + index: string, + timeout: string, + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + wait_for_active_shards: string +}) ---- link:{ref}/freeze-index-api.html[Reference] [cols=2*] @@ -4570,7 +5695,7 @@ link:{ref}/freeze-index-api.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `closed` |`wait_for_active_shards` or `waitForActiveShards` @@ -4579,15 +5704,20 @@ _Default:_ `closed` |=== === indices.reloadSearchAnalyzers -[source,js] +[source,ts] ---- -client.indices.reloadSearchAnalyzers([params] [, options] [, callback]) +client.indices.reloadSearchAnalyzers({ + index: string | string[], + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all' +}) ---- link:{ref}/indices-reload-analyzers.html[Reference] [cols=2*] |=== |`index` -|`string, string[]` - A comma-separated list of index names to reload analyzers for +|`string \| string[]` - A comma-separated list of index names to reload analyzers for |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -4596,15 +5726,23 @@ link:{ref}/indices-reload-analyzers.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` |=== === indices.unfreeze -[source,js] ----- -client.indices.unfreeze([params] [, options] [, callback]) +[source,ts] +---- +client.indices.unfreeze({ + index: string, + timeout: string, + master_timeout: string, + ignore_unavailable: boolean, + allow_no_indices: boolean, + expand_wildcards: 'open' | 'closed' | 'none' | 'all', + wait_for_active_shards: string +}) ---- link:{ref}/freeze-index-api.html[Reference] [cols=2*] @@ -4625,7 +5763,7 @@ link:{ref}/freeze-index-api.html[Reference] |`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) |`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `closed` |`wait_for_active_shards` or `waitForActiveShards` @@ -4634,17 +5772,19 @@ _Default:_ `closed` |=== === license.delete -[source,js] +[source,ts] ---- -client.license.delete([params] [, options] [, callback]) +client.license.delete() ---- link:{ref}/delete-license.html[Reference] === license.get -[source,js] +[source,ts] ---- -client.license.get([params] [, options] [, callback]) +client.license.get({ + local: boolean +}) ---- link:{ref}/get-license.html[Reference] [cols=2*] @@ -4655,25 +5795,28 @@ link:{ref}/get-license.html[Reference] |=== === license.getBasicStatus -[source,js] +[source,ts] ---- -client.license.getBasicStatus([params] [, options] [, callback]) +client.license.getBasicStatus() ---- link:{ref}/get-basic-status.html[Reference] === license.getTrialStatus -[source,js] +[source,ts] ---- -client.license.getTrialStatus([params] [, options] [, callback]) +client.license.getTrialStatus() ---- link:{ref}/get-trial-status.html[Reference] === license.post -[source,js] +[source,ts] ---- -client.license.post([params] [, options] [, callback]) +client.license.post({ + acknowledge: boolean, + body: object +}) ---- link:{ref}/update-license.html[Reference] [cols=2*] @@ -4687,9 +5830,11 @@ link:{ref}/update-license.html[Reference] |=== === license.postStartBasic -[source,js] +[source,ts] ---- -client.license.postStartBasic([params] [, options] [, callback]) +client.license.postStartBasic({ + acknowledge: boolean +}) ---- link:{ref}/start-basic.html[Reference] [cols=2*] @@ -4700,9 +5845,12 @@ link:{ref}/start-basic.html[Reference] |=== === license.postStartTrial -[source,js] +[source,ts] ---- -client.license.postStartTrial([params] [, options] [, callback]) +client.license.postStartTrial({ + type: string, + acknowledge: boolean +}) ---- link:{ref}/start-trial.html[Reference] [cols=2*] @@ -4716,9 +5864,11 @@ link:{ref}/start-trial.html[Reference] |=== === migration.deprecations -[source,js] +[source,ts] ---- -client.migration.deprecations([params] [, options] [, callback]) +client.migration.deprecations({ + index: string +}) ---- link:{ref}/migration-api-deprecation.html[Reference] [cols=2*] @@ -4729,9 +5879,15 @@ link:{ref}/migration-api-deprecation.html[Reference] |=== === ml.closeJob -[source,js] +[source,ts] ---- -client.ml.closeJob([params] [, options] [, callback]) +client.ml.closeJob({ + job_id: string, + allow_no_jobs: boolean, + force: boolean, + timeout: string, + body: object +}) ---- link:{ref}/ml-close-job.html[Reference] [cols=2*] @@ -4754,9 +5910,11 @@ link:{ref}/ml-close-job.html[Reference] |=== === ml.deleteCalendar -[source,js] +[source,ts] ---- -client.ml.deleteCalendar([params] [, options] [, callback]) +client.ml.deleteCalendar({ + calendar_id: string +}) ---- [cols=2*] |=== @@ -4766,9 +5924,12 @@ client.ml.deleteCalendar([params] [, options] [, callback]) |=== === ml.deleteCalendarEvent -[source,js] +[source,ts] ---- -client.ml.deleteCalendarEvent([params] [, options] [, callback]) +client.ml.deleteCalendarEvent({ + calendar_id: string, + event_id: string +}) ---- [cols=2*] |=== @@ -4781,9 +5942,12 @@ client.ml.deleteCalendarEvent([params] [, options] [, callback]) |=== === ml.deleteCalendarJob -[source,js] +[source,ts] ---- -client.ml.deleteCalendarJob([params] [, options] [, callback]) +client.ml.deleteCalendarJob({ + calendar_id: string, + job_id: string +}) ---- [cols=2*] |=== @@ -4796,9 +5960,11 @@ client.ml.deleteCalendarJob([params] [, options] [, callback]) |=== === ml.deleteDataFrameAnalytics -[source,js] +[source,ts] ---- -client.ml.deleteDataFrameAnalytics([params] [, options] [, callback]) +client.ml.deleteDataFrameAnalytics({ + id: string +}) ---- link:{ref}/delete-dfanalytics.html[Reference] [cols=2*] @@ -4809,9 +5975,12 @@ link:{ref}/delete-dfanalytics.html[Reference] |=== === ml.deleteDatafeed -[source,js] +[source,ts] ---- -client.ml.deleteDatafeed([params] [, options] [, callback]) +client.ml.deleteDatafeed({ + datafeed_id: string, + force: boolean +}) ---- link:{ref}/ml-delete-datafeed.html[Reference] [cols=2*] @@ -4825,16 +5994,18 @@ link:{ref}/ml-delete-datafeed.html[Reference] |=== === ml.deleteExpiredData -[source,js] +[source,ts] ---- -client.ml.deleteExpiredData([params] [, options] [, callback]) +client.ml.deleteExpiredData() ---- === ml.deleteFilter -[source,js] +[source,ts] ---- -client.ml.deleteFilter([params] [, options] [, callback]) +client.ml.deleteFilter({ + filter_id: string +}) ---- [cols=2*] |=== @@ -4844,9 +6015,14 @@ client.ml.deleteFilter([params] [, options] [, callback]) |=== === ml.deleteForecast -[source,js] +[source,ts] ---- -client.ml.deleteForecast([params] [, options] [, callback]) +client.ml.deleteForecast({ + job_id: string, + forecast_id: string, + allow_no_forecasts: boolean, + timeout: string +}) ---- link:{ref}/ml-delete-forecast.html[Reference] [cols=2*] @@ -4866,9 +6042,13 @@ link:{ref}/ml-delete-forecast.html[Reference] |=== === ml.deleteJob -[source,js] +[source,ts] ---- -client.ml.deleteJob([params] [, options] [, callback]) +client.ml.deleteJob({ + job_id: string, + force: boolean, + wait_for_completion: boolean +}) ---- link:{ref}/ml-delete-job.html[Reference] [cols=2*] @@ -4886,9 +6066,12 @@ _Default:_ `true` |=== === ml.deleteModelSnapshot -[source,js] +[source,ts] ---- -client.ml.deleteModelSnapshot([params] [, options] [, callback]) +client.ml.deleteModelSnapshot({ + job_id: string, + snapshot_id: string +}) ---- link:{ref}/ml-delete-snapshot.html[Reference] [cols=2*] @@ -4902,9 +6085,11 @@ link:{ref}/ml-delete-snapshot.html[Reference] |=== === ml.evaluateDataFrame -[source,js] +[source,ts] ---- -client.ml.evaluateDataFrame([params] [, options] [, callback]) +client.ml.evaluateDataFrame({ + body: object +}) ---- link:{ref}/evaluate-dfanalytics.html[Reference] [cols=2*] @@ -4915,9 +6100,25 @@ link:{ref}/evaluate-dfanalytics.html[Reference] |=== === ml.findFileStructure -[source,js] ----- -client.ml.findFileStructure([params] [, options] [, callback]) +[source,ts] +---- +client.ml.findFileStructure({ + lines_to_sample: number, + line_merge_size_limit: number, + timeout: string, + charset: string, + format: 'ndjson' | 'xml' | 'delimited' | 'semi_structured_text', + has_header_row: boolean, + column_names: string | string[], + delimiter: string, + quote: string, + should_trim_fields: boolean, + grok_pattern: string, + timestamp_field: string, + timestamp_format: string, + explain: boolean, + body: object +}) ---- link:{ref}/ml-find-file-structure.html[Reference] [cols=2*] @@ -4938,13 +6139,13 @@ _Default:_ `25s` |`string` - Optional parameter to specify the character set of the file |`format` -|`'ndjson', 'xml', 'delimited', 'semi_structured_text'` - Optional parameter to specify the high level file format +|`'ndjson' \| 'xml' \| 'delimited' \| 'semi_structured_text'` - Optional parameter to specify the high level file format |`has_header_row` or `hasHeaderRow` |`boolean` - Optional parameter to specify whether a delimited file includes the column names in its first row |`column_names` or `columnNames` -|`string, string[]` - Optional parameter containing a comma separated list of the column names for a delimited file +|`string \| string[]` - Optional parameter containing a comma separated list of the column names for a delimited file |`delimiter` |`string` - Optional parameter to specify the delimiter character for a delimited file - must be a single character @@ -4973,9 +6174,17 @@ _Default:_ `25s` |=== === ml.flushJob -[source,js] ----- -client.ml.flushJob([params] [, options] [, callback]) +[source,ts] +---- +client.ml.flushJob({ + job_id: string, + calc_interim: boolean, + start: string, + end: string, + advance_time: string, + skip_time: string, + body: object +}) ---- link:{ref}/ml-flush-job.html[Reference] [cols=2*] @@ -5004,9 +6213,13 @@ link:{ref}/ml-flush-job.html[Reference] |=== === ml.forecast -[source,js] +[source,ts] ---- -client.ml.forecast([params] [, options] [, callback]) +client.ml.forecast({ + job_id: string, + duration: string, + expires_in: string +}) ---- [cols=2*] |=== @@ -5022,9 +6235,22 @@ client.ml.forecast([params] [, options] [, callback]) |=== === ml.getBuckets -[source,js] ----- -client.ml.getBuckets([params] [, options] [, callback]) +[source,ts] +---- +client.ml.getBuckets({ + job_id: string, + timestamp: string, + expand: boolean, + exclude_interim: boolean, + from: number, + size: number, + start: string, + end: string, + anomaly_score: number, + sort: string, + desc: boolean, + body: object +}) ---- link:{ref}/ml-get-bucket.html[Reference] [cols=2*] @@ -5068,9 +6294,16 @@ link:{ref}/ml-get-bucket.html[Reference] |=== === ml.getCalendarEvents -[source,js] +[source,ts] ---- -client.ml.getCalendarEvents([params] [, options] [, callback]) +client.ml.getCalendarEvents({ + calendar_id: string, + job_id: string, + start: string, + end: string, + from: number, + size: number +}) ---- [cols=2*] |=== @@ -5095,9 +6328,14 @@ client.ml.getCalendarEvents([params] [, options] [, callback]) |=== === ml.getCalendars -[source,js] +[source,ts] ---- -client.ml.getCalendars([params] [, options] [, callback]) +client.ml.getCalendars({ + calendar_id: string, + from: number, + size: number, + body: object +}) ---- [cols=2*] |=== @@ -5116,9 +6354,15 @@ client.ml.getCalendars([params] [, options] [, callback]) |=== === ml.getCategories -[source,js] +[source,ts] ---- -client.ml.getCategories([params] [, options] [, callback]) +client.ml.getCategories({ + job_id: string, + category_id: number, + from: number, + size: number, + body: object +}) ---- link:{ref}/ml-get-category.html[Reference] [cols=2*] @@ -5141,9 +6385,14 @@ link:{ref}/ml-get-category.html[Reference] |=== === ml.getDataFrameAnalytics -[source,js] +[source,ts] ---- -client.ml.getDataFrameAnalytics([params] [, options] [, callback]) +client.ml.getDataFrameAnalytics({ + id: string, + allow_no_match: boolean, + from: number, + size: number +}) ---- link:{ref}/get-dfanalytics.html[Reference] [cols=2*] @@ -5165,9 +6414,14 @@ _Default:_ `100` |=== === ml.getDataFrameAnalyticsStats -[source,js] +[source,ts] ---- -client.ml.getDataFrameAnalyticsStats([params] [, options] [, callback]) +client.ml.getDataFrameAnalyticsStats({ + id: string, + allow_no_match: boolean, + from: number, + size: number +}) ---- link:{ref}/get-dfanalytics-stats.html[Reference] [cols=2*] @@ -5189,9 +6443,12 @@ _Default:_ `100` |=== === ml.getDatafeedStats -[source,js] +[source,ts] ---- -client.ml.getDatafeedStats([params] [, options] [, callback]) +client.ml.getDatafeedStats({ + datafeed_id: string, + allow_no_datafeeds: boolean +}) ---- link:{ref}/ml-get-datafeed-stats.html[Reference] [cols=2*] @@ -5205,9 +6462,12 @@ link:{ref}/ml-get-datafeed-stats.html[Reference] |=== === ml.getDatafeeds -[source,js] +[source,ts] ---- -client.ml.getDatafeeds([params] [, options] [, callback]) +client.ml.getDatafeeds({ + datafeed_id: string, + allow_no_datafeeds: boolean +}) ---- link:{ref}/ml-get-datafeed.html[Reference] [cols=2*] @@ -5221,9 +6481,13 @@ link:{ref}/ml-get-datafeed.html[Reference] |=== === ml.getFilters -[source,js] +[source,ts] ---- -client.ml.getFilters([params] [, options] [, callback]) +client.ml.getFilters({ + filter_id: string, + from: number, + size: number +}) ---- [cols=2*] |=== @@ -5239,9 +6503,20 @@ client.ml.getFilters([params] [, options] [, callback]) |=== === ml.getInfluencers -[source,js] ----- -client.ml.getInfluencers([params] [, options] [, callback]) +[source,ts] +---- +client.ml.getInfluencers({ + job_id: string, + exclude_interim: boolean, + from: number, + size: number, + start: string, + end: string, + influencer_score: number, + sort: string, + desc: boolean, + body: object +}) ---- link:{ref}/ml-get-influencer.html[Reference] [cols=2*] @@ -5279,9 +6554,12 @@ link:{ref}/ml-get-influencer.html[Reference] |=== === ml.getJobStats -[source,js] +[source,ts] ---- -client.ml.getJobStats([params] [, options] [, callback]) +client.ml.getJobStats({ + job_id: string, + allow_no_jobs: boolean +}) ---- link:{ref}/ml-get-job-stats.html[Reference] [cols=2*] @@ -5295,9 +6573,12 @@ link:{ref}/ml-get-job-stats.html[Reference] |=== === ml.getJobs -[source,js] +[source,ts] ---- -client.ml.getJobs([params] [, options] [, callback]) +client.ml.getJobs({ + job_id: string, + allow_no_jobs: boolean +}) ---- link:{ref}/ml-get-job.html[Reference] [cols=2*] @@ -5311,9 +6592,19 @@ link:{ref}/ml-get-job.html[Reference] |=== === ml.getModelSnapshots -[source,js] ----- -client.ml.getModelSnapshots([params] [, options] [, callback]) +[source,ts] +---- +client.ml.getModelSnapshots({ + job_id: string, + snapshot_id: string, + from: number, + size: number, + start: string, + end: string, + sort: string, + desc: boolean, + body: object +}) ---- link:{ref}/ml-get-snapshot.html[Reference] [cols=2*] @@ -5348,9 +6639,19 @@ link:{ref}/ml-get-snapshot.html[Reference] |=== === ml.getOverallBuckets -[source,js] ----- -client.ml.getOverallBuckets([params] [, options] [, callback]) +[source,ts] +---- +client.ml.getOverallBuckets({ + job_id: string, + top_n: number, + bucket_span: string, + overall_score: number, + exclude_interim: boolean, + start: string, + end: string, + allow_no_jobs: boolean, + body: object +}) ---- link:{ref}/ml-get-overall-buckets.html[Reference] [cols=2*] @@ -5385,9 +6686,20 @@ link:{ref}/ml-get-overall-buckets.html[Reference] |=== === ml.getRecords -[source,js] ----- -client.ml.getRecords([params] [, options] [, callback]) +[source,ts] +---- +client.ml.getRecords({ + job_id: string, + exclude_interim: boolean, + from: number, + size: number, + start: string, + end: string, + record_score: number, + sort: string, + desc: boolean, + body: object +}) ---- link:{ref}/ml-get-record.html[Reference] [cols=2*] @@ -5425,16 +6737,20 @@ link:{ref}/ml-get-record.html[Reference] |=== === ml.info -[source,js] +[source,ts] ---- -client.ml.info([params] [, options] [, callback]) +client.ml.info() ---- === ml.openJob -[source,js] +[source,ts] ---- -client.ml.openJob([params] [, options] [, callback]) +client.ml.openJob({ + job_id: string, + ignore_downtime: boolean, + timeout: string +}) ---- link:{ref}/ml-open-job.html[Reference] [cols=2*] @@ -5451,9 +6767,12 @@ link:{ref}/ml-open-job.html[Reference] |=== === ml.postCalendarEvents -[source,js] +[source,ts] ---- -client.ml.postCalendarEvents([params] [, options] [, callback]) +client.ml.postCalendarEvents({ + calendar_id: string, + body: object +}) ---- [cols=2*] |=== @@ -5466,9 +6785,14 @@ client.ml.postCalendarEvents([params] [, options] [, callback]) |=== === ml.postData -[source,js] +[source,ts] ---- -client.ml.postData([params] [, options] [, callback]) +client.ml.postData({ + job_id: string, + reset_start: string, + reset_end: string, + body: object +}) ---- link:{ref}/ml-post-data.html[Reference] [cols=2*] @@ -5488,9 +6812,11 @@ link:{ref}/ml-post-data.html[Reference] |=== === ml.previewDatafeed -[source,js] +[source,ts] ---- -client.ml.previewDatafeed([params] [, options] [, callback]) +client.ml.previewDatafeed({ + datafeed_id: string +}) ---- link:{ref}/ml-preview-datafeed.html[Reference] [cols=2*] @@ -5501,9 +6827,12 @@ link:{ref}/ml-preview-datafeed.html[Reference] |=== === ml.putCalendar -[source,js] +[source,ts] ---- -client.ml.putCalendar([params] [, options] [, callback]) +client.ml.putCalendar({ + calendar_id: string, + body: object +}) ---- [cols=2*] |=== @@ -5516,9 +6845,12 @@ client.ml.putCalendar([params] [, options] [, callback]) |=== === ml.putCalendarJob -[source,js] +[source,ts] ---- -client.ml.putCalendarJob([params] [, options] [, callback]) +client.ml.putCalendarJob({ + calendar_id: string, + job_id: string +}) ---- [cols=2*] |=== @@ -5531,9 +6863,12 @@ client.ml.putCalendarJob([params] [, options] [, callback]) |=== === ml.putDataFrameAnalytics -[source,js] +[source,ts] ---- -client.ml.putDataFrameAnalytics([params] [, options] [, callback]) +client.ml.putDataFrameAnalytics({ + id: string, + body: object +}) ---- link:{ref}/put-dfanalytics.html[Reference] [cols=2*] @@ -5547,9 +6882,12 @@ link:{ref}/put-dfanalytics.html[Reference] |=== === ml.putDatafeed -[source,js] +[source,ts] ---- -client.ml.putDatafeed([params] [, options] [, callback]) +client.ml.putDatafeed({ + datafeed_id: string, + body: object +}) ---- link:{ref}/ml-put-datafeed.html[Reference] [cols=2*] @@ -5563,9 +6901,12 @@ link:{ref}/ml-put-datafeed.html[Reference] |=== === ml.putFilter -[source,js] +[source,ts] ---- -client.ml.putFilter([params] [, options] [, callback]) +client.ml.putFilter({ + filter_id: string, + body: object +}) ---- [cols=2*] |=== @@ -5578,9 +6919,12 @@ client.ml.putFilter([params] [, options] [, callback]) |=== === ml.putJob -[source,js] +[source,ts] ---- -client.ml.putJob([params] [, options] [, callback]) +client.ml.putJob({ + job_id: string, + body: object +}) ---- link:{ref}/ml-put-job.html[Reference] [cols=2*] @@ -5594,9 +6938,14 @@ link:{ref}/ml-put-job.html[Reference] |=== === ml.revertModelSnapshot -[source,js] +[source,ts] ---- -client.ml.revertModelSnapshot([params] [, options] [, callback]) +client.ml.revertModelSnapshot({ + job_id: string, + snapshot_id: string, + delete_intervening_results: boolean, + body: object +}) ---- link:{ref}/ml-revert-snapshot.html[Reference] [cols=2*] @@ -5616,9 +6965,12 @@ link:{ref}/ml-revert-snapshot.html[Reference] |=== === ml.setUpgradeMode -[source,js] +[source,ts] ---- -client.ml.setUpgradeMode([params] [, options] [, callback]) +client.ml.setUpgradeMode({ + enabled: boolean, + timeout: string +}) ---- link:{ref}/ml-set-upgrade-mode.html[Reference] [cols=2*] @@ -5632,9 +6984,13 @@ link:{ref}/ml-set-upgrade-mode.html[Reference] |=== === ml.startDataFrameAnalytics -[source,js] +[source,ts] ---- -client.ml.startDataFrameAnalytics([params] [, options] [, callback]) +client.ml.startDataFrameAnalytics({ + id: string, + timeout: string, + body: object +}) ---- link:{ref}/start-dfanalytics.html[Reference] [cols=2*] @@ -5651,9 +7007,15 @@ link:{ref}/start-dfanalytics.html[Reference] |=== === ml.startDatafeed -[source,js] +[source,ts] ---- -client.ml.startDatafeed([params] [, options] [, callback]) +client.ml.startDatafeed({ + datafeed_id: string, + start: string, + end: string, + timeout: string, + body: object +}) ---- link:{ref}/ml-start-datafeed.html[Reference] [cols=2*] @@ -5676,9 +7038,15 @@ link:{ref}/ml-start-datafeed.html[Reference] |=== === ml.stopDataFrameAnalytics -[source,js] +[source,ts] ---- -client.ml.stopDataFrameAnalytics([params] [, options] [, callback]) +client.ml.stopDataFrameAnalytics({ + id: string, + allow_no_match: boolean, + force: boolean, + timeout: string, + body: object +}) ---- link:{ref}/stop-dfanalytics.html[Reference] [cols=2*] @@ -5701,9 +7069,14 @@ link:{ref}/stop-dfanalytics.html[Reference] |=== === ml.stopDatafeed -[source,js] +[source,ts] ---- -client.ml.stopDatafeed([params] [, options] [, callback]) +client.ml.stopDatafeed({ + datafeed_id: string, + allow_no_datafeeds: boolean, + force: boolean, + timeout: string +}) ---- link:{ref}/ml-stop-datafeed.html[Reference] [cols=2*] @@ -5723,9 +7096,12 @@ link:{ref}/ml-stop-datafeed.html[Reference] |=== === ml.updateDatafeed -[source,js] +[source,ts] ---- -client.ml.updateDatafeed([params] [, options] [, callback]) +client.ml.updateDatafeed({ + datafeed_id: string, + body: object +}) ---- link:{ref}/ml-update-datafeed.html[Reference] [cols=2*] @@ -5739,9 +7115,12 @@ link:{ref}/ml-update-datafeed.html[Reference] |=== === ml.updateFilter -[source,js] +[source,ts] ---- -client.ml.updateFilter([params] [, options] [, callback]) +client.ml.updateFilter({ + filter_id: string, + body: object +}) ---- [cols=2*] |=== @@ -5754,9 +7133,12 @@ client.ml.updateFilter([params] [, options] [, callback]) |=== === ml.updateJob -[source,js] +[source,ts] ---- -client.ml.updateJob([params] [, options] [, callback]) +client.ml.updateJob({ + job_id: string, + body: object +}) ---- link:{ref}/ml-update-job.html[Reference] [cols=2*] @@ -5770,9 +7152,13 @@ link:{ref}/ml-update-job.html[Reference] |=== === ml.updateModelSnapshot -[source,js] +[source,ts] ---- -client.ml.updateModelSnapshot([params] [, options] [, callback]) +client.ml.updateModelSnapshot({ + job_id: string, + snapshot_id: string, + body: object +}) ---- link:{ref}/ml-update-snapshot.html[Reference] [cols=2*] @@ -5789,9 +7175,11 @@ link:{ref}/ml-update-snapshot.html[Reference] |=== === ml.validate -[source,js] +[source,ts] ---- -client.ml.validate([params] [, options] [, callback]) +client.ml.validate({ + body: object +}) ---- [cols=2*] |=== @@ -5801,9 +7189,11 @@ client.ml.validate([params] [, options] [, callback]) |=== === ml.validateDetector -[source,js] +[source,ts] ---- -client.ml.validateDetector([params] [, options] [, callback]) +client.ml.validateDetector({ + body: object +}) ---- [cols=2*] |=== @@ -5813,9 +7203,15 @@ client.ml.validateDetector([params] [, options] [, callback]) |=== === monitoring.bulk -[source,js] +[source,ts] ---- -client.monitoring.bulk([params] [, options] [, callback]) +client.monitoring.bulk({ + type: string, + system_id: string, + system_api_version: string, + interval: string, + body: object +}) ---- link:{ref}/es-monitoring.html[Reference] [cols=2*] @@ -5838,9 +7234,11 @@ link:{ref}/es-monitoring.html[Reference] |=== === rollup.deleteJob -[source,js] +[source,ts] ---- -client.rollup.deleteJob([params] [, options] [, callback]) +client.rollup.deleteJob({ + id: string +}) ---- [cols=2*] |=== @@ -5850,9 +7248,11 @@ client.rollup.deleteJob([params] [, options] [, callback]) |=== === rollup.getJobs -[source,js] +[source,ts] ---- -client.rollup.getJobs([params] [, options] [, callback]) +client.rollup.getJobs({ + id: string +}) ---- [cols=2*] |=== @@ -5862,9 +7262,11 @@ client.rollup.getJobs([params] [, options] [, callback]) |=== === rollup.getRollupCaps -[source,js] +[source,ts] ---- -client.rollup.getRollupCaps([params] [, options] [, callback]) +client.rollup.getRollupCaps({ + id: string +}) ---- [cols=2*] |=== @@ -5874,9 +7276,11 @@ client.rollup.getRollupCaps([params] [, options] [, callback]) |=== === rollup.getRollupIndexCaps -[source,js] +[source,ts] ---- -client.rollup.getRollupIndexCaps([params] [, options] [, callback]) +client.rollup.getRollupIndexCaps({ + index: string +}) ---- [cols=2*] |=== @@ -5886,9 +7290,12 @@ client.rollup.getRollupIndexCaps([params] [, options] [, callback]) |=== === rollup.putJob -[source,js] +[source,ts] ---- -client.rollup.putJob([params] [, options] [, callback]) +client.rollup.putJob({ + id: string, + body: object +}) ---- [cols=2*] |=== @@ -5901,14 +7308,20 @@ client.rollup.putJob([params] [, options] [, callback]) |=== === rollup.rollupSearch -[source,js] +[source,ts] ---- -client.rollup.rollupSearch([params] [, options] [, callback]) +client.rollup.rollupSearch({ + index: string | string[], + type: string, + typed_keys: boolean, + rest_total_hits_as_int: boolean, + body: object +}) ---- [cols=2*] |=== |`index` -|`string, string[]` - The indices or index-pattern(s) (containing rollup or regular data) that should be searched +|`string \| string[]` - The indices or index-pattern(s) (containing rollup or regular data) that should be searched |`type` |`string` - The doc type inside the index @@ -5925,9 +7338,11 @@ client.rollup.rollupSearch([params] [, options] [, callback]) |=== === rollup.startJob -[source,js] +[source,ts] ---- -client.rollup.startJob([params] [, options] [, callback]) +client.rollup.startJob({ + id: string +}) ---- [cols=2*] |=== @@ -5937,9 +7352,13 @@ client.rollup.startJob([params] [, options] [, callback]) |=== === rollup.stopJob -[source,js] +[source,ts] ---- -client.rollup.stopJob([params] [, options] [, callback]) +client.rollup.stopJob({ + id: string, + wait_for_completion: boolean, + timeout: string +}) ---- [cols=2*] |=== @@ -5955,17 +7374,21 @@ client.rollup.stopJob([params] [, options] [, callback]) |=== === security.authenticate -[source,js] +[source,ts] ---- -client.security.authenticate([params] [, options] [, callback]) +client.security.authenticate() ---- link:{ref}/security-api-authenticate.html[Reference] === security.changePassword -[source,js] +[source,ts] ---- -client.security.changePassword([params] [, options] [, callback]) +client.security.changePassword({ + username: string, + refresh: 'true' | 'false' | 'wait_for', + body: object +}) ---- link:{ref}/security-api-change-password.html[Reference] [cols=2*] @@ -5974,7 +7397,7 @@ link:{ref}/security-api-change-password.html[Reference] |`string` - The username of the user to change the password for |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` |`object` - the new password for the user @@ -5982,44 +7405,52 @@ link:{ref}/security-api-change-password.html[Reference] |=== === security.clearCachedRealms -[source,js] +[source,ts] ---- -client.security.clearCachedRealms([params] [, options] [, callback]) +client.security.clearCachedRealms({ + realms: string | string[], + usernames: string | string[] +}) ---- link:{ref}/security-api-clear-cache.html[Reference] [cols=2*] |=== |`realms` -|`string, string[]` - Comma-separated list of realms to clear +|`string \| string[]` - Comma-separated list of realms to clear |`usernames` -|`string, string[]` - Comma-separated list of usernames to clear from the cache +|`string \| string[]` - Comma-separated list of usernames to clear from the cache |=== === security.clearCachedRoles -[source,js] +[source,ts] ---- -client.security.clearCachedRoles([params] [, options] [, callback]) +client.security.clearCachedRoles({ + name: string | string[] +}) ---- link:{ref}/security-api-clear-role-cache.html[Reference] [cols=2*] |=== |`name` -|`string, string[]` - Role name +|`string \| string[]` - Role name |=== === security.createApiKey -[source,js] +[source,ts] ---- -client.security.createApiKey([params] [, options] [, callback]) +client.security.createApiKey({ + refresh: 'true' | 'false' | 'wait_for', + body: object +}) ---- link:{ref}/security-api-create-api-key.html[Reference] [cols=2*] |=== |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` |`object` - The api key request to create an API key @@ -6027,9 +7458,13 @@ link:{ref}/security-api-create-api-key.html[Reference] |=== === security.deletePrivileges -[source,js] +[source,ts] ---- -client.security.deletePrivileges([params] [, options] [, callback]) +client.security.deletePrivileges({ + application: string, + name: string, + refresh: 'true' | 'false' | 'wait_for' +}) ---- link:TODO[Reference] [cols=2*] @@ -6041,14 +7476,17 @@ link:TODO[Reference] |`string` - Privilege name |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== === security.deleteRole -[source,js] +[source,ts] ---- -client.security.deleteRole([params] [, options] [, callback]) +client.security.deleteRole({ + name: string, + refresh: 'true' | 'false' | 'wait_for' +}) ---- link:{ref}/security-api-delete-role.html[Reference] [cols=2*] @@ -6057,14 +7495,17 @@ link:{ref}/security-api-delete-role.html[Reference] |`string` - Role name |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== === security.deleteRoleMapping -[source,js] +[source,ts] ---- -client.security.deleteRoleMapping([params] [, options] [, callback]) +client.security.deleteRoleMapping({ + name: string, + refresh: 'true' | 'false' | 'wait_for' +}) ---- link:{ref}/security-api-delete-role-mapping.html[Reference] [cols=2*] @@ -6073,14 +7514,17 @@ link:{ref}/security-api-delete-role-mapping.html[Reference] |`string` - Role-mapping name |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== === security.deleteUser -[source,js] +[source,ts] ---- -client.security.deleteUser([params] [, options] [, callback]) +client.security.deleteUser({ + username: string, + refresh: 'true' | 'false' | 'wait_for' +}) ---- link:{ref}/security-api-delete-user.html[Reference] [cols=2*] @@ -6089,14 +7533,17 @@ link:{ref}/security-api-delete-user.html[Reference] |`string` - username |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== === security.disableUser -[source,js] +[source,ts] ---- -client.security.disableUser([params] [, options] [, callback]) +client.security.disableUser({ + username: string, + refresh: 'true' | 'false' | 'wait_for' +}) ---- link:{ref}/security-api-disable-user.html[Reference] [cols=2*] @@ -6105,14 +7552,17 @@ link:{ref}/security-api-disable-user.html[Reference] |`string` - The username of the user to disable |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== === security.enableUser -[source,js] +[source,ts] ---- -client.security.enableUser([params] [, options] [, callback]) +client.security.enableUser({ + username: string, + refresh: 'true' | 'false' | 'wait_for' +}) ---- link:{ref}/security-api-enable-user.html[Reference] [cols=2*] @@ -6121,14 +7571,19 @@ link:{ref}/security-api-enable-user.html[Reference] |`string` - The username of the user to enable |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |=== === security.getApiKey -[source,js] +[source,ts] ---- -client.security.getApiKey([params] [, options] [, callback]) +client.security.getApiKey({ + id: string, + name: string, + username: string, + realm_name: string +}) ---- link:{ref}/security-api-get-api-key.html[Reference] [cols=2*] @@ -6148,17 +7603,20 @@ link:{ref}/security-api-get-api-key.html[Reference] |=== === security.getBuiltinPrivileges -[source,js] +[source,ts] ---- -client.security.getBuiltinPrivileges([params] [, options] [, callback]) +client.security.getBuiltinPrivileges() ---- link:{ref}/security-api-get-builtin-privileges.html[Reference] === security.getPrivileges -[source,js] +[source,ts] ---- -client.security.getPrivileges([params] [, options] [, callback]) +client.security.getPrivileges({ + application: string, + name: string +}) ---- link:{ref}/security-api-get-privileges.html[Reference] [cols=2*] @@ -6172,9 +7630,11 @@ link:{ref}/security-api-get-privileges.html[Reference] |=== === security.getRole -[source,js] +[source,ts] ---- -client.security.getRole([params] [, options] [, callback]) +client.security.getRole({ + name: string +}) ---- link:{ref}/security-api-get-role.html[Reference] [cols=2*] @@ -6185,9 +7645,11 @@ link:{ref}/security-api-get-role.html[Reference] |=== === security.getRoleMapping -[source,js] +[source,ts] ---- -client.security.getRoleMapping([params] [, options] [, callback]) +client.security.getRoleMapping({ + name: string +}) ---- link:{ref}/security-api-get-role-mapping.html[Reference] [cols=2*] @@ -6198,9 +7660,11 @@ link:{ref}/security-api-get-role-mapping.html[Reference] |=== === security.getToken -[source,js] +[source,ts] ---- -client.security.getToken([params] [, options] [, callback]) +client.security.getToken({ + body: object +}) ---- link:{ref}/security-api-get-token.html[Reference] [cols=2*] @@ -6211,30 +7675,35 @@ link:{ref}/security-api-get-token.html[Reference] |=== === security.getUser -[source,js] +[source,ts] ---- -client.security.getUser([params] [, options] [, callback]) +client.security.getUser({ + username: string | string[] +}) ---- link:{ref}/security-api-get-user.html[Reference] [cols=2*] |=== |`username` -|`string, string[]` - A comma-separated list of usernames +|`string \| string[]` - A comma-separated list of usernames |=== === security.getUserPrivileges -[source,js] +[source,ts] ---- -client.security.getUserPrivileges([params] [, options] [, callback]) +client.security.getUserPrivileges() ---- link:{ref}/security-api-get-privileges.html[Reference] === security.hasPrivileges -[source,js] +[source,ts] ---- -client.security.hasPrivileges([params] [, options] [, callback]) +client.security.hasPrivileges({ + user: string, + body: object +}) ---- link:{ref}/security-api-has-privileges.html[Reference] [cols=2*] @@ -6248,9 +7717,11 @@ link:{ref}/security-api-has-privileges.html[Reference] |=== === security.invalidateApiKey -[source,js] +[source,ts] ---- -client.security.invalidateApiKey([params] [, options] [, callback]) +client.security.invalidateApiKey({ + body: object +}) ---- link:{ref}/security-api-invalidate-api-key.html[Reference] [cols=2*] @@ -6261,9 +7732,11 @@ link:{ref}/security-api-invalidate-api-key.html[Reference] |=== === security.invalidateToken -[source,js] +[source,ts] ---- -client.security.invalidateToken([params] [, options] [, callback]) +client.security.invalidateToken({ + body: object +}) ---- link:{ref}/security-api-invalidate-token.html[Reference] [cols=2*] @@ -6274,15 +7747,18 @@ link:{ref}/security-api-invalidate-token.html[Reference] |=== === security.putPrivileges -[source,js] +[source,ts] ---- -client.security.putPrivileges([params] [, options] [, callback]) +client.security.putPrivileges({ + refresh: 'true' | 'false' | 'wait_for', + body: object +}) ---- link:TODO[Reference] [cols=2*] |=== |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` |`object` - The privilege(s) to add @@ -6290,9 +7766,13 @@ link:TODO[Reference] |=== === security.putRole -[source,js] +[source,ts] ---- -client.security.putRole([params] [, options] [, callback]) +client.security.putRole({ + name: string, + refresh: 'true' | 'false' | 'wait_for', + body: object +}) ---- link:{ref}/security-api-put-role.html[Reference] [cols=2*] @@ -6301,7 +7781,7 @@ link:{ref}/security-api-put-role.html[Reference] |`string` - Role name |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` |`object` - The role to add @@ -6309,9 +7789,13 @@ link:{ref}/security-api-put-role.html[Reference] |=== === security.putRoleMapping -[source,js] +[source,ts] ---- -client.security.putRoleMapping([params] [, options] [, callback]) +client.security.putRoleMapping({ + name: string, + refresh: 'true' | 'false' | 'wait_for', + body: object +}) ---- link:{ref}/security-api-put-role-mapping.html[Reference] [cols=2*] @@ -6320,7 +7804,7 @@ link:{ref}/security-api-put-role-mapping.html[Reference] |`string` - Role-mapping name |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` |`object` - The role mapping to add @@ -6328,9 +7812,13 @@ link:{ref}/security-api-put-role-mapping.html[Reference] |=== === security.putUser -[source,js] +[source,ts] ---- -client.security.putUser([params] [, options] [, callback]) +client.security.putUser({ + username: string, + refresh: 'true' | 'false' | 'wait_for', + body: object +}) ---- link:{ref}/security-api-put-user.html[Reference] [cols=2*] @@ -6339,7 +7827,7 @@ link:{ref}/security-api-put-user.html[Reference] |`string` - The username of the User |`refresh` -|`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` |`object` - The user to add @@ -6347,9 +7835,11 @@ link:{ref}/security-api-put-user.html[Reference] |=== === sql.clearCursor -[source,js] +[source,ts] ---- -client.sql.clearCursor([params] [, options] [, callback]) +client.sql.clearCursor({ + body: object +}) ---- link:Clear SQL cursor[Reference] [cols=2*] @@ -6360,9 +7850,12 @@ link:Clear SQL cursor[Reference] |=== === sql.query -[source,js] +[source,ts] ---- -client.sql.query([params] [, options] [, callback]) +client.sql.query({ + format: string, + body: object +}) ---- link:Execute SQL[Reference] [cols=2*] @@ -6376,9 +7869,11 @@ link:Execute SQL[Reference] |=== === sql.translate -[source,js] +[source,ts] ---- -client.sql.translate([params] [, options] [, callback]) +client.sql.translate({ + body: object +}) ---- link:Translate SQL into Elasticsearch queries[Reference] [cols=2*] @@ -6389,17 +7884,20 @@ link:Translate SQL into Elasticsearch queries[Reference] |=== === ssl.certificates -[source,js] +[source,ts] ---- -client.ssl.certificates([params] [, options] [, callback]) +client.ssl.certificates() ---- link:{ref}/security-api-ssl.html[Reference] === watcher.ackWatch -[source,js] +[source,ts] ---- -client.watcher.ackWatch([params] [, options] [, callback]) +client.watcher.ackWatch({ + watch_id: string, + action_id: string | string[] +}) ---- link:{ref}/watcher-api-ack-watch.html[Reference] [cols=2*] @@ -6408,14 +7906,16 @@ link:{ref}/watcher-api-ack-watch.html[Reference] |`string` - Watch ID |`action_id` or `actionId` -|`string, string[]` - A comma-separated list of the action ids to be acked +|`string \| string[]` - A comma-separated list of the action ids to be acked |=== === watcher.activateWatch -[source,js] +[source,ts] ---- -client.watcher.activateWatch([params] [, options] [, callback]) +client.watcher.activateWatch({ + watch_id: string +}) ---- link:{ref}/watcher-api-activate-watch.html[Reference] [cols=2*] @@ -6426,9 +7926,11 @@ link:{ref}/watcher-api-activate-watch.html[Reference] |=== === watcher.deactivateWatch -[source,js] +[source,ts] ---- -client.watcher.deactivateWatch([params] [, options] [, callback]) +client.watcher.deactivateWatch({ + watch_id: string +}) ---- link:{ref}/watcher-api-deactivate-watch.html[Reference] [cols=2*] @@ -6439,9 +7941,11 @@ link:{ref}/watcher-api-deactivate-watch.html[Reference] |=== === watcher.deleteWatch -[source,js] +[source,ts] ---- -client.watcher.deleteWatch([params] [, options] [, callback]) +client.watcher.deleteWatch({ + id: string +}) ---- link:{ref}/watcher-api-delete-watch.html[Reference] [cols=2*] @@ -6452,9 +7956,13 @@ link:{ref}/watcher-api-delete-watch.html[Reference] |=== === watcher.executeWatch -[source,js] +[source,ts] ---- -client.watcher.executeWatch([params] [, options] [, callback]) +client.watcher.executeWatch({ + id: string, + debug: boolean, + body: object +}) ---- link:{ref}/watcher-api-execute-watch.html[Reference] [cols=2*] @@ -6471,9 +7979,11 @@ link:{ref}/watcher-api-execute-watch.html[Reference] |=== === watcher.getWatch -[source,js] +[source,ts] ---- -client.watcher.getWatch([params] [, options] [, callback]) +client.watcher.getWatch({ + id: string +}) ---- link:{ref}/watcher-api-get-watch.html[Reference] [cols=2*] @@ -6484,9 +7994,16 @@ link:{ref}/watcher-api-get-watch.html[Reference] |=== === watcher.putWatch -[source,js] +[source,ts] ---- -client.watcher.putWatch([params] [, options] [, callback]) +client.watcher.putWatch({ + id: string, + active: boolean, + version: number, + if_seq_no: number, + if_primary_term: number, + body: object +}) ---- link:{ref}/watcher-api-put-watch.html[Reference] [cols=2*] @@ -6512,26 +8029,30 @@ link:{ref}/watcher-api-put-watch.html[Reference] |=== === watcher.start -[source,js] +[source,ts] ---- -client.watcher.start([params] [, options] [, callback]) +client.watcher.start() ---- link:{ref}/watcher-api-start.html[Reference] === watcher.stats -[source,js] +[source,ts] ---- -client.watcher.stats([params] [, options] [, callback]) +client.watcher.stats({ + metric: string | string[], + metric: string | string[], + emit_stacktraces: boolean +}) ---- link:{ref}/watcher-api-stats.html[Reference] [cols=2*] |=== |`metric` -|`string, string[]` - Controls what additional stat metrics should be include in the response +|`string \| string[]` - Controls what additional stat metrics should be include in the response |`metric` -|`string, string[]` - Controls what additional stat metrics should be include in the response +|`string \| string[]` - Controls what additional stat metrics should be include in the response |`emit_stacktraces` or `emitStacktraces` |`boolean` - Emits stack traces of currently running watches @@ -6539,30 +8060,34 @@ link:{ref}/watcher-api-stats.html[Reference] |=== === watcher.stop -[source,js] +[source,ts] ---- -client.watcher.stop([params] [, options] [, callback]) +client.watcher.stop() ---- link:{ref}/watcher-api-stop.html[Reference] === xpack.info -[source,js] +[source,ts] ---- -client.xpack.info([params] [, options] [, callback]) +client.xpack.info({ + categories: string | string[] +}) ---- link:{ref}/info-api.html[Reference] [cols=2*] |=== |`categories` -|`string, string[]` - Comma-separated list of info categories. Can be any of: build, license, features +|`string \| string[]` - Comma-separated list of info categories. Can be any of: build, license, features |=== === xpack.usage -[source,js] +[source,ts] ---- -client.xpack.usage([params] [, options] [, callback]) +client.xpack.usage({ + master_timeout: string +}) ---- link:Retrieve information about xpack features usage[Reference] [cols=2*] diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index b17fc3b45..8d4fdae16 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -14,7 +14,9 @@ function generateDocs (common, spec) { //////// This documentation is generated by running: - node scripts/run.js --tag v7.0.0-beta + node scripts/run.js --tag tagName + or + node scripts/run.js --branch branchName ////////\n\n` doc += commonParameters(common) @@ -94,11 +96,23 @@ function generateApiDoc (spec) { }) } + const codeParameters = params + .reduce((acc, val) => { + var code = `${val.name}: ${val.type},` + acc += acc === '' + ? code + : '\n ' + code + + return acc + }, '') + // remove last comma + .slice(0, -1) + var doc = dedent` === ${camelify(name)} - [source,js] + [source,ts] ---- - client.${camelify(name)}([params] [, options] [, callback]) + client.${camelify(name)}(${codeParameters.length > 0 ? `{\n ${codeParameters}\n}` : ''}) ----\n` if (documentationUrl) { doc += `link:${documentationUrl}[Reference]\n` @@ -113,7 +127,7 @@ function generateApiDoc (spec) { : '`' + val.name + '`' acc += dedent` |${name} - |${'`' + val.type + '`'} - ${val.description}` + |${'`' + val.type.replace(/\|/g, '\\|') + '`'} - ${val.description}` if (val.default) { acc += ` +\n_Default:_ ${'`' + val.default + '`'}` } @@ -165,13 +179,13 @@ function fixLink (name, str) { function getType (type, options) { switch (type) { case 'list': - return 'string, string[]' + return 'string | string[]' case 'date': case 'time': case 'timeout': return 'string' case 'enum': - return options.map(k => `'${k}'`).join(', ') + return options.map(k => `'${k}'`).join(' | ') case 'int': case 'double': case 'long': From b2123c850817a1735573c4fcd646545c31ca1815 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 25 Jul 2019 11:12:21 +0200 Subject: [PATCH 82/84] API generation --- docs/reference.asciidoc | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 32c83f727..81fbb74b8 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1439,6 +1439,7 @@ link:{ref}/docs-delete.html[Reference] ---- client.deleteByQuery({ index: string | string[], + type: string | string[], analyzer: string, analyze_wildcard: boolean, default_operator: 'AND' | 'OR', @@ -1455,6 +1456,7 @@ client.deleteByQuery({ scroll: string, search_type: 'query_then_fetch' | 'dfs_query_then_fetch', search_timeout: string, + size: number, max_docs: number, sort: string | string[], _source: string | string[], @@ -1481,7 +1483,7 @@ link:{ref}/docs-delete-by-query.html[Reference] |`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types +|`string \| string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types |`analyzer` |`string` - The analyzer to use for the query string @@ -3210,6 +3212,7 @@ _Default:_ `open` client.indices.shrink({ index: string, target: string, + copy_settings: boolean, timeout: string, master_timeout: string, wait_for_active_shards: string, @@ -3248,6 +3251,7 @@ link:{ref}/indices-shrink-index.html[Reference] client.indices.split({ index: string, target: string, + copy_settings: boolean, timeout: string, master_timeout: string, wait_for_active_shards: string, @@ -3642,6 +3646,7 @@ link:{ref}/docs-multi-get.html[Reference] ---- client.msearch({ index: string | string[], + type: string | string[], search_type: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch', max_concurrent_searches: number, typed_keys: boolean, @@ -3659,7 +3664,7 @@ link:{ref}/search-multi-search.html[Reference] |`string \| string[]` - A comma-separated list of index names to use as default |`type` -|`string, string[]` - A comma-separated list of document types to use as default +|`string \| string[]` - A comma-separated list of document types to use as default |`search_type` or `searchType` |`'query_then_fetch' \| 'query_and_fetch' \| 'dfs_query_then_fetch' \| 'dfs_query_and_fetch'` - Search operation type @@ -3695,6 +3700,7 @@ _Default:_ `true` ---- client.msearchTemplate({ index: string | string[], + type: string | string[], search_type: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch', typed_keys: boolean, max_concurrent_searches: number, @@ -3710,7 +3716,7 @@ link:{ref}/search-multi-search.html[Reference] |`string \| string[]` - A comma-separated list of index names to use as default |`type` -|`string, string[]` - A comma-separated list of document types to use as default +|`string \| string[]` - A comma-separated list of document types to use as default |`search_type` or `searchType` |`'query_then_fetch' \| 'query_and_fetch' \| 'dfs_query_then_fetch' \| 'dfs_query_and_fetch'` - Search operation type @@ -3738,6 +3744,7 @@ _Default:_ `true` ---- client.mtermvectors({ index: string, + type: string, ids: string | string[], term_statistics: boolean, field_statistics: boolean, @@ -4186,6 +4193,7 @@ link:{ref}/search-request-body.html#request-body-search-scroll[Reference] ---- client.search({ index: string | string[], + type: string | string[], analyzer: string, analyze_wildcard: boolean, ccs_minimize_roundtrips: boolean, @@ -4238,7 +4246,7 @@ link:{ref}/search-search.html[Reference] |`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types +|`string \| string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types |`analyzer` |`string` - The analyzer to use for the query string @@ -4424,6 +4432,7 @@ _Default:_ `open` ---- client.searchTemplate({ index: string | string[], + type: string | string[], ignore_unavailable: boolean, ignore_throttled: boolean, allow_no_indices: boolean, @@ -4447,7 +4456,7 @@ link:{ref}/search-template.html[Reference] |`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types +|`string \| string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types |`ignore_unavailable` or `ignoreUnavailable` |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -4833,6 +4842,7 @@ _Default:_ `nodes` ---- client.termvectors({ index: string, + type: string, id: string, term_statistics: boolean, field_statistics: boolean, @@ -4978,6 +4988,7 @@ link:{ref}/docs-update.html[Reference] ---- client.updateByQuery({ index: string | string[], + type: string | string[], analyzer: string, analyze_wildcard: boolean, default_operator: 'AND' | 'OR', @@ -4995,6 +5006,7 @@ client.updateByQuery({ scroll: string, search_type: 'query_then_fetch' | 'dfs_query_then_fetch', search_timeout: string, + size: number, max_docs: number, sort: string | string[], _source: string | string[], @@ -5022,7 +5034,7 @@ link:{ref}/docs-update-by-query.html[Reference] |`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types +|`string \| string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types |`analyzer` |`string` - The analyzer to use for the query string @@ -5342,8 +5354,7 @@ link:http://www.elastic.co/guide/en/elasticsearch/reference/current[Reference] [source,ts] ---- client.dataFrame.deleteDataFrameTransform({ - transform_id: string, - force: boolean + transform_id: string }) ---- link:{ref}/delete-data-frame-transform.html[Reference] @@ -5352,9 +5363,6 @@ link:{ref}/delete-data-frame-transform.html[Reference] |`transform_id` or `transformId` |`string` - The id of the transform to delete -|`force` -|`boolean` - When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted. - |=== === dataFrame.getDataFrameTransform @@ -5431,7 +5439,6 @@ link:{ref}/preview-data-frame-transform.html[Reference] ---- client.dataFrame.putDataFrameTransform({ transform_id: string, - defer_validation: boolean, body: object }) ---- @@ -5441,9 +5448,6 @@ link:{ref}/put-data-frame-transform.html[Reference] |`transform_id` or `transformId` |`string` - The id of the new transform. -|`defer_validation` or `deferValidation` -|`boolean` - If validations should be deferred until data frame transform starts, defaults to false. - |`body` |`object` - The data frame transform definition From ab4e30cbcb0f549cf27d0553dc5fa3188b99b19d Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 26 Jul 2019 11:43:48 +0200 Subject: [PATCH 83/84] Refactored connection pool (#913) * Refactored ConnectionPool - Created BaseConnectionPool class - Created CloudConnectionPool - connection pool updates are immutable - resurrect now happens inside getConnection() * Rewritten connection pool(s) type definitions * Updated test * Fixed test * Fix if check * Removed old files * Improve code coverage * Updated license header * Fix if check * Improve code coverage * Updated coverage script --- index.d.ts | 2 +- index.js | 4 +- lib/Connection.d.ts | 2 +- lib/ConnectionPool.js | 386 --------------- lib/Transport.d.ts | 6 +- lib/Transport.js | 6 +- lib/pool/BaseConnectionPool.js | 239 +++++++++ lib/pool/CloudConnectionPool.js | 49 ++ lib/pool/ConnectionPool.js | 232 +++++++++ lib/{ConnectionPool.d.ts => pool/index.d.ts} | 113 +++-- lib/pool/index.js | 15 + package.json | 2 +- test/behavior/sniff.test.js | 26 +- test/unit/base-connection-pool.test.js | 490 +++++++++++++++++++ test/unit/client.test.js | 34 +- test/unit/cloud-connection-pool.test.js | 33 ++ test/unit/connection-pool.test.js | 98 ++-- test/unit/connection.test.js | 2 +- test/unit/transport.test.js | 178 +++---- 19 files changed, 1301 insertions(+), 616 deletions(-) delete mode 100644 lib/ConnectionPool.js create mode 100644 lib/pool/BaseConnectionPool.js create mode 100644 lib/pool/CloudConnectionPool.js create mode 100644 lib/pool/ConnectionPool.js rename lib/{ConnectionPool.d.ts => pool/index.d.ts} (70%) create mode 100644 lib/pool/index.js create mode 100644 test/unit/base-connection-pool.test.js create mode 100644 test/unit/cloud-connection-pool.test.js diff --git a/index.d.ts b/index.d.ts index 5d3a05e8f..ab1d10023 100644 --- a/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ import Transport, { } from './lib/Transport'; import { URL } from 'url'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; -import ConnectionPool, { ResurrectEvent, BasicAuth, ApiKeyAuth } from './lib/ConnectionPool'; +import { ConnectionPool, ResurrectEvent, BasicAuth, ApiKeyAuth } from './lib/pool'; import Serializer from './lib/Serializer'; import * as RequestParams from './api/requestParams'; import * as errors from './lib/errors'; diff --git a/index.js b/index.js index e3d6dcbdb..6fc3e7708 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const { URL } = require('url') const debug = require('debug')('elasticsearch') const Transport = require('./lib/Transport') const Connection = require('./lib/Connection') -const ConnectionPool = require('./lib/ConnectionPool') +const { ConnectionPool, CloudConnectionPool } = require('./lib/pool') const Serializer = require('./lib/Serializer') const errors = require('./lib/errors') const { ConfigurationError } = errors @@ -59,9 +59,9 @@ class Client extends EventEmitter { const options = Object.assign({}, { Connection, - ConnectionPool, Transport, Serializer, + ConnectionPool: opts.cloud ? CloudConnectionPool : ConnectionPool, maxRetries: 3, requestTimeout: 30000, pingTimeout: 3000, diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index 9f3e6d9cf..527b71fb7 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -6,7 +6,7 @@ import { URL } from 'url'; import { inspect, InspectOptions } from 'util'; -import { ApiKeyAuth, BasicAuth } from './ConnectionPool' +import { ApiKeyAuth, BasicAuth } from './pool' import * as http from 'http'; import { ConnectionOptions as TlsConnectionOptions } from 'tls'; diff --git a/lib/ConnectionPool.js b/lib/ConnectionPool.js deleted file mode 100644 index c1f2d6720..000000000 --- a/lib/ConnectionPool.js +++ /dev/null @@ -1,386 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -'use strict' - -const assert = require('assert') -const { URL } = require('url') -const debug = require('debug')('elasticsearch') -const Connection = require('./Connection') -const noop = () => {} - -class ConnectionPool { - constructor (opts = {}) { - this.connections = new Map() - this.dead = [] - this.selector = opts.selector - this.auth = opts.auth || null - this._ssl = opts.ssl - this._agent = opts.agent - // the resurrect timeout is 60s - this.resurrectTimeout = 1000 * 60 - // number of consecutive failures after which - // the timeout doesn't increase - this.resurrectTimeoutCutoff = 5 - this.pingTimeout = opts.pingTimeout - this.Connection = opts.Connection - this.emit = opts.emit || noop - this._sniffEnabled = opts.sniffEnabled || false - - const resurrectStrategy = opts.resurrectStrategy || 'ping' - this.resurrectStrategy = ConnectionPool.resurrectStrategies[resurrectStrategy] - assert( - this.resurrectStrategy != null, - `Invalid resurrection strategy: '${resurrectStrategy}'` - ) - } - - /** - * Marks a connection as 'alive'. - * If needed removes the connection from the dead list - * and then resets the `deadCount`. - * If sniffing is not enabled and there is only - * one node, this method is a noop. - * - * @param {object} connection - */ - markAlive (connection) { - if (this._sniffEnabled === false && this.connections.size === 1) return - const { id } = connection - debug(`Marking as 'alive' connection '${id}'`) - const index = this.dead.indexOf(id) - if (index > -1) this.dead.splice(index, 1) - connection.status = Connection.statuses.ALIVE - connection.deadCount = 0 - connection.resurrectTimeout = 0 - } - - /** - * Marks a connection as 'dead'. - * If needed adds the connection to the dead list - * and then increments the `deadCount`. - * If sniffing is not enabled and there is only - * one node, this method is a noop. - * - * @param {object} connection - */ - markDead (connection) { - if (this._sniffEnabled === false && this.connections.size === 1) return - const { id } = connection - debug(`Marking as 'dead' connection '${id}'`) - if (this.dead.indexOf(id) === -1) { - this.dead.push(id) - } - connection.status = Connection.statuses.DEAD - connection.deadCount++ - // resurrectTimeout formula: - // `resurrectTimeout * 2 ** min(deadCount - 1, resurrectTimeoutCutoff)` - connection.resurrectTimeout = Date.now() + this.resurrectTimeout * Math.pow( - 2, Math.min(connection.deadCount - 1, this.resurrectTimeoutCutoff) - ) - - // sort the dead list in ascending order - // based on the resurrectTimeout - this.dead.sort((a, b) => { - const conn1 = this.connections.get(a) - const conn2 = this.connections.get(b) - return conn1.resurrectTimeout - conn2.resurrectTimeout - }) - } - - /** - * If enabled, tries to resurrect a connection with the given - * resurrect strategy ('ping', 'optimistic', 'none'). - * - * @param {object} { now, requestId } - * @param {function} callback (isAlive, connection) - */ - resurrect (opts, callback = noop) { - if (this.resurrectStrategy === 0 || this.dead.length === 0) { - debug('Nothing to resurrect') - callback(null, null) - return - } - - // the dead list is sorted in ascending order based on the timeout - // so the first element will always be the one with the smaller timeout - const connection = this.connections.get(this.dead[0]) - if ((opts.now || Date.now()) < connection.resurrectTimeout) { - debug('Nothing to resurrect') - callback(null, null) - return - } - - const { id } = connection - - // ping strategy - if (this.resurrectStrategy === 1) { - connection.request({ - method: 'HEAD', - path: '/', - timeout: this.pingTimeout - }, (err, response) => { - var isAlive = true - const statusCode = response !== null ? response.statusCode : 0 - if (err != null || - (statusCode === 502 || statusCode === 503 || statusCode === 504)) { - debug(`Resurrect: connection '${id}' is still dead`) - this.markDead(connection) - isAlive = false - } else { - debug(`Resurrect: connection '${id}' is now alive`) - this.markAlive(connection) - } - this.emit('resurrect', null, { - strategy: 'ping', - name: opts.name, - request: { id: opts.requestId }, - isAlive, - connection - }) - callback(isAlive, connection) - }) - // optimistic strategy - } else { - debug(`Resurrect: optimistic resurrection for connection '${id}'`) - this.dead.splice(this.dead.indexOf(id), 1) - connection.status = Connection.statuses.ALIVE - this.emit('resurrect', null, { - strategy: 'optimistic', - name: opts.name, - request: { id: opts.requestId }, - isAlive: true, - connection - }) - // eslint-disable-next-line standard/no-callback-literal - callback(true, connection) - } - } - - /** - * Returns an alive connection if present, - * otherwise returns null. - * By default it filters the `master` only nodes. - * It uses the selector to choose which - * connection return. - * - * @param {object} options (filter and selector) - * @returns {object|null} connection - */ - getConnection (opts = {}) { - const filter = opts.filter || (() => true) - const selector = opts.selector || (c => c[0]) - - // TODO: can we cache this? - const connections = [] - for (var connection of this.connections.values()) { - if (connection.status === Connection.statuses.ALIVE) { - if (filter(connection) === true) { - connections.push(connection) - } - } - } - - if (connections.length === 0) return null - - return selector(connections) - } - - /** - * Adds a new connection to the pool. - * - * @param {object|string} host - * @returns {ConnectionPool} - */ - addConnection (opts) { - if (Array.isArray(opts)) { - opts.forEach(o => this.addConnection(o)) - return - } - - if (typeof opts === 'string') { - opts = this.urlToHost(opts) - } - - if (opts.url.username !== '' && opts.url.password !== '') { - opts.auth = { - username: decodeURIComponent(opts.url.username), - password: decodeURIComponent(opts.url.password) - } - } else if (this.auth !== null) { - opts.auth = this.auth - } - - if (opts.ssl == null) opts.ssl = this._ssl - if (opts.agent == null) opts.agent = this._agent - - const connection = new this.Connection(opts) - debug('Adding a new connection', connection) - if (this.connections.has(connection.id)) { - throw new Error(`Connection with id '${connection.id}' is already present`) - } - this.connections.set(connection.id, connection) - return connection - } - - /** - * Removes a new connection to the pool. - * - * @param {object} connection - * @returns {ConnectionPool} - */ - removeConnection (connection) { - debug('Removing connection', connection) - connection.close(noop) - const { id } = connection - this.connections.delete(id) - var index = this.dead.indexOf(id) - if (index > -1) this.dead.splice(index, 1) - return this - } - - /** - * Empties the connection pool. - * - * @returns {ConnectionPool} - */ - empty (callback) { - debug('Emptying the connection pool') - var openConnections = this.connections.size - this.connections.forEach(connection => { - connection.close(() => { - if (--openConnections === 0) { - this.connections = new Map() - this.dead = [] - callback() - } - }) - }) - } - - /** - * Update the ConnectionPool with new connections. - * - * @param {array} array of connections - * @returns {ConnectionPool} - */ - update (connections) { - debug('Updating the connection pool') - for (var i = 0; i < connections.length; i++) { - const connection = connections[i] - // if we already have a given connection in the pool - // we check its status, if is 'alive', we do nothing, - // if 'dead' we mark it as alive, we do not close the old - // one to avoid socket issues - if (this.connections.has(connection.id) === true) { - debug(`The connection with id '${connection.id}' is already present`) - const oldConnection = this.connections.get(connection.id) - if (oldConnection.status === Connection.statuses.DEAD) { - this.markAlive(oldConnection) - } - // in case the user has passed a single url (or an array of urls), - // the connection id will be the full href; to avoid closing valid connections - // because are not present in the pool, we check also the node url, - // and if is already present we update its id with the ES provided one. - } else if (this.connections.has(connection.url.href) === true) { - const oldConnection = this.connections.get(connection.url.href) - this.connections.delete(connection.url.href) - oldConnection.id = connection.id - this.connections.set(connection.id, oldConnection) - if (oldConnection.status === Connection.statuses.DEAD) { - this.markAlive(oldConnection) - } - } else { - this.addConnection(connection) - } - } - - const ids = connections.map(c => c.id) - // remove all the dead connections and old connections - for (const connection of this.connections.values()) { - if (ids.indexOf(connection.id) === -1) { - this.removeConnection(connection) - } - } - - return this - } - - /** - * Transforms the nodes objects to a host object. - * - * @param {object} nodes - * @returns {array} hosts - */ - nodesToHost (nodes, protocol) { - const ids = Object.keys(nodes) - const hosts = [] - - for (var i = 0, len = ids.length; i < len; i++) { - const node = nodes[ids[i]] - // If there is no protocol in - // the `publish_address` new URL will throw - // the publish_address can have two forms: - // - ip:port - // - hostname/ip:port - // if we encounter the second case, we should - // use the hostname instead of the ip - var address = node.http.publish_address - const parts = address.split('/') - // the url is in the form of hostname/ip:port - if (parts.length > 1) { - const hostname = parts[0] - const port = parts[1].match(/((?::))(?:[0-9]+)$/g)[0].slice(1) - address = `${hostname}:${port}` - } - - address = address.slice(0, 4) === 'http' - ? address - : `${protocol}//${address}` - const roles = node.roles.reduce((acc, role) => { - acc[role] = true - return acc - }, {}) - - hosts.push({ - url: new URL(address), - id: ids[i], - roles: Object.assign({ - [Connection.roles.MASTER]: true, - [Connection.roles.DATA]: true, - [Connection.roles.INGEST]: true, - [Connection.roles.ML]: false - }, roles) - }) - } - - return hosts - } - - /** - * Transforms an url string to a host object - * - * @param {string} url - * @returns {object} host - */ - urlToHost (url) { - return { - url: new URL(url) - } - } -} - -ConnectionPool.resurrectStrategies = { - none: 0, - ping: 1, - optimistic: 2 -} - -// https://gist.github.com/guilhermepontes/17ae0cc71fa2b13ea8c20c94c5c35dc4 -// const shuffleArray = arr => arr -// .map(a => [Math.random(), a]) -// .sort((a, b) => a[0] - b[0]) -// .map(a => a[1]) - -module.exports = ConnectionPool diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 98ab2d43a..8099de2ea 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -2,7 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information -import ConnectionPool from './ConnectionPool'; +import { ConnectionPool, CloudConnectionPool } from './pool'; import Connection from './Connection'; import Serializer from './Serializer'; @@ -23,7 +23,7 @@ declare type emitFn = (event: string | symbol, ...args: any[]) => boolean; interface TransportOptions { emit: emitFn & noopFn; - connectionPool: ConnectionPool; + connectionPool: ConnectionPool | CloudConnectionPool; serializer: Serializer; maxRetries: number; requestTimeout: number | string; @@ -113,7 +113,7 @@ export default class Transport { DEFAULT: string; }; emit: emitFn & noopFn; - connectionPool: ConnectionPool; + connectionPool: ConnectionPool | CloudConnectionPool; serializer: Serializer; maxRetries: number; requestTimeout: number; diff --git a/lib/Transport.js b/lib/Transport.js index 76862b98c..7e5b83681 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -314,10 +314,12 @@ class Transport { if (this._sniffEnabled === true && now > this._nextSniff) { this.sniff({ reason: Transport.sniffReasons.SNIFF_INTERVAL, requestId: opts.requestId }) } - this.connectionPool.resurrect({ now, requestId: opts.requestId, name: this.name }) return this.connectionPool.getConnection({ filter: this.nodeFilter, - selector: this.nodeSelector + selector: this.nodeSelector, + requestId: opts.requestId, + name: this.name, + now }) } diff --git a/lib/pool/BaseConnectionPool.js b/lib/pool/BaseConnectionPool.js new file mode 100644 index 000000000..6241ace5f --- /dev/null +++ b/lib/pool/BaseConnectionPool.js @@ -0,0 +1,239 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +const { URL } = require('url') +const debug = require('debug')('elasticsearch') +const Connection = require('../Connection') +const noop = () => {} + +class BaseConnectionPool { + constructor (opts) { + // list of nodes and weights + this.connections = [] + // how many nodes we have in our scheduler + this.size = this.connections.length + this.Connection = opts.Connection + this.emit = opts.emit || noop + this.auth = opts.auth || null + this._ssl = opts.ssl + this._agent = opts.agent + } + + getConnection () { + throw new Error('getConnection must be implemented') + } + + markAlive () { + return this + } + + markDead () { + return this + } + + /** + * Creates a new connection instance. + */ + createConnection (opts) { + if (typeof opts === 'string') { + opts = this.urlToHost(opts) + } + + if (opts.url.username !== '' && opts.url.password !== '') { + opts.auth = { + username: decodeURIComponent(opts.url.username), + password: decodeURIComponent(opts.url.password) + } + } else if (this.auth !== null) { + opts.auth = this.auth + } + + if (opts.ssl == null) opts.ssl = this._ssl + if (opts.agent == null) opts.agent = this._agent + + const connection = new this.Connection(opts) + + for (const conn of this.connections) { + if (conn.id === connection.id) { + throw new Error(`Connection with id '${connection.id}' is already present`) + } + } + + return connection + } + + /** + * Adds a new connection to the pool. + * + * @param {object|string} host + * @returns {ConnectionPool} + */ + addConnection (opts) { + if (Array.isArray(opts)) { + return opts.forEach(o => this.addConnection(o)) + } + + if (typeof opts === 'string') { + opts = this.urlToHost(opts) + } + + const connectionById = this.connections.find(c => c.id === opts.id) + const connectionByUrl = this.connections.find(c => c.id === opts.url.href) + + if (connectionById || connectionByUrl) { + throw new Error(`Connection with id '${opts.id || opts.url.href}' is already present`) + } + + this.update([...this.connections, opts]) + return this.connections[this.size - 1] + } + + /** + * Removes a new connection to the pool. + * + * @param {object} connection + * @returns {ConnectionPool} + */ + removeConnection (connection) { + debug('Removing connection', connection) + return this.update(this.connections.filter(c => c.id !== connection.id)) + } + + /** + * Empties the connection pool. + * + * @returns {ConnectionPool} + */ + empty (callback) { + debug('Emptying the connection pool') + var openConnections = this.size + this.connections.forEach(connection => { + connection.close(() => { + if (--openConnections === 0) { + this.connections = [] + this.size = this.connections.length + callback() + } + }) + }) + } + + /** + * Update the ConnectionPool with new connections. + * + * @param {array} array of connections + * @returns {ConnectionPool} + */ + update (nodes) { + debug('Updating the connection pool') + const newConnections = [] + const oldConnections = [] + + for (const node of nodes) { + // if we already have a given connection in the pool + // we mark it as alive and we do not close the connection + // to avoid socket issues + const connectionById = this.connections.find(c => c.id === node.id) + const connectionByUrl = this.connections.find(c => c.id === node.url.href) + if (connectionById) { + debug(`The connection with id '${node.id}' is already present`) + this.markAlive(connectionById) + newConnections.push(connectionById) + // in case the user has passed a single url (or an array of urls), + // the connection id will be the full href; to avoid closing valid connections + // because are not present in the pool, we check also the node url, + // and if is already present we update its id with the ES provided one. + } else if (connectionByUrl) { + connectionByUrl.id = node.id + this.markAlive(connectionByUrl) + newConnections.push(connectionByUrl) + } else { + newConnections.push(this.createConnection(node)) + } + } + + const ids = nodes.map(c => c.id) + // remove all the dead connections and old connections + for (const connection of this.connections) { + if (ids.indexOf(connection.id) === -1) { + oldConnections.push(connection) + } + } + + // close old connections + oldConnections.forEach(connection => connection.close()) + + this.connections = newConnections + this.size = this.connections.length + + return this + } + + /** + * Transforms the nodes objects to a host object. + * + * @param {object} nodes + * @returns {array} hosts + */ + nodesToHost (nodes, protocol) { + const ids = Object.keys(nodes) + const hosts = [] + + for (var i = 0, len = ids.length; i < len; i++) { + const node = nodes[ids[i]] + // If there is no protocol in + // the `publish_address` new URL will throw + // the publish_address can have two forms: + // - ip:port + // - hostname/ip:port + // if we encounter the second case, we should + // use the hostname instead of the ip + var address = node.http.publish_address + const parts = address.split('/') + // the url is in the form of hostname/ip:port + if (parts.length > 1) { + const hostname = parts[0] + const port = parts[1].match(/((?::))(?:[0-9]+)$/g)[0].slice(1) + address = `${hostname}:${port}` + } + + address = address.slice(0, 4) === 'http' + ? address + : `${protocol}//${address}` + const roles = node.roles.reduce((acc, role) => { + acc[role] = true + return acc + }, {}) + + hosts.push({ + url: new URL(address), + id: ids[i], + roles: Object.assign({ + [Connection.roles.MASTER]: true, + [Connection.roles.DATA]: true, + [Connection.roles.INGEST]: true, + [Connection.roles.ML]: false + }, roles) + }) + } + + return hosts + } + + /** + * Transforms an url string to a host object + * + * @param {string} url + * @returns {object} host + */ + urlToHost (url) { + return { + url: new URL(url) + } + } +} + +module.exports = BaseConnectionPool diff --git a/lib/pool/CloudConnectionPool.js b/lib/pool/CloudConnectionPool.js new file mode 100644 index 000000000..0ff5a4da2 --- /dev/null +++ b/lib/pool/CloudConnectionPool.js @@ -0,0 +1,49 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +const BaseConnectionPool = require('./BaseConnectionPool') + +class CloudConnectionPool extends BaseConnectionPool { + constructor (opts = {}) { + super(opts) + this.cloudConnection = null + } + + /** + * Returns the only cloud connection. + * + * @returns {object} connection + */ + getConnection () { + return this.cloudConnection + } + + /** + * Empties the connection pool. + * + * @returns {ConnectionPool} + */ + empty (callback) { + super.empty(() => { + this.cloudConnection = null + callback() + }) + } + + /** + * Update the ConnectionPool with new connections. + * + * @param {array} array of connections + * @returns {ConnectionPool} + */ + update (connections) { + super.update(connections) + this.cloudConnection = this.connections[0] + return this + } +} + +module.exports = CloudConnectionPool diff --git a/lib/pool/ConnectionPool.js b/lib/pool/ConnectionPool.js new file mode 100644 index 000000000..8114ced3e --- /dev/null +++ b/lib/pool/ConnectionPool.js @@ -0,0 +1,232 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +const BaseConnectionPool = require('./BaseConnectionPool') +const assert = require('assert') +const debug = require('debug')('elasticsearch') +const Connection = require('../Connection') +const noop = () => {} + +class ConnectionPool extends BaseConnectionPool { + constructor (opts = {}) { + super(opts) + + this.dead = [] + // the resurrect timeout is 60s + this.resurrectTimeout = 1000 * 60 + // number of consecutive failures after which + // the timeout doesn't increase + this.resurrectTimeoutCutoff = 5 + this.pingTimeout = opts.pingTimeout + this._sniffEnabled = opts.sniffEnabled || false + + const resurrectStrategy = opts.resurrectStrategy || 'ping' + this.resurrectStrategy = ConnectionPool.resurrectStrategies[resurrectStrategy] + assert( + this.resurrectStrategy != null, + `Invalid resurrection strategy: '${resurrectStrategy}'` + ) + } + + /** + * Marks a connection as 'alive'. + * If needed removes the connection from the dead list + * and then resets the `deadCount`. + * If sniffing is not enabled and there is only + * one node, this method is a noop. + * + * @param {object} connection + */ + markAlive (connection) { + if (this._sniffEnabled === false && this.size === 1) return this + const { id } = connection + debug(`Marking as 'alive' connection '${id}'`) + const index = this.dead.indexOf(id) + if (index > -1) this.dead.splice(index, 1) + connection.status = Connection.statuses.ALIVE + connection.deadCount = 0 + connection.resurrectTimeout = 0 + return this + } + + /** + * Marks a connection as 'dead'. + * If needed adds the connection to the dead list + * and then increments the `deadCount`. + * If sniffing is not enabled and there is only + * one node, this method is a noop. + * + * @param {object} connection + */ + markDead (connection) { + if (this._sniffEnabled === false && this.size === 1) return this + const { id } = connection + debug(`Marking as 'dead' connection '${id}'`) + if (this.dead.indexOf(id) === -1) { + this.dead.push(id) + } + connection.status = Connection.statuses.DEAD + connection.deadCount++ + // resurrectTimeout formula: + // `resurrectTimeout * 2 ** min(deadCount - 1, resurrectTimeoutCutoff)` + connection.resurrectTimeout = Date.now() + this.resurrectTimeout * Math.pow( + 2, Math.min(connection.deadCount - 1, this.resurrectTimeoutCutoff) + ) + + // sort the dead list in ascending order + // based on the resurrectTimeout + this.dead.sort((a, b) => { + const conn1 = this.connections.find(c => c.id === a) + const conn2 = this.connections.find(c => c.id === b) + return conn1.resurrectTimeout - conn2.resurrectTimeout + }) + + return this + } + + /** + * If enabled, tries to resurrect a connection with the given + * resurrect strategy ('ping', 'optimistic', 'none'). + * + * @param {object} { now, requestId } + * @param {function} callback (isAlive, connection) + */ + resurrect (opts, callback = noop) { + if (this.resurrectStrategy === 0 || this.dead.length === 0) { + debug('Nothing to resurrect') + callback(null, null) + return + } + + // the dead list is sorted in ascending order based on the timeout + // so the first element will always be the one with the smaller timeout + const connection = this.connections.find(c => c.id === this.dead[0]) + if ((opts.now || Date.now()) < connection.resurrectTimeout) { + debug('Nothing to resurrect') + callback(null, null) + return + } + + const { id } = connection + + // ping strategy + if (this.resurrectStrategy === 1) { + connection.request({ + method: 'HEAD', + path: '/', + timeout: this.pingTimeout + }, (err, response) => { + var isAlive = true + const statusCode = response !== null ? response.statusCode : 0 + if (err != null || + (statusCode === 502 || statusCode === 503 || statusCode === 504)) { + debug(`Resurrect: connection '${id}' is still dead`) + this.markDead(connection) + isAlive = false + } else { + debug(`Resurrect: connection '${id}' is now alive`) + this.markAlive(connection) + } + this.emit('resurrect', null, { + strategy: 'ping', + name: opts.name, + request: { id: opts.requestId }, + isAlive, + connection + }) + callback(isAlive, connection) + }) + // optimistic strategy + } else { + debug(`Resurrect: optimistic resurrection for connection '${id}'`) + this.dead.splice(this.dead.indexOf(id), 1) + connection.status = Connection.statuses.ALIVE + this.emit('resurrect', null, { + strategy: 'optimistic', + name: opts.name, + request: { id: opts.requestId }, + isAlive: true, + connection + }) + // eslint-disable-next-line standard/no-callback-literal + callback(true, connection) + } + } + + /** + * Returns an alive connection if present, + * otherwise returns null. + * By default it filters the `master` only nodes. + * It uses the selector to choose which + * connection return. + * + * @param {object} options (filter and selector) + * @returns {object|null} connection + */ + getConnection (opts = {}) { + const filter = opts.filter || (() => true) + const selector = opts.selector || (c => c[0]) + + this.resurrect({ + now: opts.now, + requestId: opts.requestId, + name: opts.name + }) + + // TODO: can we cache this? + const connections = [] + for (var i = 0; i < this.size; i++) { + const connection = this.connections[i] + if (connection.status === Connection.statuses.ALIVE) { + if (filter(connection) === true) { + connections.push(connection) + } + } + } + + if (connections.length === 0) return null + + return selector(connections) + } + + /** + * Empties the connection pool. + * + * @returns {ConnectionPool} + */ + empty (callback) { + super.empty(() => { + this.dead = [] + callback() + }) + } + + /** + * Update the ConnectionPool with new connections. + * + * @param {array} array of connections + * @returns {ConnectionPool} + */ + update (connections) { + super.update(connections) + + for (var i = 0; i < this.dead.length; i++) { + if (this.connections.find(c => c.id === this.dead[i]) === undefined) { + this.dead.splice(i, 1) + } + } + + return this + } +} + +ConnectionPool.resurrectStrategies = { + none: 0, + ping: 1, + optimistic: 2 +} + +module.exports = ConnectionPool diff --git a/lib/ConnectionPool.d.ts b/lib/pool/index.d.ts similarity index 70% rename from lib/ConnectionPool.d.ts rename to lib/pool/index.d.ts index b1e77f0fc..16894eec7 100644 --- a/lib/ConnectionPool.d.ts +++ b/lib/pool/index.d.ts @@ -5,24 +5,34 @@ /// import { SecureContextOptions } from 'tls'; -import Connection, { AgentOptions } from './Connection'; -import { nodeFilterFn, nodeSelectorFn } from './Transport'; +import Connection, { AgentOptions } from '../Connection'; +import { nodeFilterFn, nodeSelectorFn } from '../Transport'; -interface ConnectionPoolOptions { +interface BaseConnectionPoolOptions { ssl?: SecureContextOptions; agent?: AgentOptions; - auth: BasicAuth | ApiKeyAuth; + auth?: BasicAuth | ApiKeyAuth; + emit: (event: string | symbol, ...args: any[]) => boolean; pingTimeout?: number; Connection: typeof Connection; resurrectStrategy?: string; } -export interface getConnectionOptions { +interface ConnectionPoolOptions extends BaseConnectionPoolOptions { + pingTimeout?: number; + resurrectStrategy?: string; + sniffEnabled?: boolean; +} + +interface getConnectionOptions { filter?: nodeFilterFn; selector?: nodeSelectorFn; + requestId?: string | number; + name?: string; + now?: number; } -export interface ApiKeyAuth { +interface ApiKeyAuth { apiKey: | string | { @@ -31,18 +41,18 @@ export interface ApiKeyAuth { } } -export interface BasicAuth { +interface BasicAuth { username: string; password: string; } -export interface resurrectOptions { +interface resurrectOptions { now?: number; requestId: string; name: string; } -export interface ResurrectEvent { +interface ResurrectEvent { strategy: string; isAlive: boolean; connection: Connection; @@ -52,24 +62,14 @@ export interface ResurrectEvent { }; } -export default class ConnectionPool { - static resurrectStrategies: { - none: number; - ping: number; - optimistic: number; - }; - connections: any; - dead: string[]; + +declare class BaseConnectionPool { + connections: Connection[]; _ssl: SecureContextOptions | null; _agent: AgentOptions | null; - _sniffEnabled: boolean; - resurrectTimeout: number; - resurrectTimeoutCutoff: number; - pingTimeout: number; auth: BasicAuth | ApiKeyAuth; Connection: typeof Connection; - resurrectStrategy: number; - constructor(opts?: ConnectionPoolOptions); + constructor(opts?: BaseConnectionPoolOptions); /** * Marks a connection as 'alive'. * If needed removes the connection from the dead list @@ -77,7 +77,7 @@ export default class ConnectionPool { * * @param {object} connection */ - markAlive(connection: Connection): void; + markAlive(connection: Connection): this; /** * Marks a connection as 'dead'. * If needed adds the connection to the dead list @@ -85,15 +85,7 @@ export default class ConnectionPool { * * @param {object} connection */ - markDead(connection: Connection): void; - /** - * If enabled, tries to resurrect a connection with the given - * resurrect strategy ('ping', 'optimistic', 'none'). - * - * @param {object} { now, requestId, name } - * @param {function} callback (isAlive, connection) - */ - resurrect(opts: resurrectOptions, callback?: (isAlive: boolean | null, connection: Connection | null) => void): void; + markDead(connection: Connection): this; /** * Returns an alive connection if present, * otherwise returns null. @@ -111,27 +103,27 @@ export default class ConnectionPool { * @param {object|string} host * @returns {ConnectionPool} */ - addConnection(opts: any): Connection | void; + addConnection(opts: any): Connection; /** * Removes a new connection to the pool. * * @param {object} connection * @returns {ConnectionPool} */ - removeConnection(connection: Connection): ConnectionPool; + removeConnection(connection: Connection): this; /** * Empties the connection pool. * * @returns {ConnectionPool} */ - empty(): ConnectionPool; + empty(): this; /** * Update the ConnectionPool with new connections. * * @param {array} array of connections * @returns {ConnectionPool} */ - update(connections: Connection[]): ConnectionPool; + update(connections: any[]): this; /** * Transforms the nodes objects to a host object. * @@ -148,14 +140,57 @@ export default class ConnectionPool { urlToHost(url: string): any; } +declare class ConnectionPool extends BaseConnectionPool { + static resurrectStrategies: { + none: number; + ping: number; + optimistic: number; + }; + dead: string[]; + _sniffEnabled: boolean; + resurrectTimeout: number; + resurrectTimeoutCutoff: number; + pingTimeout: number; + resurrectStrategy: number; + constructor(opts?: ConnectionPoolOptions); + + /** + * If enabled, tries to resurrect a connection with the given + * resurrect strategy ('ping', 'optimistic', 'none'). + * + * @param {object} { now, requestId, name } + * @param {function} callback (isAlive, connection) + */ + resurrect(opts: resurrectOptions, callback?: (isAlive: boolean | null, connection: Connection | null) => void): void; +} + +declare class CloudConnectionPool extends BaseConnectionPool { + cloudConnection: Connection | null + constructor(opts?: BaseConnectionPoolOptions); + getConnection(): Connection; +} + declare function defaultNodeFilter(node: Connection): boolean; declare function roundRobinSelector(): (connections: Connection[]) => Connection; declare function randomSelector(connections: Connection[]): Connection; -export declare const internals: { +declare const internals: { defaultNodeFilter: typeof defaultNodeFilter; roundRobinSelector: typeof roundRobinSelector; randomSelector: typeof randomSelector; }; -export {}; +export { + // Interfaces + ConnectionPoolOptions, + getConnectionOptions, + ApiKeyAuth, + BasicAuth, + internals, + resurrectOptions, + ResurrectEvent, + // Classes + BaseConnectionPool, + ConnectionPool, + CloudConnectionPool +}; diff --git a/lib/pool/index.js b/lib/pool/index.js new file mode 100644 index 000000000..1cdf1ed4c --- /dev/null +++ b/lib/pool/index.js @@ -0,0 +1,15 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +const BaseConnectionPool = require('./BaseConnectionPool') +const ConnectionPool = require('./ConnectionPool') +const CloudConnectionPool = require('./CloudConnectionPool') + +module.exports = { + BaseConnectionPool, + ConnectionPool, + CloudConnectionPool +} diff --git a/package.json b/package.json index 9c2f4fe0b..8e347d752 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "test:integration": "tap test/integration/index.js -T --no-coverage", "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > $WORKSPACE/test-report-junit.xml", "test:types": "tsc --project ./test/types/tsconfig.json", - "test:coverage": "nyc npm run test:unit && nyc report --reporter=text-lcov > coverage.lcov && codecov", + "test:coverage": "nyc tap test/unit/*.test.js test/behavior/*.test.js -t 300 && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", "lint:fix": "standard --fix", "ci": "npm run license-checker && npm test && npm run test:integration && npm run test:coverage", diff --git a/test/behavior/sniff.test.js b/test/behavior/sniff.test.js index 9377496b1..e2d6638f3 100644 --- a/test/behavior/sniff.test.js +++ b/test/behavior/sniff.test.js @@ -26,7 +26,7 @@ test('Should update the connection pool', t => { const client = new Client({ node: nodes[Object.keys(nodes)[0]].url }) - t.strictEqual(client.connectionPool.connections.size, 1) + t.strictEqual(client.connectionPool.size, 1) client.on(events.SNIFF, (err, request) => { t.error(err) @@ -72,7 +72,7 @@ test('Should update the connection pool', t => { } } - t.strictEqual(client.connectionPool.connections.size, 4) + t.strictEqual(client.connectionPool.size, 4) }) t.teardown(shutdown) }) @@ -85,7 +85,7 @@ test('Should handle hostnames in publish_address', t => { const client = new Client({ node: nodes[Object.keys(nodes)[0]].url }) - t.strictEqual(client.connectionPool.connections.size, 1) + t.strictEqual(client.connectionPool.size, 1) client.on(events.SNIFF, (err, request) => { t.error(err) @@ -105,7 +105,7 @@ test('Should handle hostnames in publish_address', t => { t.strictEqual(hosts[i].url.hostname, 'localhost') } - t.strictEqual(client.connectionPool.connections.size, 4) + t.strictEqual(client.connectionPool.size, 4) }) t.teardown(shutdown) }) @@ -125,13 +125,13 @@ test('Sniff interval', t => { t.error(err) const { hosts, reason } = request.meta.sniff t.strictEqual( - client.connectionPool.connections.size, + client.connectionPool.size, hosts.length ) t.strictEqual(reason, Transport.sniffReasons.SNIFF_INTERVAL) }) - t.strictEqual(client.connectionPool.connections.size, 1) + t.strictEqual(client.connectionPool.size, 1) setTimeout(() => client.info(t.error), 60) setTimeout(() => { @@ -141,7 +141,7 @@ test('Sniff interval', t => { }, 150) setTimeout(() => { - t.strictEqual(client.connectionPool.connections.size, 3) + t.strictEqual(client.connectionPool.size, 3) }, 200) t.teardown(shutdown) @@ -161,13 +161,13 @@ test('Sniff on start', t => { t.error(err) const { hosts, reason } = request.meta.sniff t.strictEqual( - client.connectionPool.connections.size, + client.connectionPool.size, hosts.length ) t.strictEqual(reason, Transport.sniffReasons.SNIFF_ON_START) }) - t.strictEqual(client.connectionPool.connections.size, 1) + t.strictEqual(client.connectionPool.size, 1) t.teardown(shutdown) }) }) @@ -190,11 +190,11 @@ test('Should not close living connections', t => { Connection: MyConnection }) - t.strictEqual(client.connectionPool.connections.size, 1) + t.strictEqual(client.connectionPool.size, 1) client.transport.sniff((err, hosts) => { t.error(err) t.strictEqual( - client.connectionPool.connections.size, + client.connectionPool.size, hosts.length ) }) @@ -228,13 +228,13 @@ test('Sniff on connection fault', t => { Connection: MyConnection }) - t.strictEqual(client.connectionPool.connections.size, 2) + t.strictEqual(client.connectionPool.size, 2) // this event will be triggered by the connection fault client.on(events.SNIFF, (err, request) => { t.error(err) const { hosts, reason } = request.meta.sniff t.strictEqual( - client.connectionPool.connections.size, + client.connectionPool.size, hosts.length ) t.strictEqual(reason, Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT) diff --git a/test/unit/base-connection-pool.test.js b/test/unit/base-connection-pool.test.js new file mode 100644 index 000000000..74d4ff3b7 --- /dev/null +++ b/test/unit/base-connection-pool.test.js @@ -0,0 +1,490 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +const { test } = require('tap') +const { URL } = require('url') +const BaseConnectionPool = require('../../lib/pool/BaseConnectionPool') +const Connection = require('../../lib/Connection') + +test('API', t => { + t.test('addConnection', t => { + const pool = new BaseConnectionPool({ Connection }) + const href = 'http://localhost:9200/' + pool.addConnection(href) + t.ok(pool.connections.find(c => c.id === href) instanceof Connection) + t.strictEqual(pool.connections.find(c => c.id === href).status, Connection.statuses.ALIVE) + t.end() + }) + + t.test('addConnection should throw with two connections with the same id', t => { + const pool = new BaseConnectionPool({ Connection }) + const href = 'http://localhost:9200/' + pool.addConnection(href) + try { + pool.addConnection(href) + t.fail('Should throw') + } catch (err) { + t.is(err.message, `Connection with id '${href}' is already present`) + } + t.end() + }) + + t.test('addConnection should handle not-friendly url parameters for user and password', t => { + const pool = new BaseConnectionPool({ Connection }) + const href = 'http://us"er:p@assword@localhost:9200/' + pool.addConnection(href) + const conn = pool.connections[0] + t.strictEqual(conn.url.username, 'us%22er') + t.strictEqual(conn.url.password, 'p%40assword') + t.match(conn.headers, { + authorization: 'Basic ' + Buffer.from('us"er:p@assword').toString('base64') + }) + t.end() + }) + + t.test('markDead', t => { + const pool = new BaseConnectionPool({ Connection, sniffEnabled: true }) + const href = 'http://localhost:9200/' + var connection = pool.addConnection(href) + t.same(pool.markDead(connection), pool) + connection = pool.connections.find(c => c.id === href) + t.strictEqual(connection.status, Connection.statuses.ALIVE) + t.end() + }) + + t.test('markAlive', t => { + const pool = new BaseConnectionPool({ Connection, sniffEnabled: true }) + const href = 'http://localhost:9200/' + var connection = pool.addConnection(href) + t.same(pool.markAlive(connection), pool) + connection = pool.connections.find(c => c.id === href) + t.strictEqual(connection.status, Connection.statuses.ALIVE) + t.end() + }) + + t.test('getConnection should throw', t => { + const pool = new BaseConnectionPool({ Connection }) + const href = 'http://localhost:9200/' + pool.addConnection(href) + try { + pool.getConnection() + t.fail('Should fail') + } catch (err) { + t.is(err.message, 'getConnection must be implemented') + } + t.end() + }) + + t.test('removeConnection', t => { + const pool = new BaseConnectionPool({ Connection }) + const href = 'http://localhost:9200/' + var connection = pool.addConnection(href) + pool.removeConnection(connection) + t.strictEqual(pool.size, 0) + t.end() + }) + + t.test('empty', t => { + const pool = new BaseConnectionPool({ Connection }) + pool.addConnection('http://localhost:9200/') + pool.addConnection('http://localhost:9201/') + pool.empty(() => { + t.strictEqual(pool.size, 0) + t.end() + }) + }) + + t.test('urlToHost', t => { + const pool = new BaseConnectionPool({ Connection }) + const url = 'http://localhost:9200' + t.deepEqual( + pool.urlToHost(url), + { url: new URL(url) } + ) + t.end() + }) + + t.test('nodesToHost', t => { + t.test('publish_address as ip address (IPv4)', t => { + const pool = new BaseConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: '127.0.0.1:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: '127.0.0.1:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, '127.0.0.1:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, '127.0.0.1:9201') + t.end() + }) + + t.test('publish_address as ip address (IPv6)', t => { + const pool = new BaseConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: '[::1]:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: '[::1]:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://[::1]:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://[::1]:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, '[::1]:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, '[::1]:9201') + t.end() + }) + + t.test('publish_address as host/ip (IPv4)', t => { + const pool = new BaseConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: 'example.com/127.0.0.1:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: 'example.com/127.0.0.1:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://example.com:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://example.com:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, 'example.com:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, 'example.com:9201') + t.end() + }) + + t.test('publish_address as host/ip (IPv6)', t => { + const pool = new BaseConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: 'example.com/[::1]:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: 'example.com/[::1]:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.deepEqual(pool.nodesToHost(nodes, 'http:'), [{ + url: new URL('http://example.com:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }, { + url: new URL('http://example.com:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true, + ml: false + } + }]) + + t.strictEqual(pool.nodesToHost(nodes, 'http:')[0].url.host, 'example.com:9200') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.host, 'example.com:9201') + t.end() + }) + + t.test('Should use the configure protocol', t => { + const pool = new BaseConnectionPool({ Connection }) + const nodes = { + a1: { + http: { + publish_address: 'example.com/127.0.0.1:9200' + }, + roles: ['master', 'data', 'ingest'] + }, + a2: { + http: { + publish_address: 'example.com/127.0.0.1:9201' + }, + roles: ['master', 'data', 'ingest'] + } + } + + t.strictEqual(pool.nodesToHost(nodes, 'https:')[0].url.protocol, 'https:') + t.strictEqual(pool.nodesToHost(nodes, 'http:')[1].url.protocol, 'http:') + t.end() + }) + + t.end() + }) + + t.test('update', t => { + t.test('Should not update existing connections', t => { + t.plan(2) + const pool = new BaseConnectionPool({ Connection }) + pool.addConnection([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true + } + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true + } + }]) + + pool.update([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: null + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: null + }]) + + t.ok(pool.connections.find(c => c.id === 'a1').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a2').roles !== null) + }) + + t.test('Should not update existing connections (mark alive)', t => { + t.plan(5) + class CustomBaseConnectionPool extends BaseConnectionPool { + markAlive (connection) { + t.ok('called') + super.markAlive(connection) + } + } + const pool = new CustomBaseConnectionPool({ Connection }) + const conn1 = pool.addConnection({ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true + } + }) + + const conn2 = pool.addConnection({ + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: { + master: true, + data: true, + ingest: true + } + }) + + pool.markDead(conn1) + pool.markDead(conn2) + + pool.update([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: null + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: null + }]) + + t.ok(pool.connections.find(c => c.id === 'a1').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a2').roles !== null) + }) + + t.test('Should not update existing connections (same url, different id)', t => { + t.plan(3) + class CustomBaseConnectionPool extends BaseConnectionPool { + markAlive (connection) { + t.ok('called') + super.markAlive(connection) + } + } + const pool = new CustomBaseConnectionPool({ Connection }) + pool.addConnection([{ + url: new URL('http://127.0.0.1:9200'), + id: 'http://127.0.0.1:9200/', + roles: { + master: true, + data: true, + ingest: true + } + }]) + + pool.update([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: true + }]) + + // roles will never be updated, we only use it to do + // a dummy check to see if the connection has been updated + t.deepEqual(pool.connections.find(c => c.id === 'a1').roles, { + master: true, + data: true, + ingest: true, + ml: false + }) + t.strictEqual(pool.connections.find(c => c.id === 'http://127.0.0.1:9200/'), undefined) + }) + + t.test('Add a new connection', t => { + t.plan(2) + const pool = new BaseConnectionPool({ Connection }) + pool.addConnection({ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: { + master: true, + data: true, + ingest: true + } + }) + + pool.update([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: null + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a2', + roles: null + }]) + + t.ok(pool.connections.find(c => c.id === 'a1').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a2')) + }) + + t.test('Remove old connections', t => { + t.plan(3) + const pool = new BaseConnectionPool({ Connection }) + pool.addConnection({ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: null + }) + + pool.update([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a2', + roles: null + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a3', + roles: null + }]) + + t.false(pool.connections.find(c => c.id === 'a1')) + t.true(pool.connections.find(c => c.id === 'a2')) + t.true(pool.connections.find(c => c.id === 'a3')) + }) + + t.end() + }) + + t.test('CreateConnection', t => { + t.plan(1) + const pool = new BaseConnectionPool({ Connection }) + const conn = pool.createConnection('http://localhost:9200') + pool.connections.push(conn) + try { + pool.createConnection('http://localhost:9200') + t.fail('Should throw') + } catch (err) { + t.is(err.message, 'Connection with id \'http://localhost:9200/\' is already present') + } + }) + + t.end() +}) diff --git a/test/unit/client.test.js b/test/unit/client.test.js index 2c7bcc683..f6a86a985 100644 --- a/test/unit/client.test.js +++ b/test/unit/client.test.js @@ -7,6 +7,7 @@ const { test } = require('tap') const { URL } = require('url') const { Client, ConnectionPool, Transport } = require('../../index') +const { CloudConnectionPool } = require('../../lib/pool') const { buildServer } = require('../utils') test('Configure host', t => { @@ -15,7 +16,7 @@ test('Configure host', t => { node: 'http://localhost:9200' }) const pool = client.connectionPool - t.match(pool.connections.get('http://localhost:9200/'), { + t.match(pool.connections.find(c => c.id === 'http://localhost:9200/'), { url: new URL('http://localhost:9200'), id: 'http://localhost:9200/', ssl: null, @@ -36,7 +37,7 @@ test('Configure host', t => { nodes: ['http://localhost:9200', 'http://localhost:9201'] }) const pool = client.connectionPool - t.match(pool.connections.get('http://localhost:9200/'), { + t.match(pool.connections.find(c => c.id === 'http://localhost:9200/'), { url: new URL('http://localhost:9200'), id: 'http://localhost:9200/', ssl: null, @@ -49,7 +50,7 @@ test('Configure host', t => { ml: false } }) - t.match(pool.connections.get('http://localhost:9201/'), { + t.match(pool.connections.find(c => c.id === 'http://localhost:9201/'), { url: new URL('http://localhost:9201'), id: 'http://localhost:9201/', ssl: null, @@ -80,7 +81,7 @@ test('Configure host', t => { } }) const pool = client.connectionPool - t.match(pool.connections.get('node'), { + t.match(pool.connections.find(c => c.id === 'node'), { url: new URL('http://localhost:9200'), id: 'node', ssl: 'ssl', @@ -88,7 +89,7 @@ test('Configure host', t => { resurrectTimeout: 0 }) - t.deepEqual(pool.connections.get('node').roles, { + t.deepEqual(pool.connections.find(c => c.id === 'node').roles, { master: true, data: false, ingest: false, @@ -121,7 +122,7 @@ test('Configure host', t => { }] }) const pool = client.connectionPool - t.match(pool.connections.get('node1'), { + t.match(pool.connections.find(c => c.id === 'node1'), { url: new URL('http://localhost:9200'), id: 'node1', ssl: 'ssl', @@ -129,14 +130,14 @@ test('Configure host', t => { resurrectTimeout: 0 }) - t.deepEqual(pool.connections.get('node1').roles, { + t.deepEqual(pool.connections.find(c => c.id === 'node1').roles, { master: true, data: false, ingest: false, ml: false }) - t.match(pool.connections.get('node2'), { + t.match(pool.connections.find(c => c.id === 'node2'), { url: new URL('http://localhost:9200'), id: 'node2', ssl: 'ssl', @@ -144,7 +145,7 @@ test('Configure host', t => { resurrectTimeout: 0 }) - t.deepEqual(pool.connections.get('node2').roles, { + t.deepEqual(pool.connections.find(c => c.id === 'node2').roles, { master: false, data: true, ingest: false, @@ -163,7 +164,7 @@ test('Configure host', t => { } }) const pool = client.connectionPool - t.match(pool.connections.get('node'), { + t.match(pool.connections.find(c => c.id === 'node'), { url: new URL('http://localhost:9200'), headers: { 'x-foo': 'bar' } }) @@ -755,7 +756,7 @@ test('Extend client APIs', t => { test('Elastic cloud config', t => { t.test('Basic', t => { - t.plan(4) + t.plan(5) const client = new Client({ cloud: { // 'localhost$abcd$efgh' @@ -766,7 +767,8 @@ test('Elastic cloud config', t => { }) const pool = client.connectionPool - t.match(pool.connections.get('https://abcd.localhost/'), { + t.ok(pool instanceof CloudConnectionPool) + t.match(pool.connections.find(c => c.id === 'https://abcd.localhost/'), { url: new URL('https://elastic:changeme@abcd.localhost'), id: 'https://abcd.localhost/', headers: { @@ -789,7 +791,7 @@ test('Elastic cloud config', t => { }) t.test('Auth as separate option', t => { - t.plan(4) + t.plan(5) const client = new Client({ cloud: { // 'localhost$abcd$efgh' @@ -802,7 +804,8 @@ test('Elastic cloud config', t => { }) const pool = client.connectionPool - t.match(pool.connections.get('https://abcd.localhost/'), { + t.ok(pool instanceof CloudConnectionPool) + t.match(pool.connections.find(c => c.id === 'https://abcd.localhost/'), { url: new URL('https://elastic:changeme@abcd.localhost'), id: 'https://abcd.localhost/', headers: { @@ -825,7 +828,7 @@ test('Elastic cloud config', t => { }) t.test('Override default options', t => { - t.plan(3) + t.plan(4) const client = new Client({ cloud: { // 'localhost$abcd$efgh' @@ -840,6 +843,7 @@ test('Elastic cloud config', t => { } }) + t.ok(client.connectionPool instanceof CloudConnectionPool) t.strictEqual(client.transport.compression, false) t.strictEqual(client.transport.suggestCompression, false) t.deepEqual(client.connectionPool._ssl, { secureProtocol: 'TLSv1_1_method' }) diff --git a/test/unit/cloud-connection-pool.test.js b/test/unit/cloud-connection-pool.test.js new file mode 100644 index 000000000..e0cb1a499 --- /dev/null +++ b/test/unit/cloud-connection-pool.test.js @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +const { test } = require('tap') +const { CloudConnectionPool } = require('../../lib/pool') +const Connection = require('../../lib/Connection') + +test('Should expose a cloudConnection property', t => { + const pool = new CloudConnectionPool({ Connection }) + pool.addConnection('http://localhost:9200/') + t.ok(pool.cloudConnection instanceof Connection) + t.end() +}) + +test('Get connection should always return cloudConnection', t => { + const pool = new CloudConnectionPool({ Connection }) + const conn = pool.addConnection('http://localhost:9200/') + t.deepEqual(pool.getConnection(), conn) + t.end() +}) + +test('pool.empty should reset cloudConnection', t => { + const pool = new CloudConnectionPool({ Connection }) + pool.addConnection('http://localhost:9200/') + t.ok(pool.cloudConnection instanceof Connection) + pool.empty(() => { + t.strictEqual(pool.cloudConnection, null) + t.end() + }) +}) diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index 25bb6deec..53234d901 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -6,7 +6,7 @@ const { test } = require('tap') const { URL } = require('url') -const ConnectionPool = require('../../lib/ConnectionPool') +const ConnectionPool = require('../../lib/pool/ConnectionPool') const Connection = require('../../lib/Connection') const { defaultNodeFilter, roundRobinSelector } = require('../../lib/Transport').internals const { connection: { MockConnection, MockConnectionTimeout } } = require('../utils') @@ -16,8 +16,8 @@ test('API', t => { const pool = new ConnectionPool({ Connection }) const href = 'http://localhost:9200/' pool.addConnection(href) - t.ok(pool.connections.get(href) instanceof Connection) - t.strictEqual(pool.connections.get(href).status, Connection.statuses.ALIVE) + t.ok(pool.connections.find(c => c.id === href) instanceof Connection) + t.strictEqual(pool.connections.find(c => c.id === href).status, Connection.statuses.ALIVE) t.deepEqual(pool.dead, []) t.end() }) @@ -53,7 +53,7 @@ test('API', t => { const href = 'http://localhost:9200/' var connection = pool.addConnection(href) pool.markDead(connection) - connection = pool.connections.get(href) + connection = pool.connections.find(c => c.id === href) t.strictEqual(connection.deadCount, 1) t.true(connection.resurrectTimeout > 0) t.deepEqual(pool.dead, [href]) @@ -80,7 +80,7 @@ test('API', t => { var connection = pool.addConnection(href) pool.markDead(connection) pool.markAlive(connection) - connection = pool.connections.get(href) + connection = pool.connections.find(c => c.id === href) t.strictEqual(connection.deadCount, 0) t.strictEqual(connection.resurrectTimeout, 0) t.strictEqual(connection.status, Connection.statuses.ALIVE) @@ -107,7 +107,7 @@ test('API', t => { } pool.resurrect(opts, (isAlive, connection) => { t.true(isAlive) - connection = pool.connections.get(connection.id) + connection = pool.connections.find(c => c.id === connection.id) t.strictEqual(connection.deadCount, 0) t.strictEqual(connection.resurrectTimeout, 0) t.strictEqual(connection.status, Connection.statuses.ALIVE) @@ -133,7 +133,7 @@ test('API', t => { } pool.resurrect(opts, (isAlive, connection) => { t.false(isAlive) - connection = pool.connections.get(connection.id) + connection = pool.connections.find(c => c.id === connection.id) t.strictEqual(connection.deadCount, 2) t.true(connection.resurrectTimeout > 0) t.strictEqual(connection.status, Connection.statuses.DEAD) @@ -161,7 +161,7 @@ test('API', t => { } pool.resurrect(opts, (isAlive, connection) => { t.true(isAlive) - connection = pool.connections.get(connection.id) + connection = pool.connections.find(c => c.id === connection.id) t.strictEqual(connection.deadCount, 1) t.true(connection.resurrectTimeout > 0) t.strictEqual(connection.status, Connection.statuses.ALIVE) @@ -187,7 +187,7 @@ test('API', t => { pool.resurrect(opts, (isAlive, connection) => { t.ok(isAlive === null) t.ok(connection === null) - connection = pool.connections.get(href) + connection = pool.connections.find(c => c.id === href) t.strictEqual(connection.deadCount, 1) t.true(connection.resurrectTimeout > 0) t.strictEqual(connection.status, Connection.statuses.DEAD) @@ -267,7 +267,7 @@ test('API', t => { pool.addConnection('http://localhost:9200/') pool.addConnection('http://localhost:9201/') pool.empty(() => { - t.strictEqual(pool.connections.size, 0) + t.strictEqual(pool.size, 0) t.deepEqual(pool.dead, []) t.end() }) @@ -480,12 +480,7 @@ test('API', t => { t.test('update', t => { t.test('Should not update existing connections', t => { t.plan(2) - class CustomConnectionPool extends ConnectionPool { - markAlive () { - t.fail('Should not be called') - } - } - const pool = new CustomConnectionPool({ Connection }) + const pool = new ConnectionPool({ Connection }) pool.addConnection([{ url: new URL('http://127.0.0.1:9200'), id: 'a1', @@ -514,12 +509,12 @@ test('API', t => { roles: null }]) - t.ok(pool.connections.get('a1').roles !== null) - t.ok(pool.connections.get('a2').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a1').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a2').roles !== null) }) t.test('Should not update existing connections (mark alive)', t => { - t.plan(4) + t.plan(5) class CustomConnectionPool extends ConnectionPool { markAlive (connection) { t.ok('called') @@ -560,15 +555,16 @@ test('API', t => { roles: null }]) - t.ok(pool.connections.get('a1').roles !== null) - t.ok(pool.connections.get('a2').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a1').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a2').roles !== null) }) t.test('Should not update existing connections (same url, different id)', t => { - t.plan(2) + t.plan(3) class CustomConnectionPool extends ConnectionPool { - markAlive () { - t.fail('Should not be called') + markAlive (connection) { + t.ok('called') + super.markAlive(connection) } } const pool = new CustomConnectionPool({ Connection }) @@ -590,13 +586,13 @@ test('API', t => { // roles will never be updated, we only use it to do // a dummy check to see if the connection has been updated - t.deepEqual(pool.connections.get('a1').roles, { + t.deepEqual(pool.connections.find(c => c.id === 'a1').roles, { master: true, data: true, ingest: true, ml: false }) - t.strictEqual(pool.connections.get('http://127.0.0.1:9200/'), undefined) + t.strictEqual(pool.connections.find(c => c.id === 'http://127.0.0.1:9200/'), undefined) }) t.test('Add a new connection', t => { @@ -622,8 +618,8 @@ test('API', t => { roles: null }]) - t.ok(pool.connections.get('a1').roles !== null) - t.true(pool.connections.has('a2')) + t.ok(pool.connections.find(c => c.id === 'a1').roles !== null) + t.ok(pool.connections.find(c => c.id === 'a2')) }) t.test('Remove old connections', t => { @@ -645,9 +641,37 @@ test('API', t => { roles: null }]) - t.false(pool.connections.has('a1')) - t.true(pool.connections.has('a2')) - t.true(pool.connections.has('a3')) + t.false(pool.connections.find(c => c.id === 'a1')) + t.true(pool.connections.find(c => c.id === 'a2')) + t.true(pool.connections.find(c => c.id === 'a3')) + }) + + t.test('Remove old connections (markDead)', t => { + t.plan(5) + const pool = new ConnectionPool({ Connection, sniffEnabled: true }) + const conn = pool.addConnection({ + url: new URL('http://127.0.0.1:9200'), + id: 'a1', + roles: null + }) + + pool.markDead(conn) + t.deepEqual(pool.dead, ['a1']) + + pool.update([{ + url: new URL('http://127.0.0.1:9200'), + id: 'a2', + roles: null + }, { + url: new URL('http://127.0.0.1:9201'), + id: 'a3', + roles: null + }]) + + t.deepEqual(pool.dead, []) + t.false(pool.connections.find(c => c.id === 'a1')) + t.true(pool.connections.find(c => c.id === 'a2')) + t.true(pool.connections.find(c => c.id === 'a3')) }) t.end() @@ -702,22 +726,22 @@ test('Node filter', t => { test('Single node behavior', t => { t.test('sniffing disabled (markDead and markAlive should be noop)', t => { - t.plan(2) + t.plan(4) const pool = new ConnectionPool({ Connection, sniffEnabled: false }) const conn = pool.addConnection('http://localhost:9200/') - pool.markDead(conn) + t.true(pool.markDead(conn) instanceof ConnectionPool) t.strictEqual(pool.dead.length, 0) - pool.markAlive(conn) + t.true(pool.markAlive(conn) instanceof ConnectionPool) t.strictEqual(pool.dead.length, 0) }) t.test('sniffing enabled (markDead and markAlive should work)', t => { - t.plan(2) + t.plan(4) const pool = new ConnectionPool({ Connection, sniffEnabled: true }) const conn = pool.addConnection('http://localhost:9200/') - pool.markDead(conn) + t.true(pool.markDead(conn) instanceof ConnectionPool) t.strictEqual(pool.dead.length, 1) - pool.markAlive(conn) + t.true(pool.markAlive(conn) instanceof ConnectionPool) t.strictEqual(pool.dead.length, 0) }) diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 385dce8ca..cee34db74 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -733,7 +733,7 @@ test('Util.inspect Connection class should hide agent, ssl and auth', t => { resurrectTimeout: 0, _openRequests: 0, status: 'alive', - roles: { master: true, data: true, ingest: true, ml: false } }`) + roles: { master: true, data: true, ingest: true, ml: false }}`) ) }) diff --git a/test/unit/transport.test.js b/test/unit/transport.test.js index 03adcce72..28f95ed45 100644 --- a/test/unit/transport.test.js +++ b/test/unit/transport.test.js @@ -6,6 +6,7 @@ const { test } = require('tap') const { URL } = require('url') +const lolex = require('lolex') const { createGunzip } = require('zlib') const os = require('os') const intoStream = require('into-stream') @@ -23,7 +24,7 @@ const { ConfigurationError } = require('../../lib/errors') -const ConnectionPool = require('../../lib/ConnectionPool') +const ConnectionPool = require('../../lib/pool/ConnectionPool') const Connection = require('../../lib/Connection') const Serializer = require('../../lib/Serializer') const Transport = require('../../lib/Transport') @@ -878,148 +879,95 @@ test('Override requestTimeout', t => { test('sniff', t => { t.test('sniffOnStart', t => { - t.plan(3) - - class CustomConnectionPool extends ConnectionPool { - update () { - t.ok('called') - return this - } + t.plan(1) - nodesToHost (nodes) { - t.ok('called') - return [] + class MyTransport extends Transport { + sniff (opts) { + t.strictEqual(opts.reason, Transport.sniffReasons.SNIFF_ON_START) } } - function handler (req, res) { - t.strictEqual(req.url, '/sniff') - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } - - buildServer(handler, ({ port }, server) => { - const pool = new CustomConnectionPool({ Connection }) - pool.addConnection(`http://localhost:${port}`) - - // eslint-disable-next-line - new Transport({ - emit: () => {}, - connectionPool: pool, - serializer: new Serializer(), - maxRetries: 3, - requestTimeout: 30000, - sniffInterval: false, - sniffOnStart: true, - sniffEndpoint: '/sniff' - }) + const pool = new ConnectionPool({ Connection }) + pool.addConnection('http://localhost:9200') - setTimeout(() => server.stop(), 100) + // eslint-disable-next-line + new MyTransport({ + emit: () => {}, + connectionPool: pool, + serializer: new Serializer(), + maxRetries: 3, + requestTimeout: 30000, + sniffInterval: false, + sniffOnStart: true, + sniffEndpoint: '/sniff' }) }) t.test('sniffOnConnectionFault', t => { - t.plan(3) - - class CustomConnectionPool extends ConnectionPool { - update () { - t.ok('called') - return this - } - - nodesToHost (nodes) { - t.ok('called') - return [] - } - } + t.plan(2) - function handler (req, res) { - if (req.url === '/other/sniff') { - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } else { - setTimeout(() => res.end(), 1000) + class MyTransport extends Transport { + sniff (opts) { + t.strictEqual(opts.reason, Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT) } } - buildServer(handler, ({ port }, server) => { - const pool = new CustomConnectionPool({ Connection }) - pool.addConnection(`http://localhost:${port}`) - pool.addConnection(`http://localhost:${port}/other`) - - const transport = new Transport({ - emit: () => {}, - connectionPool: pool, - serializer: new Serializer(), - maxRetries: 0, - requestTimeout: 500, - sniffInterval: false, - sniffOnConnectionFault: true, - sniffEndpoint: '/sniff' - }) + const pool = new ConnectionPool({ Connection: MockConnectionTimeout }) + pool.addConnection('http://localhost:9200') - transport.request({ - method: 'GET', - path: '/' - }, (err, { body }) => { - t.ok(err instanceof TimeoutError) - }) + const transport = new MyTransport({ + emit: () => {}, + connectionPool: pool, + serializer: new Serializer(), + maxRetries: 0, + requestTimeout: 500, + sniffInterval: false, + sniffOnConnectionFault: true, + sniffEndpoint: '/sniff' + }) - setTimeout(() => server.stop(), 1100) + transport.request({ + method: 'GET', + path: '/' + }, (err, { body }) => { + t.ok(err instanceof TimeoutError) }) }) t.test('sniffInterval', t => { - t.plan(9) + t.plan(6) - class CustomConnectionPool extends ConnectionPool { - update () { - return this - } + const clock = lolex.install({ toFake: ['Date'] }) + t.teardown(() => clock.uninstall()) - nodesToHost (nodes) { - return [] + class MyTransport extends Transport { + sniff (opts) { + t.strictEqual(opts.reason, Transport.sniffReasons.SNIFF_INTERVAL) } } - function handler (req, res) { - // this should be called 6 times - t.ok('called') - res.setHeader('Content-Type', 'application/json;utf=8') - res.end(JSON.stringify({ hello: 'world' })) - } - - buildServer(handler, ({ port }, server) => { - const pool = new CustomConnectionPool({ Connection }) - pool.addConnection(`http://localhost:${port}`) - - const transport = new Transport({ - emit: () => {}, - connectionPool: pool, - serializer: new Serializer(), - maxRetries: 3, - requestTimeout: 3000, - sniffInterval: 1, - sniffEndpoint: '/sniff' - }) + const pool = new ConnectionPool({ Connection: MockConnection }) + pool.addConnection('http://localhost:9200') - const params = { method: 'GET', path: '/' } - setTimeout(() => { - transport.request(params, t.error) - }, 100) + const transport = new MyTransport({ + emit: () => {}, + connectionPool: pool, + serializer: new Serializer(), + maxRetries: 3, + requestTimeout: 3000, + sniffInterval: 1, + sniffEndpoint: '/sniff' + }) - setTimeout(() => { - transport.request(params, t.error) - }, 200) + const params = { method: 'GET', path: '/' } + clock.tick(100) + transport.request(params, t.error) - setTimeout(() => { - transport.request(params, t.error) - }, 300) + clock.tick(200) + transport.request(params, t.error) - setTimeout(() => { - server.stop() - }, 400) - }) + clock.tick(300) + transport.request(params, t.error) }) t.test('errored', t => { From 3324b9f087717fc5a76a4ab7d0d01cafb9992178 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 1 Aug 2019 09:23:11 +0200 Subject: [PATCH 84/84] API generation --- api/api/bulk.js | 4 ++++ api/api/delete_by_query.js | 4 ++++ api/api/exists.js | 4 ++++ api/api/exists_source.js | 4 ++++ api/api/explain.js | 4 ++++ api/api/get.js | 4 ++++ api/api/get_source.js | 4 ++++ api/api/mget.js | 4 ++++ api/api/search.js | 4 ++++ api/api/update.js | 4 ++++ api/api/update_by_query.js | 4 ++++ api/requestParams.d.ts | 22 ++++++++++++++++++++++ 12 files changed, 66 insertions(+) diff --git a/api/api/bulk.js b/api/api/bulk.js index 20c327980..2b6fb9497 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -35,7 +35,9 @@ function buildBulk (opts) { 'type', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'pipeline', 'pretty', 'human', @@ -47,7 +49,9 @@ function buildBulk (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index ce077845d..52e39a97a 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -73,7 +73,9 @@ function buildDeleteByQuery (opts) { 'sort', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'terminate_after', 'stats', 'version', @@ -102,7 +104,9 @@ function buildDeleteByQuery (opts) { searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', diff --git a/api/api/exists.js b/api/api/exists.js index 4f179077d..95ff36acd 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -36,7 +36,9 @@ function buildExists (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -49,7 +51,9 @@ function buildExists (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/exists_source.js b/api/api/exists_source.js index cdd66ba60..0ff4e52ee 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -34,7 +34,9 @@ function buildExistsSource (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -46,7 +48,9 @@ function buildExistsSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/explain.js b/api/api/explain.js index c5cd067f4..ffd054db7 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -43,7 +43,9 @@ function buildExplain (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'pretty', 'human', 'error_trace', @@ -56,7 +58,9 @@ function buildExplain (opts) { defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/get.js b/api/api/get.js index 48c31e384..729fbe743 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -36,7 +36,9 @@ function buildGet (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -49,7 +51,9 @@ function buildGet (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/get_source.js b/api/api/get_source.js index 1b5b8d9ab..8fb652dcb 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -34,7 +34,9 @@ function buildGetSource (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'version', 'version_type', 'pretty', @@ -46,7 +48,9 @@ function buildGetSource (opts) { const snakeCase = { _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' diff --git a/api/api/mget.js b/api/api/mget.js index 1de080c3e..3be4268ce 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -34,7 +34,9 @@ function buildMget (opts) { 'routing', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'pretty', 'human', 'error_trace', @@ -45,7 +47,9 @@ function buildMget (opts) { const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/search.js b/api/api/search.js index 5393c3a8e..e10f79053 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -84,7 +84,9 @@ function buildSearch (opts) { 'sort', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'terminate_after', 'stats', 'suggest_field', @@ -122,7 +124,9 @@ function buildSearch (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', diff --git a/api/api/update.js b/api/api/update.js index 4245a0857..cdf6ad46b 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -34,7 +34,9 @@ function buildUpdate (opts) { 'wait_for_active_shards', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'lang', 'refresh', 'retry_on_conflict', @@ -52,7 +54,9 @@ function buildUpdate (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 8e3eb7429..74054441a 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -76,7 +76,9 @@ function buildUpdateByQuery (opts) { 'sort', '_source', '_source_excludes', + '_source_exclude', '_source_includes', + '_source_include', 'terminate_after', 'stats', 'version', @@ -106,7 +108,9 @@ function buildUpdateByQuery (opts) { searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', + _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', versionType: 'version_type', requestCache: 'request_cache', diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index b69a442e7..8ad7eac75 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -15,6 +15,8 @@ export interface Generic { export interface Bulk extends Generic { index?: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; wait_for_active_shards?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; @@ -371,6 +373,8 @@ export interface Delete extends Generic { export interface DeleteByQuery extends Generic { index: string | string[]; type?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR'; @@ -422,6 +426,8 @@ export interface Exists extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -438,6 +444,8 @@ export interface ExistsSource extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; preference?: string; realtime?: boolean; refresh?: boolean; @@ -453,6 +461,8 @@ export interface Explain extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyze_wildcard?: boolean; analyzer?: string; default_operator?: 'AND' | 'OR'; @@ -481,6 +491,8 @@ export interface Get extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -502,6 +514,8 @@ export interface GetSource extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; preference?: string; realtime?: boolean; refresh?: boolean; @@ -913,6 +927,8 @@ export interface IngestSimulate extends Generic { export interface Mget extends Generic { index?: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; stored_fields?: string | string[]; preference?: string; realtime?: boolean; @@ -1063,6 +1079,8 @@ export interface Scroll extends Generic { export interface Search extends Generic { index?: string | string[]; type?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; ccs_minimize_roundtrips?: boolean; @@ -1245,6 +1263,8 @@ export interface Update extends Generic { id: string; index: string; type?: string; + _source_exclude?: string | string[]; + _source_include?: string | string[]; wait_for_active_shards?: string; _source?: string | string[]; _source_excludes?: string | string[]; @@ -1262,6 +1282,8 @@ export interface Update extends Generic { export interface UpdateByQuery extends Generic { index: string | string[]; type?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; default_operator?: 'AND' | 'OR';