Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3942ed722c | |||
| 2e62e4ac58 | |||
| 060d4ae5fc | |||
| b0861fae0d | |||
| 0918df8e7d | |||
| e86a6371c5 | |||
| 53e326275b | |||
| 48e277fd07 | |||
| 40603cde72 | |||
| 896c742407 | |||
| 22880d4659 | |||
| 21a84654f6 | |||
| bb0ff22fd2 | |||
| 9897ba8831 | |||
| c922661fda | |||
| 597dd28340 | |||
| cc0dc10c64 | |||
| 9c5394ecdb | |||
| 96a103b305 | |||
| 3e9ae8b29c | |||
| 064807c5a9 | |||
| 72b67fe4d7 | |||
| 6f2767628c | |||
| 96137788db | |||
| 8136846a78 | |||
| 62e9805311 | |||
| 907f9d085c | |||
| 0c1fb22631 | |||
| 132072b8ab | |||
| 99ada00747 | |||
| b1458e3511 | |||
| 9dacd9d9ee | |||
| d6577b7fa1 | |||
| ddb72d6e50 | |||
| 9bb2d237e4 | |||
| 4099532617 | |||
| 37544399ce | |||
| 12e88d6f87 | |||
| dbfeb5d1a9 | |||
| 84a837ce11 | |||
| dc009dc3a5 | |||
| d4f4b47d7e | |||
| cfd4e70fb9 | |||
| 68f8b7bb5f | |||
| 777e438482 | |||
| 29beb44bf5 | |||
| ef3126b361 | |||
| 6cc2b21ce2 | |||
| 02c656c364 | |||
| 77fcca871f | |||
| ca0b33a2b0 | |||
| 74c37e5b2d | |||
| 0e47cb88eb | |||
| f97208214e | |||
| 6f4a8bbe6a | |||
| c0264393a1 | |||
| 92bcf46ab4 | |||
| af544e8a55 | |||
| fbf804869f | |||
| f3422a6f43 | |||
| f2c43a843b | |||
| 1f6c68df9c | |||
| c7675708de | |||
| e897d8f050 | |||
| 4537308c38 | |||
| 3a1bb9377a | |||
| e185a0b08c | |||
| 9b111ee664 | |||
| 367f16c0ba | |||
| 1d61cba014 | |||
| 358474bca8 | |||
| c0027b3958 | |||
| 68c4dd29fb | |||
| a3e3d57247 | |||
| c3966cacab | |||
| 048933f106 | |||
| 91935905b6 | |||
| 0f5ac8127c | |||
| 99e1dc3b39 | |||
| e98cab1a34 |
@ -1,11 +1,12 @@
|
||||
---
|
||||
ELASTICSEARCH_VERSION:
|
||||
- 7.0.0-beta1
|
||||
- 7.2.0
|
||||
- 7.1.0
|
||||
- 7.0.0
|
||||
|
||||
NODE_JS_VERSION:
|
||||
- 11
|
||||
- 10
|
||||
- 8
|
||||
- 6
|
||||
- 12
|
||||
- 10
|
||||
- 8
|
||||
|
||||
exclude: ~
|
||||
|
||||
@ -67,3 +67,6 @@ scripts
|
||||
.ci
|
||||
.travis.yml
|
||||
certs
|
||||
.github
|
||||
CODE_OF_CONDUCT.md
|
||||
CONTRIBUTING.md
|
||||
|
||||
14
.travis.yml
14
.travis.yml
@ -5,25 +5,15 @@ sudo: required
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "12"
|
||||
- "10"
|
||||
- "8"
|
||||
- "6"
|
||||
|
||||
env:
|
||||
global:
|
||||
- ELASTICSEARCH_VERSION=7.0.0-beta1
|
||||
- QUIET=true
|
||||
|
||||
before_install:
|
||||
- wget https://artifacts.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:
|
||||
|
||||
3
CODE_OF_CONDUCT.md
Normal file
3
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,3 @@
|
||||
303 See Other
|
||||
|
||||
Location: https://www.elastic.co/community/codeofconduct
|
||||
100
CONTRIBUTING.md
Normal file
100
CONTRIBUTING.md
Normal file
@ -0,0 +1,100 @@
|
||||
# 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.<br/>
|
||||
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 the integration test yourself, see the *Testing* section below.
|
||||
|
||||
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!
|
||||
|
||||
### Code generation
|
||||
|
||||
The entire content of the API folder is generated as well as the `docs/reference.asciidoc` file.<br/>
|
||||
If you want to run the code generation you should run the following command:
|
||||
```sh
|
||||
node scripts/generate --tag <tag name>
|
||||
# or
|
||||
node scripts/generate --branch <branch name>
|
||||
```
|
||||
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.<br/>*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:
|
||||
|
||||
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)*
|
||||
59
README.md
59
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,11 +27,7 @@ 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 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.
|
||||
```
|
||||
@ -46,8 +41,46 @@ 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 <alias>@npm:@elastic/elasticsearch@<version>
|
||||
```
|
||||
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 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' })
|
||||
@ -77,7 +110,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
|
||||
@ -120,6 +155,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;
|
||||
}
|
||||
```
|
||||
|
||||
@ -144,7 +183,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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'
|
||||
}
|
||||
@ -97,17 +101,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,34 +132,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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'
|
||||
}
|
||||
@ -89,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 = ''
|
||||
@ -118,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -51,23 +51,29 @@ 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}`)
|
||||
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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
101
api/api/ccr.forget_follower.js
Normal file
101
api/api/ccr.forget_follower.js
Normal file
@ -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 buildCcrForgetFollower (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
/**
|
||||
* Perform a [ccr.forget_follower](http://www.elastic.co/guide/en/elasticsearch/reference/current) request
|
||||
*
|
||||
* @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 = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrForgetFollower (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['index'] == null) {
|
||||
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') {
|
||||
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 = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'forget_follower'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrForgetFollower
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,11 +24,12 @@
|
||||
|
||||
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
|
||||
*
|
||||
* @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',
|
||||
@ -95,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 = ''
|
||||
@ -124,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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',
|
||||
@ -97,17 +95,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,34 +124,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
100
api/api/data_frame.delete_data_frame_transform.js
Normal file
100
api/api/data_frame.delete_data_frame_transform.js
Normal file
@ -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 buildDataFrameDeleteDataFrameTransform (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
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
|
||||
*
|
||||
* @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 = []
|
||||
var { method, body, transformId, transform_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 = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDataFrameDeleteDataFrameTransform
|
||||
103
api/api/data_frame.get_data_frame_transform.js
Normal file
103
api/api/data_frame.get_data_frame_transform.js
Normal file
@ -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 buildDataFrameGetDataFrameTransform (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
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
|
||||
*
|
||||
* @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 = []
|
||||
var { method, body, transformId, transform_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 ((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
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDataFrameGetDataFrameTransform
|
||||
99
api/api/data_frame.get_data_frame_transform_stats.js
Normal file
99
api/api/data_frame.get_data_frame_transform_stats.js
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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, 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
|
||||
*
|
||||
* @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 = {
|
||||
|
||||
}
|
||||
|
||||
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 = []
|
||||
var { method, body, transformId, transform_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 = ''
|
||||
|
||||
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_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 = buildDataFrameGetDataFrameTransformStats
|
||||
96
api/api/data_frame.preview_data_frame_transform.js
Normal file
96
api/api/data_frame.preview_data_frame_transform.js
Normal file
@ -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 buildDataFramePreviewDataFrameTransform (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
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
|
||||
*
|
||||
* @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 = []
|
||||
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 = '/' + '_data_frame' + '/' + 'transforms' + '/' + '_preview'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDataFramePreviewDataFrameTransform
|
||||
101
api/api/data_frame.put_data_frame_transform.js
Normal file
101
api/api/data_frame.put_data_frame_transform.js
Normal file
@ -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 buildDataFramePutDataFrameTransform (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
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
|
||||
*
|
||||
* @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 = []
|
||||
var { method, body, transformId, transform_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 = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDataFramePutDataFrameTransform
|
||||
101
api/api/data_frame.start_data_frame_transform.js
Normal file
101
api/api/data_frame.start_data_frame_transform.js
Normal file
@ -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 buildDataFrameStartDataFrameTransform (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
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
|
||||
*
|
||||
* @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 = []
|
||||
var { method, body, transformId, transform_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 = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_start'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDataFrameStartDataFrameTransform
|
||||
104
api/api/data_frame.stop_data_frame_transform.js
Normal file
104
api/api/data_frame.stop_data_frame_transform.js
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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, 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
|
||||
*
|
||||
* @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 = []
|
||||
var { method, body, transformId, transform_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 = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stop'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDataFrameStopDataFrameTransform
|
||||
@ -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
|
||||
*
|
||||
@ -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',
|
||||
@ -94,29 +92,23 @@ 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}`)
|
||||
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 = ''
|
||||
@ -135,34 +127,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -86,7 +86,9 @@ function buildDeleteByQuery (opts) {
|
||||
'sort',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'terminate_after',
|
||||
'stats',
|
||||
'version',
|
||||
@ -114,7 +116,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',
|
||||
@ -159,17 +163,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,34 +192,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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,14 +45,15 @@ function buildExists (opts) {
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'stored_fields',
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -66,7 +66,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'
|
||||
@ -104,17 +106,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,34 +135,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,14 +24,13 @@
|
||||
|
||||
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
|
||||
*
|
||||
* @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,14 +43,15 @@ function buildExistsSource (opts) {
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -63,7 +63,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'
|
||||
@ -110,17 +112,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,34 +141,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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,13 +53,14 @@ function buildExplain (opts) {
|
||||
'df',
|
||||
'stored_fields',
|
||||
'lenient',
|
||||
'parent',
|
||||
'preference',
|
||||
'q',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
@ -73,7 +73,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'
|
||||
}
|
||||
@ -106,17 +108,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,34 +137,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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'
|
||||
}
|
||||
@ -79,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 = ''
|
||||
@ -108,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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
|
||||
@ -40,23 +39,20 @@ 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
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'stored_fields',
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
@ -70,8 +66,8 @@ function buildGet (opts) {
|
||||
const snakeCase = {
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
@ -110,17 +106,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 = ''
|
||||
@ -139,34 +135,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,14 +24,13 @@
|
||||
|
||||
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
|
||||
*
|
||||
* @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,14 +43,15 @@ function buildGetSource (opts) {
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -63,7 +63,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'
|
||||
@ -101,17 +103,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,34 +132,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = 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
|
||||
@ -68,17 +68,17 @@ function buildXpackGraphExplore (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,35 +97,9 @@ function buildXpackGraphExplore (opts) {
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
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
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildXpackGraphExplore
|
||||
module.exports = buildGraphExplore
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,16 +24,15 @@
|
||||
|
||||
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
|
||||
*
|
||||
* @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 = {
|
||||
@ -64,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 = ''
|
||||
@ -89,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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',
|
||||
@ -96,29 +94,23 @@ 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}`)
|
||||
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 = ''
|
||||
@ -141,34 +133,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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -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'
|
||||
}
|
||||
@ -86,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 = ''
|
||||
@ -111,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +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,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user