Compare commits

...

30 Commits

Author SHA1 Message Date
ca0b33a2b0 Handle bulk errors in examples 2019-04-01 09:08:58 +02:00
74c37e5b2d Generated reference 2019-03-29 18:08:28 +01:00
0e47cb88eb Docs: Fix ingest doc links (#801)
The ingest docs in Elasticsearch doing point to the actual ingest APIs.
This makes up generate links to the real APIs instead, fixing some
broken links in the 5.x docs in the process.
2019-03-29 18:07:55 +01:00
f97208214e Generated reference 2019-03-29 15:46:44 +01:00
6f4a8bbe6a Docs: Handle more funny cases from ES api spec (#800)
Handles a few "special" doc urls from ES's api spec files. These are
only a problem in 6.x but we'd like to keep the generateDocs script the
same across all branches for easier backporting.
2019-03-29 15:46:17 +01:00
c0264393a1 Update asciidoc config 2019-03-29 15:41:57 +01:00
92bcf46ab4 Generated reference 2019-03-29 08:51:54 +01:00
af544e8a55 Docs: Fix the API reference (#799) 2019-03-29 08:50:57 +01:00
fbf804869f Bumped v7.0.0-rc.1 2019-03-28 19:28:09 +01:00
f3422a6f43 Fix docs (#796)
Follow up of https://github.com/elastic/docs/pull/701.
2019-03-28 17:36:08 +01:00
f2c43a843b Updated CONTRIBUTING.md (#794)
As titled, also renamed the script files for a better DX.
2019-03-28 10:11:04 +01:00
1f6c68df9c v7.0.0-rc1 support 🚀 (#792)
Support for Elasticsearch `v7.0.0-rc1`
2019-03-28 08:32:24 +01:00
c7675708de Added CONTRIBUTING.md and CODE_OF_CONDUCT.md 2019-03-27 16:48:12 +01:00
e897d8f050 Improved integration test runner 2019-03-27 15:00:21 +01:00
4537308c38 Doc updates (#791)
Updates for better displaying the documentation in the website.
2019-03-27 07:45:31 +01:00
3a1bb9377a Merge branch 'master' into 7.x 2019-03-26 12:06:04 +01:00
e185a0b08c Remove url in jenkins job configuration 2019-03-21 11:16:21 -04:00
9b111ee664 CI config (#786)
* Updated ci config

* Minor fixes

* Minor fixes

* Added Node v11
2019-03-21 11:03:35 +01:00
367f16c0ba Updated ci config 2019-03-19 14:16:56 +01:00
1d61cba014 Inspect Connection (#784)
Handles `console.log` and `utils.inspect` invocations for a better debugging experience.

`agent` and `ssl` are hidden since they made the logs very hard to read.
The user can still access them with `instance.agent` and `instance.ssl`.
2019-03-19 09:53:43 +01:00
358474bca8 Feat: Support bundlers (#783)
With this change, we support code bundlers, such as webpack.
Fixes: https://github.com/elastic/elasticsearch-js/issues/781
2019-03-19 09:53:43 +01:00
c0027b3958 Added a note about the new client 2019-03-19 09:53:43 +01:00
68c4dd29fb feat: add support for querystring in options object (#779)
In very few cases, some API uses the same key for both url and query params, such as the bulk method.
The client is not designed to handle such cases since accepts both url and query keys in the same object, and the url parameter will always take precedence.
This pr fixes this edge case by adding a `querystring` key in the options object.

Fixes: https://github.com/elastic/elasticsearch-js/pull/778

```js
client.bulk({
  index: 'index',
  type: '_doc',
  body: [...]
}, {
  querystring: {
    type: '_doc'
  }
}, console.log)
```
2019-03-19 09:53:43 +01:00
a3e3d57247 Updated coverage script 2019-03-15 17:49:24 +01:00
c3966cacab Added codecov badge 2019-03-15 17:49:24 +01:00
048933f106 Updated ignore files 2019-03-15 17:49:24 +01:00
91935905b6 Added codecov (#777) 2019-03-15 17:49:24 +01:00
0f5ac8127c Updated README 2019-03-14 18:33:22 +01:00
99e1dc3b39 API generation 2019-03-13 14:13:53 +01:00
e98cab1a34 Revert d4d7d0bef5 2019-03-13 14:13:32 +01:00
78 changed files with 1652 additions and 1338 deletions

View File

@ -1,6 +1,6 @@
---
ELASTICSEARCH_VERSION:
- 7.0.0-beta1
- 7.0.0-rc1
NODE_JS_VERSION:
- 11

View File

@ -11,7 +11,7 @@ node_js:
env:
global:
- ELASTICSEARCH_VERSION=7.0.0-beta1
- ELASTICSEARCH_VERSION=7.0.0-rc1
- QUIET=true
before_install:

3
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,3 @@
303 See Other
Location: https://www.elastic.co/community/codeofconduct

100
CONTRIBUTING.md Normal file
View 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)*

View File

@ -51,6 +51,12 @@ function buildCcrFollowStats (opts) {
options = {}
}
// check required parameters
if (params['index'] == null) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)

View File

@ -22,25 +22,25 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMigrationUpgrade (opts) {
function buildCcrForgetFollower (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.migration.upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html) request
* Perform a [ccr.forget_follower](http://www.elastic.co/guide/en/elasticsearch/reference/current) request
*
* @param {string} index - The name of the index
* @param {boolean} wait_for_completion - Should the request block until the upgrade operation is completed
* @param {string} index - the name of the leader index for which specified follower retention leases should be removed
* @param {object} body - the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index
*/
const acceptedQuerystring = [
'wait_for_completion'
]
const snakeCase = {
waitForCompletion: 'wait_for_completion'
}
return function xpackMigrationUpgrade (params, options, callback) {
return function ccrForgetFollower (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -57,6 +57,10 @@ function buildXpackMigrationUpgrade (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
@ -79,7 +83,7 @@ function buildXpackMigrationUpgrade (opts) {
var path = ''
path = '/' + '_migration' + '/' + 'upgrade' + '/' + encodeURIComponent(index)
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'forget_follower'
// build request object
const request = {
@ -120,4 +124,4 @@ function buildXpackMigrationUpgrade (opts) {
}
}
module.exports = buildXpackMigrationUpgrade
module.exports = buildCcrForgetFollower

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackGraphExplore (opts) {
function buildGraphExplore (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request
* Perform a [graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request
*
* @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
* @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types
@ -44,7 +44,7 @@ function buildXpackGraphExplore (opts) {
}
return function xpackGraphExplore (params, options, callback) {
return function graphExplore (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -128,4 +128,4 @@ function buildXpackGraphExplore (opts) {
}
}
module.exports = buildXpackGraphExplore
module.exports = buildGraphExplore

View File

@ -29,11 +29,10 @@ function buildIlmExplainLifecycle (opts) {
* Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request
*
* @param {string} index - The name of the index to explain
* @param {boolean} human - Return data such as dates in a human readable format
*/
const acceptedQuerystring = [
'human'
]
const snakeCase = {

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseDelete (opts) {
function buildLicenseDelete (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
*/
@ -38,7 +38,7 @@ function buildXpackLicenseDelete (opts) {
}
return function xpackLicenseDelete (params, options, callback) {
return function licenseDelete (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -118,4 +118,4 @@ function buildXpackLicenseDelete (opts) {
}
}
module.exports = buildXpackLicenseDelete
module.exports = buildLicenseDelete

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseGet (opts) {
function buildLicenseGet (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
@ -39,7 +39,7 @@ function buildXpackLicenseGet (opts) {
}
return function xpackLicenseGet (params, options, callback) {
return function licenseGet (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackLicenseGet (opts) {
}
}
module.exports = buildXpackLicenseGet
module.exports = buildLicenseGet

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseGetBasicStatus (opts) {
function buildLicenseGetBasicStatus (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
*/
@ -38,7 +38,7 @@ function buildXpackLicenseGetBasicStatus (opts) {
}
return function xpackLicenseGetBasicStatus (params, options, callback) {
return function licenseGetBasicStatus (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -118,4 +118,4 @@ function buildXpackLicenseGetBasicStatus (opts) {
}
}
module.exports = buildXpackLicenseGetBasicStatus
module.exports = buildLicenseGetBasicStatus

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseGetTrialStatus (opts) {
function buildLicenseGetTrialStatus (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
*/
@ -38,7 +38,7 @@ function buildXpackLicenseGetTrialStatus (opts) {
}
return function xpackLicenseGetTrialStatus (params, options, callback) {
return function licenseGetTrialStatus (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -118,4 +118,4 @@ function buildXpackLicenseGetTrialStatus (opts) {
}
}
module.exports = buildXpackLicenseGetTrialStatus
module.exports = buildLicenseGetTrialStatus

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicensePost (opts) {
function buildLicensePost (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
* @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false)
* @param {object} body - licenses to be installed
@ -40,7 +40,7 @@ function buildXpackLicensePost (opts) {
}
return function xpackLicensePost (params, options, callback) {
return function licensePost (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -114,4 +114,4 @@ function buildXpackLicensePost (opts) {
}
}
module.exports = buildXpackLicensePost
module.exports = buildLicensePost

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicensePostStartBasic (opts) {
function buildLicensePostStartBasic (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
* @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false)
*/
@ -39,7 +39,7 @@ function buildXpackLicensePostStartBasic (opts) {
}
return function xpackLicensePostStartBasic (params, options, callback) {
return function licensePostStartBasic (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackLicensePostStartBasic (opts) {
}
}
module.exports = buildXpackLicensePostStartBasic
module.exports = buildLicensePostStartBasic

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicensePostStartTrial (opts) {
function buildLicensePostStartTrial (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
* Perform a [license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request
*
* @param {string} type - The type of trial license to generate (default: "trial")
* @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false)
@ -41,7 +41,7 @@ function buildXpackLicensePostStartTrial (opts) {
}
return function xpackLicensePostStartTrial (params, options, callback) {
return function licensePostStartTrial (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -121,4 +121,4 @@ function buildXpackLicensePostStartTrial (opts) {
}
}
module.exports = buildXpackLicensePostStartTrial
module.exports = buildLicensePostStartTrial

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMigrationDeprecations (opts) {
function buildMigrationDeprecations (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request
* Perform a [migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request
*
* @param {string} index - Index pattern
*/
@ -39,7 +39,7 @@ function buildXpackMigrationDeprecations (opts) {
}
return function xpackMigrationDeprecations (params, options, callback) {
return function migrationDeprecations (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -123,4 +123,4 @@ function buildXpackMigrationDeprecations (opts) {
}
}
module.exports = buildXpackMigrationDeprecations
module.exports = buildMigrationDeprecations

View File

@ -31,6 +31,7 @@ function buildMlGetCalendars (opts) {
* @param {string} calendar_id - The ID of the calendar to fetch
* @param {int} from - skips a number of calendars
* @param {int} size - specifies a max number of calendars to get
* @param {object} body - The from and size parameters optionally sent in the body
*/
const acceptedQuerystring = [
@ -54,12 +55,6 @@ function buildMlGetCalendars (opts) {
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -91,7 +86,7 @@ function buildMlGetCalendars (opts) {
const request = {
method,
path,
body: '',
body: body || '',
querystring
}

View File

@ -33,6 +33,7 @@ function buildReindex (opts) {
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
* @param {boolean} wait_for_completion - Should the request should block until the reindex is complete.
* @param {number} requests_per_second - The throttle to set on this request in sub-requests per second. -1 means no throttle.
* @param {time} scroll - Control how long to keep the search context alive
* @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
* @param {object} body - The search definition using the Query DSL and the prototype for the index request.
*/
@ -43,6 +44,7 @@ function buildReindex (opts) {
'wait_for_active_shards',
'wait_for_completion',
'requests_per_second',
'scroll',
'slices',
'pretty',
'human',

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupDeleteJob (opts) {
function buildRollupDeleteJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.delete_job]() request
* Perform a [rollup.delete_job]() request
*
* @param {string} id - The ID of the job to delete
*/
@ -39,7 +39,7 @@ function buildXpackRollupDeleteJob (opts) {
}
return function xpackRollupDeleteJob (params, options, callback) {
return function rollupDeleteJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackRollupDeleteJob (opts) {
}
}
module.exports = buildXpackRollupDeleteJob
module.exports = buildRollupDeleteJob

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupGetJobs (opts) {
function buildRollupGetJobs (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.get_jobs]() request
* Perform a [rollup.get_jobs]() request
*
* @param {string} id - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs
*/
@ -39,7 +39,7 @@ function buildXpackRollupGetJobs (opts) {
}
return function xpackRollupGetJobs (params, options, callback) {
return function rollupGetJobs (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -117,4 +117,4 @@ function buildXpackRollupGetJobs (opts) {
}
}
module.exports = buildXpackRollupGetJobs
module.exports = buildRollupGetJobs

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupGetRollupCaps (opts) {
function buildRollupGetRollupCaps (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.get_rollup_caps]() request
* Perform a [rollup.get_rollup_caps]() request
*
* @param {string} id - The ID of the index to check rollup capabilities on, or left blank for all jobs
*/
@ -39,7 +39,7 @@ function buildXpackRollupGetRollupCaps (opts) {
}
return function xpackRollupGetRollupCaps (params, options, callback) {
return function rollupGetRollupCaps (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -117,4 +117,4 @@ function buildXpackRollupGetRollupCaps (opts) {
}
}
module.exports = buildXpackRollupGetRollupCaps
module.exports = buildRollupGetRollupCaps

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupGetRollupIndexCaps (opts) {
function buildRollupGetRollupIndexCaps (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.get_rollup_index_caps]() request
* Perform a [rollup.get_rollup_index_caps]() request
*
* @param {string} index - The rollup index or index pattern to obtain rollup capabilities from.
*/
@ -39,7 +39,7 @@ function buildXpackRollupGetRollupIndexCaps (opts) {
}
return function xpackRollupGetRollupIndexCaps (params, options, callback) {
return function rollupGetRollupIndexCaps (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackRollupGetRollupIndexCaps (opts) {
}
}
module.exports = buildXpackRollupGetRollupIndexCaps
module.exports = buildRollupGetRollupIndexCaps

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupPutJob (opts) {
function buildRollupPutJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.put_job]() request
* Perform a [rollup.put_job]() request
*
* @param {string} id - The ID of the job to create
* @param {object} body - The job configuration
@ -40,7 +40,7 @@ function buildXpackRollupPutJob (opts) {
}
return function xpackRollupPutJob (params, options, callback) {
return function rollupPutJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -124,4 +124,4 @@ function buildXpackRollupPutJob (opts) {
}
}
module.exports = buildXpackRollupPutJob
module.exports = buildRollupPutJob

View File

@ -22,13 +22,13 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupRollupSearch (opts) {
function buildRollupRollupSearch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.rollup_search]() request
* Perform a [rollup.rollup_search]() request
*
* @param {string} index - The index or index-pattern (containing rollup or regular data) that should be searched
* @param {list} index - The indices or index-pattern(s) (containing rollup or regular data) that should be searched
* @param {string} type - The doc type inside the index
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
* @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response
@ -45,7 +45,7 @@ function buildXpackRollupRollupSearch (opts) {
restTotalHitsAsInt: 'rest_total_hits_as_int'
}
return function xpackRollupRollupSearch (params, options, callback) {
return function rollupRollupSearch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -139,4 +139,4 @@ function buildXpackRollupRollupSearch (opts) {
}
}
module.exports = buildXpackRollupRollupSearch
module.exports = buildRollupRollupSearch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupStartJob (opts) {
function buildRollupStartJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.start_job]() request
* Perform a [rollup.start_job]() request
*
* @param {string} id - The ID of the job to start
*/
@ -39,7 +39,7 @@ function buildXpackRollupStartJob (opts) {
}
return function xpackRollupStartJob (params, options, callback) {
return function rollupStartJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackRollupStartJob (opts) {
}
}
module.exports = buildXpackRollupStartJob
module.exports = buildRollupStartJob

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackRollupStopJob (opts) {
function buildRollupStopJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.rollup.stop_job]() request
* Perform a [rollup.stop_job]() request
*
* @param {string} id - The ID of the job to stop
* @param {boolean} wait_for_completion - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false.
@ -43,7 +43,7 @@ function buildXpackRollupStopJob (opts) {
}
return function xpackRollupStopJob (params, options, callback) {
return function rollupStopJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -123,4 +123,4 @@ function buildXpackRollupStopJob (opts) {
}
}
module.exports = buildXpackRollupStopJob
module.exports = buildRollupStopJob

View File

@ -53,6 +53,10 @@ function buildSecurityDisableUser (opts) {
}
// check required parameters
if (params['username'] == null) {
const err = new ConfigurationError('Missing required parameter: username')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)

View File

@ -53,6 +53,10 @@ function buildSecurityEnableUser (opts) {
}
// check required parameters
if (params['username'] == null) {
const err = new ConfigurationError('Missing required parameter: username')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)

View File

@ -85,9 +85,9 @@ function buildSecurityGetPrivileges (opts) {
var path = ''
if (application && name) {
if ((application) != null && (name) != null) {
path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name)
} else if (application) {
} else if ((application) != null) {
path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application)
} else {
path = '/' + '_security' + '/' + 'privilege'

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackSqlClearCursor (opts) {
function buildSqlClearCursor (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.sql.clear_cursor](Clear SQL cursor) request
* Perform a [sql.clear_cursor](Clear SQL cursor) request
*
* @param {object} body - Specify the cursor value in the `cursor` element to clean the cursor.
*/
@ -39,7 +39,7 @@ function buildXpackSqlClearCursor (opts) {
}
return function xpackSqlClearCursor (params, options, callback) {
return function sqlClearCursor (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackSqlClearCursor (opts) {
}
}
module.exports = buildXpackSqlClearCursor
module.exports = buildSqlClearCursor

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackSqlQuery (opts) {
function buildSqlQuery (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.sql.query](Execute SQL) request
* Perform a [sql.query](Execute SQL) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {object} body - Use the `query` element to start a query. Use the `cursor` element to continue a query.
@ -40,7 +40,7 @@ function buildXpackSqlQuery (opts) {
}
return function xpackSqlQuery (params, options, callback) {
return function sqlQuery (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -120,4 +120,4 @@ function buildXpackSqlQuery (opts) {
}
}
module.exports = buildXpackSqlQuery
module.exports = buildSqlQuery

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackSqlTranslate (opts) {
function buildSqlTranslate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.sql.translate](Translate SQL into Elasticsearch queries) request
* Perform a [sql.translate](Translate SQL into Elasticsearch queries) request
*
* @param {object} body - Specify the query in the `query` element.
*/
@ -39,7 +39,7 @@ function buildXpackSqlTranslate (opts) {
}
return function xpackSqlTranslate (params, options, callback) {
return function sqlTranslate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackSqlTranslate (opts) {
}
}
module.exports = buildXpackSqlTranslate
module.exports = buildSqlTranslate

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherAckWatch (opts) {
function buildWatcherAckWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request
* Perform a [watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request
*
* @param {string} watch_id - Watch ID
* @param {list} action_id - A comma-separated list of the action ids to be acked
@ -40,7 +40,7 @@ function buildXpackWatcherAckWatch (opts) {
}
return function xpackWatcherAckWatch (params, options, callback) {
return function watcherAckWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -134,4 +134,4 @@ function buildXpackWatcherAckWatch (opts) {
}
}
module.exports = buildXpackWatcherAckWatch
module.exports = buildWatcherAckWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherActivateWatch (opts) {
function buildWatcherActivateWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request
* Perform a [watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request
*
* @param {string} watch_id - Watch ID
*/
@ -39,7 +39,7 @@ function buildXpackWatcherActivateWatch (opts) {
}
return function xpackWatcherActivateWatch (params, options, callback) {
return function watcherActivateWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -123,4 +123,4 @@ function buildXpackWatcherActivateWatch (opts) {
}
}
module.exports = buildXpackWatcherActivateWatch
module.exports = buildWatcherActivateWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherDeactivateWatch (opts) {
function buildWatcherDeactivateWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request
* Perform a [watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request
*
* @param {string} watch_id - Watch ID
*/
@ -39,7 +39,7 @@ function buildXpackWatcherDeactivateWatch (opts) {
}
return function xpackWatcherDeactivateWatch (params, options, callback) {
return function watcherDeactivateWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -123,4 +123,4 @@ function buildXpackWatcherDeactivateWatch (opts) {
}
}
module.exports = buildXpackWatcherDeactivateWatch
module.exports = buildWatcherDeactivateWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherDeleteWatch (opts) {
function buildWatcherDeleteWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request
* Perform a [watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request
*
* @param {string} id - Watch ID
*/
@ -39,7 +39,7 @@ function buildXpackWatcherDeleteWatch (opts) {
}
return function xpackWatcherDeleteWatch (params, options, callback) {
return function watcherDeleteWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -123,4 +123,4 @@ function buildXpackWatcherDeleteWatch (opts) {
}
}
module.exports = buildXpackWatcherDeleteWatch
module.exports = buildWatcherDeleteWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherExecuteWatch (opts) {
function buildWatcherExecuteWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request
* Perform a [watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request
*
* @param {string} id - Watch ID
* @param {boolean} debug - indicates whether the watch should execute in debug mode
@ -41,7 +41,7 @@ function buildXpackWatcherExecuteWatch (opts) {
}
return function xpackWatcherExecuteWatch (params, options, callback) {
return function watcherExecuteWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -119,4 +119,4 @@ function buildXpackWatcherExecuteWatch (opts) {
}
}
module.exports = buildXpackWatcherExecuteWatch
module.exports = buildWatcherExecuteWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherGetWatch (opts) {
function buildWatcherGetWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request
* Perform a [watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request
*
* @param {string} id - Watch ID
*/
@ -39,7 +39,7 @@ function buildXpackWatcherGetWatch (opts) {
}
return function xpackWatcherGetWatch (params, options, callback) {
return function watcherGetWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -123,4 +123,4 @@ function buildXpackWatcherGetWatch (opts) {
}
}
module.exports = buildXpackWatcherGetWatch
module.exports = buildWatcherGetWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherPutWatch (opts) {
function buildWatcherPutWatch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request
* Perform a [watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request
*
* @param {string} id - Watch ID
* @param {boolean} active - Specify whether the watch is in/active by default
@ -48,7 +48,7 @@ function buildXpackWatcherPutWatch (opts) {
ifPrimaryTerm: 'if_primary_term'
}
return function xpackWatcherPutWatch (params, options, callback) {
return function watcherPutWatch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -128,4 +128,4 @@ function buildXpackWatcherPutWatch (opts) {
}
}
module.exports = buildXpackWatcherPutWatch
module.exports = buildWatcherPutWatch

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherStart (opts) {
function buildWatcherStart (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request
* Perform a [watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request
*
*/
@ -38,7 +38,7 @@ function buildXpackWatcherStart (opts) {
}
return function xpackWatcherStart (params, options, callback) {
return function watcherStart (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -118,4 +118,4 @@ function buildXpackWatcherStart (opts) {
}
}
module.exports = buildXpackWatcherStart
module.exports = buildWatcherStart

View File

@ -22,14 +22,14 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherStats (opts) {
function buildWatcherStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request
* Perform a [watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request
*
* @param {enum} metric - Controls what additional stat metrics should be include in the response
* @param {enum} metric - Controls what additional stat metrics should be include in the response
* @param {list} metric - Controls what additional stat metrics should be include in the response
* @param {list} metric - Controls what additional stat metrics should be include in the response
* @param {boolean} emit_stacktraces - Emits stack traces of currently running watches
*/
@ -42,7 +42,7 @@ function buildXpackWatcherStats (opts) {
emitStacktraces: 'emit_stacktraces'
}
return function xpackWatcherStats (params, options, callback) {
return function watcherStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -126,4 +126,4 @@ function buildXpackWatcherStats (opts) {
}
}
module.exports = buildXpackWatcherStats
module.exports = buildWatcherStats

View File

@ -22,11 +22,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherStop (opts) {
function buildWatcherStop (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request
* Perform a [watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request
*
*/
@ -38,7 +38,7 @@ function buildXpackWatcherStop (opts) {
}
return function xpackWatcherStop (params, options, callback) {
return function watcherStop (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -118,4 +118,4 @@ function buildXpackWatcherStop (opts) {
}
}
module.exports = buildXpackWatcherStop
module.exports = buildWatcherStop

View File

@ -1,127 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMigrationGetAssistance (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
*/
const acceptedQuerystring = [
'allow_no_indices',
'expand_wildcards',
'ignore_unavailable'
]
const snakeCase = {
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
ignoreUnavailable: 'ignore_unavailable'
}
return function xpackMigrationGetAssistance (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = null
var { method, body, index } = params
var querystring = semicopy(params, ['method', 'body', 'index'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
if ((index) != null) {
path = '/' + '_migration' + '/' + 'assistance' + '/' + encodeURIComponent(index)
} else {
path = '/' + '_migration' + '/' + 'assistance'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildXpackMigrationGetAssistance

View File

@ -63,6 +63,8 @@ function ESAPI (opts) {
followInfo: lazyLoad('ccr.follow_info', opts),
follow_stats: lazyLoad('ccr.follow_stats', opts),
followStats: lazyLoad('ccr.follow_stats', opts),
forget_follower: lazyLoad('ccr.forget_follower', opts),
forgetFollower: lazyLoad('ccr.forget_follower', opts),
get_auto_follow_pattern: lazyLoad('ccr.get_auto_follow_pattern', opts),
getAutoFollowPattern: lazyLoad('ccr.get_auto_follow_pattern', opts),
pause_follow: lazyLoad('ccr.pause_follow', opts),
@ -112,6 +114,9 @@ function ESAPI (opts) {
getScript: lazyLoad('get_script', opts),
get_source: lazyLoad('get_source', opts),
getSource: lazyLoad('get_source', opts),
graph: {
explore: lazyLoad('graph.explore', opts)
},
ilm: {
delete_lifecycle: lazyLoad('ilm.delete_lifecycle', opts),
deleteLifecycle: lazyLoad('ilm.delete_lifecycle', opts),
@ -205,7 +210,23 @@ function ESAPI (opts) {
putPipeline: lazyLoad('ingest.put_pipeline', opts),
simulate: lazyLoad('ingest.simulate', opts)
},
license: {
delete: lazyLoad('license.delete', opts),
get: lazyLoad('license.get', opts),
get_basic_status: lazyLoad('license.get_basic_status', opts),
getBasicStatus: lazyLoad('license.get_basic_status', opts),
get_trial_status: lazyLoad('license.get_trial_status', opts),
getTrialStatus: lazyLoad('license.get_trial_status', opts),
post: lazyLoad('license.post', opts),
post_start_basic: lazyLoad('license.post_start_basic', opts),
postStartBasic: lazyLoad('license.post_start_basic', opts),
post_start_trial: lazyLoad('license.post_start_trial', opts),
postStartTrial: lazyLoad('license.post_start_trial', opts)
},
mget: lazyLoad('mget', opts),
migration: {
deprecations: lazyLoad('migration.deprecations', opts)
},
ml: {
close_job: lazyLoad('ml.close_job', opts),
closeJob: lazyLoad('ml.close_job', opts),
@ -323,6 +344,24 @@ function ESAPI (opts) {
reindexRethrottle: lazyLoad('reindex_rethrottle', opts),
render_search_template: lazyLoad('render_search_template', opts),
renderSearchTemplate: lazyLoad('render_search_template', opts),
rollup: {
delete_job: lazyLoad('rollup.delete_job', opts),
deleteJob: lazyLoad('rollup.delete_job', opts),
get_jobs: lazyLoad('rollup.get_jobs', opts),
getJobs: lazyLoad('rollup.get_jobs', opts),
get_rollup_caps: lazyLoad('rollup.get_rollup_caps', opts),
getRollupCaps: lazyLoad('rollup.get_rollup_caps', opts),
get_rollup_index_caps: lazyLoad('rollup.get_rollup_index_caps', opts),
getRollupIndexCaps: lazyLoad('rollup.get_rollup_index_caps', opts),
put_job: lazyLoad('rollup.put_job', opts),
putJob: lazyLoad('rollup.put_job', opts),
rollup_search: lazyLoad('rollup.rollup_search', opts),
rollupSearch: lazyLoad('rollup.rollup_search', opts),
start_job: lazyLoad('rollup.start_job', opts),
startJob: lazyLoad('rollup.start_job', opts),
stop_job: lazyLoad('rollup.stop_job', opts),
stopJob: lazyLoad('rollup.stop_job', opts)
},
scripts_painless_execute: lazyLoad('scripts_painless_execute', opts),
scriptsPainlessExecute: lazyLoad('scripts_painless_execute', opts),
scroll: lazyLoad('scroll', opts),
@ -397,6 +436,12 @@ function ESAPI (opts) {
verify_repository: lazyLoad('snapshot.verify_repository', opts),
verifyRepository: lazyLoad('snapshot.verify_repository', opts)
},
sql: {
clear_cursor: lazyLoad('sql.clear_cursor', opts),
clearCursor: lazyLoad('sql.clear_cursor', opts),
query: lazyLoad('sql.query', opts),
translate: lazyLoad('sql.translate', opts)
},
ssl: {
certificates: lazyLoad('ssl.certificates', opts)
},
@ -411,74 +456,28 @@ function ESAPI (opts) {
updateByQuery: lazyLoad('update_by_query', opts),
update_by_query_rethrottle: lazyLoad('update_by_query_rethrottle', opts),
updateByQueryRethrottle: lazyLoad('update_by_query_rethrottle', opts),
watcher: {
ack_watch: lazyLoad('watcher.ack_watch', opts),
ackWatch: lazyLoad('watcher.ack_watch', opts),
activate_watch: lazyLoad('watcher.activate_watch', opts),
activateWatch: lazyLoad('watcher.activate_watch', opts),
deactivate_watch: lazyLoad('watcher.deactivate_watch', opts),
deactivateWatch: lazyLoad('watcher.deactivate_watch', opts),
delete_watch: lazyLoad('watcher.delete_watch', opts),
deleteWatch: lazyLoad('watcher.delete_watch', opts),
execute_watch: lazyLoad('watcher.execute_watch', opts),
executeWatch: lazyLoad('watcher.execute_watch', opts),
get_watch: lazyLoad('watcher.get_watch', opts),
getWatch: lazyLoad('watcher.get_watch', opts),
put_watch: lazyLoad('watcher.put_watch', opts),
putWatch: lazyLoad('watcher.put_watch', opts),
start: lazyLoad('watcher.start', opts),
stats: lazyLoad('watcher.stats', opts),
stop: lazyLoad('watcher.stop', opts)
},
xpack: {
graph: {
explore: lazyLoad('xpack.graph.explore', opts)
},
info: lazyLoad('xpack.info', opts),
license: {
delete: lazyLoad('xpack.license.delete', opts),
get: lazyLoad('xpack.license.get', opts),
get_basic_status: lazyLoad('xpack.license.get_basic_status', opts),
getBasicStatus: lazyLoad('xpack.license.get_basic_status', opts),
get_trial_status: lazyLoad('xpack.license.get_trial_status', opts),
getTrialStatus: lazyLoad('xpack.license.get_trial_status', opts),
post: lazyLoad('xpack.license.post', opts),
post_start_basic: lazyLoad('xpack.license.post_start_basic', opts),
postStartBasic: lazyLoad('xpack.license.post_start_basic', opts),
post_start_trial: lazyLoad('xpack.license.post_start_trial', opts),
postStartTrial: lazyLoad('xpack.license.post_start_trial', opts)
},
migration: {
deprecations: lazyLoad('xpack.migration.deprecations', opts),
get_assistance: lazyLoad('xpack.migration.get_assistance', opts),
getAssistance: lazyLoad('xpack.migration.get_assistance', opts),
upgrade: lazyLoad('xpack.migration.upgrade', opts)
},
rollup: {
delete_job: lazyLoad('xpack.rollup.delete_job', opts),
deleteJob: lazyLoad('xpack.rollup.delete_job', opts),
get_jobs: lazyLoad('xpack.rollup.get_jobs', opts),
getJobs: lazyLoad('xpack.rollup.get_jobs', opts),
get_rollup_caps: lazyLoad('xpack.rollup.get_rollup_caps', opts),
getRollupCaps: lazyLoad('xpack.rollup.get_rollup_caps', opts),
get_rollup_index_caps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts),
getRollupIndexCaps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts),
put_job: lazyLoad('xpack.rollup.put_job', opts),
putJob: lazyLoad('xpack.rollup.put_job', opts),
rollup_search: lazyLoad('xpack.rollup.rollup_search', opts),
rollupSearch: lazyLoad('xpack.rollup.rollup_search', opts),
start_job: lazyLoad('xpack.rollup.start_job', opts),
startJob: lazyLoad('xpack.rollup.start_job', opts),
stop_job: lazyLoad('xpack.rollup.stop_job', opts),
stopJob: lazyLoad('xpack.rollup.stop_job', opts)
},
sql: {
clear_cursor: lazyLoad('xpack.sql.clear_cursor', opts),
clearCursor: lazyLoad('xpack.sql.clear_cursor', opts),
query: lazyLoad('xpack.sql.query', opts),
translate: lazyLoad('xpack.sql.translate', opts)
},
usage: lazyLoad('xpack.usage', opts),
watcher: {
ack_watch: lazyLoad('xpack.watcher.ack_watch', opts),
ackWatch: lazyLoad('xpack.watcher.ack_watch', opts),
activate_watch: lazyLoad('xpack.watcher.activate_watch', opts),
activateWatch: lazyLoad('xpack.watcher.activate_watch', opts),
deactivate_watch: lazyLoad('xpack.watcher.deactivate_watch', opts),
deactivateWatch: lazyLoad('xpack.watcher.deactivate_watch', opts),
delete_watch: lazyLoad('xpack.watcher.delete_watch', opts),
deleteWatch: lazyLoad('xpack.watcher.delete_watch', opts),
execute_watch: lazyLoad('xpack.watcher.execute_watch', opts),
executeWatch: lazyLoad('xpack.watcher.execute_watch', opts),
get_watch: lazyLoad('xpack.watcher.get_watch', opts),
getWatch: lazyLoad('xpack.watcher.get_watch', opts),
put_watch: lazyLoad('xpack.watcher.put_watch', opts),
putWatch: lazyLoad('xpack.watcher.put_watch', opts),
start: lazyLoad('xpack.watcher.start', opts),
stats: lazyLoad('xpack.watcher.stats', opts),
stop: lazyLoad('xpack.watcher.stop', opts)
}
usage: lazyLoad('xpack.usage', opts)
}
}

228
api/requestParams.d.ts vendored
View File

@ -1051,6 +1051,7 @@ export interface Reindex extends Generic {
wait_for_active_shards?: string;
wait_for_completion?: boolean;
requests_per_second?: number;
scroll?: string;
slices?: number;
body: any;
}
@ -1337,7 +1338,12 @@ export interface CcrFollowInfo extends Generic {
}
export interface CcrFollowStats extends Generic {
index?: string | string[];
index: string | string[];
}
export interface CcrForgetFollower extends Generic {
index: string;
body: any;
}
export interface CcrGetAutoFollowPattern extends Generic {
@ -1365,13 +1371,20 @@ export interface CcrUnfollow extends Generic {
index: string;
}
export interface GraphExplore extends Generic {
index?: string | string[];
type?: string | string[];
routing?: string;
timeout?: string;
body?: any;
}
export interface IlmDeleteLifecycle extends Generic {
policy?: string;
}
export interface IlmExplainLifecycle extends Generic {
index?: string;
human?: boolean;
}
export interface IlmGetLifecycle extends Generic {
@ -1425,6 +1438,37 @@ export interface IndicesUnfreeze extends Generic {
wait_for_active_shards?: string;
}
export interface LicenseDelete extends Generic {
}
export interface LicenseGet extends Generic {
local?: boolean;
}
export interface LicenseGetBasicStatus extends Generic {
}
export interface LicenseGetTrialStatus extends Generic {
}
export interface LicensePost extends Generic {
acknowledge?: boolean;
body?: any;
}
export interface LicensePostStartBasic extends Generic {
acknowledge?: boolean;
}
export interface LicensePostStartTrial extends Generic {
type?: string;
acknowledge?: boolean;
}
export interface MigrationDeprecations extends Generic {
index?: string;
}
export interface MlCloseJob extends Generic {
job_id: string;
allow_no_jobs?: boolean;
@ -1538,6 +1582,7 @@ export interface MlGetCalendars extends Generic {
calendar_id?: string;
from?: number;
size?: number;
body?: any;
}
export interface MlGetCategories extends Generic {
@ -1738,6 +1783,45 @@ export interface MonitoringBulk extends Generic {
body: any;
}
export interface RollupDeleteJob extends Generic {
id: string;
}
export interface RollupGetJobs extends Generic {
id?: string;
}
export interface RollupGetRollupCaps extends Generic {
id?: string;
}
export interface RollupGetRollupIndexCaps extends Generic {
index: string;
}
export interface RollupPutJob extends Generic {
id: string;
body: any;
}
export interface RollupRollupSearch extends Generic {
index: string | string[];
type?: string;
typed_keys?: boolean;
rest_total_hits_as_int?: boolean;
body: any;
}
export interface RollupStartJob extends Generic {
id: string;
}
export interface RollupStopJob extends Generic {
id: string;
wait_for_completion?: boolean;
timeout?: string;
}
export interface SecurityAuthenticate extends Generic {
}
@ -1783,12 +1867,12 @@ export interface SecurityDeleteUser extends Generic {
}
export interface SecurityDisableUser extends Generic {
username?: string;
username: string;
refresh?: 'true' | 'false' | 'wait_for';
}
export interface SecurityEnableUser extends Generic {
username?: string;
username: string;
refresh?: 'true' | 'false' | 'wait_for';
}
@ -1859,148 +1943,50 @@ export interface SecurityPutUser extends Generic {
body: any;
}
export interface SslCertificates extends Generic {
}
export interface XpackGraphExplore extends Generic {
index?: string | string[];
type?: string | string[];
routing?: string;
timeout?: string;
body?: any;
}
export interface XpackInfo extends Generic {
categories?: string | string[];
}
export interface XpackLicenseDelete extends Generic {
}
export interface XpackLicenseGet extends Generic {
local?: boolean;
}
export interface XpackLicenseGetBasicStatus extends Generic {
}
export interface XpackLicenseGetTrialStatus extends Generic {
}
export interface XpackLicensePost extends Generic {
acknowledge?: boolean;
body?: any;
}
export interface XpackLicensePostStartBasic extends Generic {
acknowledge?: boolean;
}
export interface XpackLicensePostStartTrial extends Generic {
type?: string;
acknowledge?: boolean;
}
export interface XpackMigrationDeprecations extends Generic {
index?: string;
}
export interface XpackMigrationGetAssistance extends Generic {
index?: string | string[];
allow_no_indices?: boolean;
expand_wildcards?: 'open' | 'closed' | 'none' | 'all';
ignore_unavailable?: boolean;
}
export interface XpackMigrationUpgrade extends Generic {
index: string;
wait_for_completion?: boolean;
}
export interface XpackRollupDeleteJob extends Generic {
id: string;
}
export interface XpackRollupGetJobs extends Generic {
id?: string;
}
export interface XpackRollupGetRollupCaps extends Generic {
id?: string;
}
export interface XpackRollupGetRollupIndexCaps extends Generic {
index: string;
}
export interface XpackRollupPutJob extends Generic {
id: string;
export interface SqlClearCursor extends Generic {
body: any;
}
export interface XpackRollupRollupSearch extends Generic {
index: string;
type?: string;
typed_keys?: boolean;
rest_total_hits_as_int?: boolean;
body: any;
}
export interface XpackRollupStartJob extends Generic {
id: string;
}
export interface XpackRollupStopJob extends Generic {
id: string;
wait_for_completion?: boolean;
timeout?: string;
}
export interface XpackSqlClearCursor extends Generic {
body: any;
}
export interface XpackSqlQuery extends Generic {
export interface SqlQuery extends Generic {
format?: string;
body: any;
}
export interface XpackSqlTranslate extends Generic {
export interface SqlTranslate extends Generic {
body: any;
}
export interface XpackUsage extends Generic {
master_timeout?: string;
export interface SslCertificates extends Generic {
}
export interface XpackWatcherAckWatch extends Generic {
export interface WatcherAckWatch extends Generic {
watch_id: string;
action_id?: string | string[];
}
export interface XpackWatcherActivateWatch extends Generic {
export interface WatcherActivateWatch extends Generic {
watch_id: string;
}
export interface XpackWatcherDeactivateWatch extends Generic {
export interface WatcherDeactivateWatch extends Generic {
watch_id: string;
}
export interface XpackWatcherDeleteWatch extends Generic {
export interface WatcherDeleteWatch extends Generic {
id: string;
}
export interface XpackWatcherExecuteWatch extends Generic {
export interface WatcherExecuteWatch extends Generic {
id?: string;
debug?: boolean;
body?: any;
}
export interface XpackWatcherGetWatch extends Generic {
export interface WatcherGetWatch extends Generic {
id: string;
}
export interface XpackWatcherPutWatch extends Generic {
export interface WatcherPutWatch extends Generic {
id: string;
active?: boolean;
version?: number;
@ -2009,13 +1995,21 @@ export interface XpackWatcherPutWatch extends Generic {
body?: any;
}
export interface XpackWatcherStart extends Generic {
export interface WatcherStart extends Generic {
}
export interface XpackWatcherStats extends Generic {
metric?: '_all' | 'queued_watches' | 'current_watches' | 'pending_watches';
export interface WatcherStats extends Generic {
metric?: string | string[];
emit_stacktraces?: boolean;
}
export interface XpackWatcherStop extends Generic {
export interface WatcherStop extends Generic {
}
export interface XpackInfo extends Generic {
categories?: string | string[];
}
export interface XpackUsage extends Generic {
master_timeout?: string;
}

View File

@ -1,8 +1,9 @@
= Authentication
[[auth-reference]]
== Authentication
This document contains code snippets to show you how to connect to various Elasticsearch providers.
== Basic Auth
=== Basic Auth
You can provide your credentials in the node(s) URL.
@ -29,7 +30,7 @@ const client = new Client({
})
----
== SSL configuration
=== SSL configuration
Without any additional configuration you can specify `https://` node urls, but the certificates used to sign these requests will not verified (`rejectUnauthorized: false`). To turn on certificate verification you must specify an `ssl` object either in the top level config or in each host config object and set `rejectUnauthorized: true`. The ssl config object can contain many of the same configuration options that https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[tls.connect()] accepts.
@ -45,7 +46,7 @@ const client = new Client({
})
----
== Elastic Cloud
=== Elastic Cloud
If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers a easy way to connect to it via the `cloud` option. +
You must pass the Cloud ID that you can find in the cloud console, then your username and password.

View File

@ -1,4 +1,5 @@
= Breaking changes coming from the old client
[[breaking-changes]]
== Breaking changes coming from the old client
If you were already using the previous version of this client --i.e. the one you used to install with `npm install elasticsearch`-- you will encounter some breaking changes.

View File

@ -1,4 +1,5 @@
= Creating a child client
[[child-client]]
== Creating a child client
There are some use cases where you may need multiple instances of the client. You can easily do that by calling `new Client()` as many times as you need, but you will lose all the benefits of using one single client, such as the long living connections and the connection pool handling. +
To avoid this problem the client offers a `child` API, which returns a new client instance that shares the connection pool with the parent client. +

View File

@ -1,4 +1,5 @@
= Client configuration
[[client-configuration]]
== Client configuration
The client is designed to be easily configured as you see fit for your needs, following you can see all the possible basic options that you can use to configure it.
@ -14,7 +15,7 @@ const client = new Client({
})
----
== Basic options
=== Basic options
[cols=2*]
|===
|`node` or `nodes`
@ -72,7 +73,7 @@ _Default:_ `false`
|`resurrectStrategy`
|`string` - Configure the node resurrection strategy. +
_Options:_ `'ping'`, `'optimistic'`, `'none'` +
_Options:_ `'ping'`, `'optimistic'`, `'none'` +
_Default:_ `'ping'`
|`suggestCompression`
@ -122,7 +123,7 @@ function nodeSelector (connections) {
----
|===
== Advanced configuration
=== Advanced configuration
If you need to customize the client behavior heavily, you are in the right place! +
The client allows you to customize the following internals:

View File

@ -1,3 +1,4 @@
[[as_stream_examples]]
== asStream
Instead of getting the parsed body back, you will get the raw Node.js stream of data.
@ -10,7 +11,7 @@ const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
async function run () {
await client.bulk({
const { body: bulkResponse } = await client.bulk({
refresh: true,
body: [
// operation to perform
@ -35,6 +36,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
// Let's search!
const { body } = await client.search({
index: 'game-of-thrones',

View File

@ -1,4 +1,5 @@
= Bulk
[[bulk_examples]]
== Bulk
The `bulk` API makes it possible to perform many index/delete operations in a single API call. +
This can greatly increase the indexing speed.
@ -11,7 +12,7 @@ const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
async function run () {
await client.bulk({
const { body: bulkResponse } = await client.bulk({
// here we are forcing an index refresh,
// otherwise we will not get any result
// in the consequent search
@ -39,6 +40,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
// Let's search!
const { body } = await client.search({
index: 'game-of-thrones',

View File

@ -1,4 +1,5 @@
= Exists
[[exists_examples]]
== Exists
Check that the document `/game-of-thrones/1` exists.

View File

@ -1,4 +1,5 @@
= Get
[[get_examples]]
== Get
The get API allows to get a typed JSON document from the index based on its id. +
The following example gets a JSON document from an index called `game-of-thrones`, under a type called `_doc`, with id valued `'1'`.

View File

@ -1,3 +1,4 @@
[[ignore_examples]]
== Ignore
HTTP status codes which should not be considered errors for this request.
@ -9,7 +10,7 @@ const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
async function run () {
await client.bulk({
const { body: bulkResponse } = await client.bulk({
refresh: true,
body: [
// operation to perform
@ -34,6 +35,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
// Let's search!
const { body } = await client.search({
index: 'game-of-thrones',

View File

@ -0,0 +1,28 @@
[[examples]]
= Examples
Following you can find some examples on how to use the client.
* Use of the <<as_stream_examples,asStream>> parameter;
* Executing a <<bulk_examples,bulk>> request;
* Executing a <<exists_examples,exists>> request;
* Executing a <<get_examples,get>> request;
* Use of the <<ignore_examples,ignore>> parameter;
* Executing a <<msearch_examples,msearch>> request;
* How do I <<scroll_examples,scroll>>?
* Executing a <<search_examples,search>> request;
* I need <<suggest_examples,suggestions>>;
* How to use the <<transport_request_examples,transport.request>> method;
* How to use <<typescript_examples,TypeScript>>;
include::asStream.asciidoc[]
include::bulk.asciidoc[]
include::exists.asciidoc[]
include::get.asciidoc[]
include::ignore.asciidoc[]
include::msearch.asciidoc[]
include::scroll.asciidoc[]
include::search.asciidoc[]
include::suggest.asciidoc[]
include::transport.request.asciidoc[]
include::typescript.asciidoc[]

View File

@ -1,4 +1,5 @@
= MSearch
[[msearch_examples]]
== MSearch
The multi search API allows to execute several search requests within the same API.
@ -10,7 +11,7 @@ const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
async function run () {
await client.bulk({
const { body: bulkResponse } = await client.bulk({
refresh: true,
body: [
{ index: { _index: 'game-of-thrones' } },
@ -33,6 +34,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
const { body } = await client.msearch({
body: [
{ index: 'game-of-thrones' },

View File

@ -1,4 +1,5 @@
= Scroll
[[scroll_examples]]
== Scroll
While a search request returns a single “page” of results, the scroll API can be used to retrieve large numbers of results (or even all results) from a single search request, in much the same way as you would use a cursor on a traditional database.
@ -20,7 +21,7 @@ async function run () {
const responseQueue = []
// Let's index some data!
await client.bulk({
const { body: bulkResponse } = await client.bulk({
// here we are forcing an index refresh,
// otherwise we will not get any result
// in the consequent search
@ -48,6 +49,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
// start things off by searching, setting a scroll timeout, and pushing
// our first response into the queue to be processed
const response = await client.search({

View File

@ -1,4 +1,5 @@
= Search
[[search_examples]]
== Search
The `search` API allows you to execute a search query and get back search hits that match the query. +
The query can either be provided using a simple https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-uri-request.html[query string as a parameter], or using a https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-request-body.html[request body].

View File

@ -1,4 +1,5 @@
= Suggest
[[suggest_examples]]
== Suggest
The suggest feature suggests similar looking terms based on a provided text by using a suggester. _Parts of the suggest feature are still under development._
@ -13,7 +14,7 @@ const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
async function run () {
await client.bulk({
const { body: bulkResponse } = await client.bulk({
refresh: true,
body: [
{ index: { _index: 'game-of-thrones' } },
@ -36,6 +37,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
const { body } = await client.search({
index: 'game-of-thrones',
body: {

View File

@ -1,4 +1,5 @@
= transport.request
[[transport_request_examples]]
== transport.request
It can happen that you need to communicate with Elasticsearch by using an API that is not supported by the client, to mitigate this issue you can directly call `client.transport.request`, which is the internal utility that the client uses to communicate with Elasticsearch when you use an API method.
@ -15,7 +16,7 @@ const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
async function run () {
await client.bulk({
const { body: bulkResponse } = await client.bulk({
refresh: true,
body: [
{ index: { _index: 'game-of-thrones' } },
@ -38,6 +39,11 @@ async function run () {
]
})
if (bulkResponse.errors) {
console.log(bulkResponse)
process.exit(1)
}
const { body } = await client.transport.request({
method: 'POST',
path: '/game-of-thrones/_search',

View File

@ -1,4 +1,5 @@
= Typescript
[[typescript_examples]]
== Typescript
The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API.

View File

@ -1,4 +1,5 @@
= Extend the client
[[extend-client]]
== Extend the client
Sometimes you need to reuse the same logic, or you want to build a custom API to allow you simplify your code. +
The easiest way to achieve that is by extending the client.

View File

@ -1,51 +1,15 @@
= @elastic/elasticsearch
The official Node.js client for Elasticsearch.
:branch: 7.x
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
== Features
* One-to-one mapping with REST API.
* Generalized, pluggable architecture.
* Configurable, automatic discovery of cluster nodes.
* Persistent, Keep-Alive connections.
* Load balancing (with pluggable selection strategy) across all available nodes.
* TypeScript support out of the box.
== Install
[source,sh]
----
npm install @elastic/elasticsearch
----
By default the latest version of the module will be installed, which is the same version of the current release of Elasticsearch. +
If you need to work with older versions of Elasticsearch, you should install the same version of the client as well. +
For example, if you are using Elasticsearch `v6.5.4`, you will need the client `v6`, and you can easily do that with `npm install @elastic/elasticsearch@6`.
== Usage
[source,js]
----
const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
// promise API
const result = await client.search({
index: 'my-index',
body: { foo: 'bar' }
})
// callback API
client.search({
index: 'my-index',
body: { foo: 'bar' }
}, (err, result) => {
if (err) console.log(err)
})
----
== Reference
* Client configuration
* Client usage
* API methods
* TypeScript support
* Extend the client
* Breaking changes from old client
* Authentication
* Child client
include::introduction.asciidoc[]
include::usage.asciidoc[]
include::configuration.asciidoc[]
include::reference.asciidoc[]
include::breaking-changes.asciidoc[]
include::authentication.asciidoc[]
include::child.asciidoc[]
include::extend.asciidoc[]
include::typescript.asciidoc[]
include::examples/index.asciidoc[]

View File

@ -0,0 +1,53 @@
[[introduction]]
== Introduction
The official Node.js client for Elasticsearch.
=== Features
* One-to-one mapping with REST API.
* Generalized, pluggable architecture.
* Configurable, automatic discovery of cluster nodes.
* Persistent, Keep-Alive connections.
* Load balancing (with pluggable selection strategy) across all available nodes.
* TypeScript support out of the box.
=== Install
[source,sh]
----
npm install @elastic/elasticsearch
----
=== Compatibility
The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using.
----
# Elasticsearch 7.x
@elastic/elasticsearch@7
# Elasticsearch 6.x
@elastic/elasticsearch@6
# Elasticsearch 5.x
@elastic/elasticsearch@5
----
=== Usage
[source,js]
----
const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
// promise API
const result = await client.search({
index: 'my-index',
body: { foo: 'bar' }
})
// callback API
client.search({
index: 'my-index',
body: { foo: 'bar' }
}, (err, result) => {
if (err) console.log(err)
})
----

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
= TypeScript support
[[typescript]]
== TypeScript support
The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API.
@ -6,7 +7,7 @@ While the client offers type definitions for Request parameters, Request bodies
NOTE: If you are using TypeScript you will be required to use _snake_case_ style to define the API parameters instead of _camelCase_.
== How to extend the provided typings?
=== How to extend the provided typings?
Extend the provided typings is very straightforward, you should declare a custom `.d.ts` file and then write inside your type extensions, following there is an example of how do it.
[source,ts]
----

View File

@ -1,4 +1,5 @@
= Usage
[[client-usage]]
== Usage
Use the client is pretty straightforward, it supports all the public APIs of Elasticsearch, and every method exposes the same signature.

129
index.d.ts vendored
View File

@ -134,6 +134,8 @@ declare class Client extends EventEmitter {
followInfo: ApiMethod<RequestParams.CcrFollowInfo>
follow_stats: ApiMethod<RequestParams.CcrFollowStats>
followStats: ApiMethod<RequestParams.CcrFollowStats>
forget_follower: ApiMethod<RequestParams.CcrForgetFollower>
forgetFollower: ApiMethod<RequestParams.CcrForgetFollower>
get_auto_follow_pattern: ApiMethod<RequestParams.CcrGetAutoFollowPattern>
getAutoFollowPattern: ApiMethod<RequestParams.CcrGetAutoFollowPattern>
pause_follow: ApiMethod<RequestParams.CcrPauseFollow>
@ -183,6 +185,9 @@ declare class Client extends EventEmitter {
getScript: ApiMethod<RequestParams.GetScript>
get_source: ApiMethod<RequestParams.GetSource>
getSource: ApiMethod<RequestParams.GetSource>
graph: {
explore: ApiMethod<RequestParams.GraphExplore>
}
ilm: {
delete_lifecycle: ApiMethod<RequestParams.IlmDeleteLifecycle>
deleteLifecycle: ApiMethod<RequestParams.IlmDeleteLifecycle>
@ -276,7 +281,23 @@ declare class Client extends EventEmitter {
putPipeline: ApiMethod<RequestParams.IngestPutPipeline>
simulate: ApiMethod<RequestParams.IngestSimulate>
}
license: {
delete: ApiMethod<RequestParams.LicenseDelete>
get: ApiMethod<RequestParams.LicenseGet>
get_basic_status: ApiMethod<RequestParams.LicenseGetBasicStatus>
getBasicStatus: ApiMethod<RequestParams.LicenseGetBasicStatus>
get_trial_status: ApiMethod<RequestParams.LicenseGetTrialStatus>
getTrialStatus: ApiMethod<RequestParams.LicenseGetTrialStatus>
post: ApiMethod<RequestParams.LicensePost>
post_start_basic: ApiMethod<RequestParams.LicensePostStartBasic>
postStartBasic: ApiMethod<RequestParams.LicensePostStartBasic>
post_start_trial: ApiMethod<RequestParams.LicensePostStartTrial>
postStartTrial: ApiMethod<RequestParams.LicensePostStartTrial>
}
mget: ApiMethod<RequestParams.Mget>
migration: {
deprecations: ApiMethod<RequestParams.MigrationDeprecations>
}
ml: {
close_job: ApiMethod<RequestParams.MlCloseJob>
closeJob: ApiMethod<RequestParams.MlCloseJob>
@ -394,6 +415,24 @@ declare class Client extends EventEmitter {
reindexRethrottle: ApiMethod<RequestParams.ReindexRethrottle>
render_search_template: ApiMethod<RequestParams.RenderSearchTemplate>
renderSearchTemplate: ApiMethod<RequestParams.RenderSearchTemplate>
rollup: {
delete_job: ApiMethod<RequestParams.RollupDeleteJob>
deleteJob: ApiMethod<RequestParams.RollupDeleteJob>
get_jobs: ApiMethod<RequestParams.RollupGetJobs>
getJobs: ApiMethod<RequestParams.RollupGetJobs>
get_rollup_caps: ApiMethod<RequestParams.RollupGetRollupCaps>
getRollupCaps: ApiMethod<RequestParams.RollupGetRollupCaps>
get_rollup_index_caps: ApiMethod<RequestParams.RollupGetRollupIndexCaps>
getRollupIndexCaps: ApiMethod<RequestParams.RollupGetRollupIndexCaps>
put_job: ApiMethod<RequestParams.RollupPutJob>
putJob: ApiMethod<RequestParams.RollupPutJob>
rollup_search: ApiMethod<RequestParams.RollupRollupSearch>
rollupSearch: ApiMethod<RequestParams.RollupRollupSearch>
start_job: ApiMethod<RequestParams.RollupStartJob>
startJob: ApiMethod<RequestParams.RollupStartJob>
stop_job: ApiMethod<RequestParams.RollupStopJob>
stopJob: ApiMethod<RequestParams.RollupStopJob>
}
scripts_painless_execute: ApiMethod<RequestParams.ScriptsPainlessExecute>
scriptsPainlessExecute: ApiMethod<RequestParams.ScriptsPainlessExecute>
scroll: ApiMethod<RequestParams.Scroll>
@ -468,6 +507,12 @@ declare class Client extends EventEmitter {
verify_repository: ApiMethod<RequestParams.SnapshotVerifyRepository>
verifyRepository: ApiMethod<RequestParams.SnapshotVerifyRepository>
}
sql: {
clear_cursor: ApiMethod<RequestParams.SqlClearCursor>
clearCursor: ApiMethod<RequestParams.SqlClearCursor>
query: ApiMethod<RequestParams.SqlQuery>
translate: ApiMethod<RequestParams.SqlTranslate>
}
ssl: {
certificates: ApiMethod<RequestParams.SslCertificates>
}
@ -482,74 +527,28 @@ declare class Client extends EventEmitter {
updateByQuery: ApiMethod<RequestParams.UpdateByQuery>
update_by_query_rethrottle: ApiMethod<RequestParams.UpdateByQueryRethrottle>
updateByQueryRethrottle: ApiMethod<RequestParams.UpdateByQueryRethrottle>
watcher: {
ack_watch: ApiMethod<RequestParams.WatcherAckWatch>
ackWatch: ApiMethod<RequestParams.WatcherAckWatch>
activate_watch: ApiMethod<RequestParams.WatcherActivateWatch>
activateWatch: ApiMethod<RequestParams.WatcherActivateWatch>
deactivate_watch: ApiMethod<RequestParams.WatcherDeactivateWatch>
deactivateWatch: ApiMethod<RequestParams.WatcherDeactivateWatch>
delete_watch: ApiMethod<RequestParams.WatcherDeleteWatch>
deleteWatch: ApiMethod<RequestParams.WatcherDeleteWatch>
execute_watch: ApiMethod<RequestParams.WatcherExecuteWatch>
executeWatch: ApiMethod<RequestParams.WatcherExecuteWatch>
get_watch: ApiMethod<RequestParams.WatcherGetWatch>
getWatch: ApiMethod<RequestParams.WatcherGetWatch>
put_watch: ApiMethod<RequestParams.WatcherPutWatch>
putWatch: ApiMethod<RequestParams.WatcherPutWatch>
start: ApiMethod<RequestParams.WatcherStart>
stats: ApiMethod<RequestParams.WatcherStats>
stop: ApiMethod<RequestParams.WatcherStop>
}
xpack: {
graph: {
explore: ApiMethod<RequestParams.XpackGraphExplore>
}
info: ApiMethod<RequestParams.XpackInfo>
license: {
delete: ApiMethod<RequestParams.XpackLicenseDelete>
get: ApiMethod<RequestParams.XpackLicenseGet>
get_basic_status: ApiMethod<RequestParams.XpackLicenseGetBasicStatus>
getBasicStatus: ApiMethod<RequestParams.XpackLicenseGetBasicStatus>
get_trial_status: ApiMethod<RequestParams.XpackLicenseGetTrialStatus>
getTrialStatus: ApiMethod<RequestParams.XpackLicenseGetTrialStatus>
post: ApiMethod<RequestParams.XpackLicensePost>
post_start_basic: ApiMethod<RequestParams.XpackLicensePostStartBasic>
postStartBasic: ApiMethod<RequestParams.XpackLicensePostStartBasic>
post_start_trial: ApiMethod<RequestParams.XpackLicensePostStartTrial>
postStartTrial: ApiMethod<RequestParams.XpackLicensePostStartTrial>
}
migration: {
deprecations: ApiMethod<RequestParams.XpackMigrationDeprecations>
get_assistance: ApiMethod<RequestParams.XpackMigrationGetAssistance>
getAssistance: ApiMethod<RequestParams.XpackMigrationGetAssistance>
upgrade: ApiMethod<RequestParams.XpackMigrationUpgrade>
}
rollup: {
delete_job: ApiMethod<RequestParams.XpackRollupDeleteJob>
deleteJob: ApiMethod<RequestParams.XpackRollupDeleteJob>
get_jobs: ApiMethod<RequestParams.XpackRollupGetJobs>
getJobs: ApiMethod<RequestParams.XpackRollupGetJobs>
get_rollup_caps: ApiMethod<RequestParams.XpackRollupGetRollupCaps>
getRollupCaps: ApiMethod<RequestParams.XpackRollupGetRollupCaps>
get_rollup_index_caps: ApiMethod<RequestParams.XpackRollupGetRollupIndexCaps>
getRollupIndexCaps: ApiMethod<RequestParams.XpackRollupGetRollupIndexCaps>
put_job: ApiMethod<RequestParams.XpackRollupPutJob>
putJob: ApiMethod<RequestParams.XpackRollupPutJob>
rollup_search: ApiMethod<RequestParams.XpackRollupRollupSearch>
rollupSearch: ApiMethod<RequestParams.XpackRollupRollupSearch>
start_job: ApiMethod<RequestParams.XpackRollupStartJob>
startJob: ApiMethod<RequestParams.XpackRollupStartJob>
stop_job: ApiMethod<RequestParams.XpackRollupStopJob>
stopJob: ApiMethod<RequestParams.XpackRollupStopJob>
}
sql: {
clear_cursor: ApiMethod<RequestParams.XpackSqlClearCursor>
clearCursor: ApiMethod<RequestParams.XpackSqlClearCursor>
query: ApiMethod<RequestParams.XpackSqlQuery>
translate: ApiMethod<RequestParams.XpackSqlTranslate>
}
usage: ApiMethod<RequestParams.XpackUsage>
watcher: {
ack_watch: ApiMethod<RequestParams.XpackWatcherAckWatch>
ackWatch: ApiMethod<RequestParams.XpackWatcherAckWatch>
activate_watch: ApiMethod<RequestParams.XpackWatcherActivateWatch>
activateWatch: ApiMethod<RequestParams.XpackWatcherActivateWatch>
deactivate_watch: ApiMethod<RequestParams.XpackWatcherDeactivateWatch>
deactivateWatch: ApiMethod<RequestParams.XpackWatcherDeactivateWatch>
delete_watch: ApiMethod<RequestParams.XpackWatcherDeleteWatch>
deleteWatch: ApiMethod<RequestParams.XpackWatcherDeleteWatch>
execute_watch: ApiMethod<RequestParams.XpackWatcherExecuteWatch>
executeWatch: ApiMethod<RequestParams.XpackWatcherExecuteWatch>
get_watch: ApiMethod<RequestParams.XpackWatcherGetWatch>
getWatch: ApiMethod<RequestParams.XpackWatcherGetWatch>
put_watch: ApiMethod<RequestParams.XpackWatcherPutWatch>
putWatch: ApiMethod<RequestParams.XpackWatcherPutWatch>
start: ApiMethod<RequestParams.XpackWatcherStart>
stats: ApiMethod<RequestParams.XpackWatcherStats>
stop: ApiMethod<RequestParams.XpackWatcherStop>
}
}
}

View File

@ -4,7 +4,7 @@
"main": "index.js",
"types": "index.d.ts",
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
"version": "0.1.0-beta.2",
"version": "7.0.0-rc.1",
"keywords": [
"elasticsearch",
"elastic",
@ -21,7 +21,6 @@
"test:behavior": "tap test/behavior/*.test.js -J -t 300",
"test:integration": "tap test/integration/index.js -T --harmony --no-esm",
"test:types": "tsc --project ./test/types/tsconfig.json",
"test:benchmarks": "nanobench test/benchmarks/*.bench.js",
"test:coverage": "nyc npm run test:unit && nyc report --reporter=text-lcov > coverage.lcov && codecov",
"lint": "standard",
"lint:fix": "standard --fix",

View File

@ -28,5 +28,5 @@ exec docker run \
-v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \
-v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \
-p 9200:9200 \
docker.elastic.co/elasticsearch/elasticsearch:7.0.0-beta1
docker.elastic.co/elasticsearch/elasticsearch:7.0.0-rc1
# docker.elastic.co/elasticsearch/elasticsearch:6.6.0

View File

@ -9,5 +9,5 @@ exec docker run \
-p 9200:9200 \
--network=elastic \
--name=elasticsearch \
docker.elastic.co/elasticsearch/elasticsearch:7.0.0-beta1
docker.elastic.co/elasticsearch/elasticsearch:7.0.0-rc1
# docker.elastic.co/elasticsearch/elasticsearch:6.6.0

View File

@ -22,7 +22,16 @@
const dedent = require('dedent')
function generateDocs (common, spec) {
var doc = '= API Reference\n\n'
var doc = dedent`
[[api-reference]]
== API Reference
////////
This documentation is generated by running:
node scripts/run.js --tag v7.0.0-beta
////////\n\n`
doc += commonParameters(common)
spec.forEach(s => {
doc += '\n' + generateApiDoc(s)
@ -34,7 +43,8 @@ function commonParameters (spec) {
var doc = dedent`
=== Common parameters
Parameters that are accepted by all API endpoints.
https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html
link:{ref}/common-options.html[Reference]
[cols=2*]
|===\n`
Object.keys(spec.params).forEach(key => {
@ -60,7 +70,7 @@ function commonParameters (spec) {
function generateApiDoc (spec) {
const name = Object.keys(spec)[0]
const documentationUrl = spec[name].documentation
const documentationUrl = fixLink(name, spec[name].documentation)
const params = []
// url params
const urlParts = spec[name].url.parts
@ -104,31 +114,69 @@ function generateApiDoc (spec) {
[source,js]
----
client.${camelify(name)}([params] [, options] [, callback])
----
${documentationUrl || ''}
[cols=2*]
|===`
----\n`
if (documentationUrl) {
doc += `link:${documentationUrl}[Reference]\n`
}
doc += '\n' + params.reduce((acc, val) => {
const name = isSnakeCased(val.name) && val.name !== camelify(val.name)
? '`' + val.name + '` or `' + camelify(val.name) + '`'
: '`' + val.name + '`'
acc += dedent`
|${name}
|${'`' + val.type + '`'} - ${val.description}`
if (val.default) {
acc += ` +
_Default:_ ${'`' + val.default + '`'}`
}
return acc + '\n\n'
}, '')
if (params.length !== 0) {
doc += dedent`[cols=2*]
|===\n`
doc += params.reduce((acc, val) => {
const name = isSnakeCased(val.name) && val.name !== camelify(val.name)
? '`' + val.name + '` or `' + camelify(val.name) + '`'
: '`' + val.name + '`'
acc += dedent`
|${name}
|${'`' + val.type + '`'} - ${val.description}`
if (val.default) {
acc += ` +\n_Default:_ ${'`' + val.default + '`'}`
}
return acc + '\n\n'
}, '')
doc += dedent`
|===
`
doc += dedent`
|===
`
}
doc += '\n'
return doc
}
const LINK_OVERRIDES = {
'license.delete': '{ref}/delete-license.html',
'license.get': '{ref}/get-license.html',
'license.get_basic_status': '{ref}/get-basic-status.html',
'license.get_trial_status': '{ref}/get-trial-status.html',
'license.post': '{ref}/update-license.html',
'license.post_start_basic': '{ref}/start-basic.html',
'license.post_start_trial': '{ref}/start-trial.html',
'migration.deprecations': '{ref}/migration-api-deprecation.html',
'monitoring.bulk': '{ref}/es-monitoring.html',
'ingest.delete_pipeline': '{ref}/delete-pipeline-api.html',
'ingest.get_pipeline': '{ref}/get-pipeline-api.html',
'ingest.put_pipeline': '{ref}/put-pipeline-api.html',
'ingest.simulate': '{ref}/simulate-pipeline-api.html',
'ingest.processor_grok': '{ref}/grok-processor.html#grok-processor-rest-get'
}
// Fixes bad urls in the JSON spec
function fixLink (name, str) {
/* In 6.x some API start with `xpack.` when in master they do not. We
* can safely ignore that for link generation. */
name = name.replace(/^xpack\./, '')
const override = LINK_OVERRIDES[name]
if (override) return override
if (!str) return ''
/* Replace references to the guide with the attribute {ref} because
* the json files in the Elasticsearch repo are a bit of a mess. */
str = str.replace(/^.+guide\/en\/elasticsearch\/reference\/[^/]+\/([^./]*\.html(?:#.+)?)$/, '{ref}/$1')
str = str.replace(/frozen\.html/, 'freeze-index-api.html')
str = str.replace(/ml-file-structure\.html/, 'ml-find-file-structure.html')
str = str.replace(/security-api-get-user-privileges\.html/, 'security-api-get-privileges.html')
return str
}
function getType (type, options) {
switch (type) {
case 'list':

View File

@ -19,10 +19,10 @@
'use strict'
const generate = require('./generate')
const generate = require('./generateApis')
const generateRequestTypes = require('./generateRequestTypes')
const cloneAndCheckout = require('./clone-es')
const genFactory = require('./genMain')
const genFactory = require('./generateMain')
const generateDocs = require('./generateDocs')
module.exports = {

View File

@ -43,28 +43,33 @@ const customSkips = [
]
const platinumBlackList = {
// file path: test name
'cat.aliases/10_basic.yml': 'Empty cluster',
'index/10_with_id.yml': 'Index with ID',
'indices.get_alias/10_basic.yml': 'Get alias against closed indices',
'indices.get_alias/20_empty.yml': 'Check empty aliases when getting all aliases via /_alias',
'cat.aliases/10_basic.yml': ['Empty cluster'],
'index/10_with_id.yml': ['Index with ID'],
'indices.get_alias/10_basic.yml': ['Get alias against closed indices'],
'indices.get_alias/20_empty.yml': ['Check empty aliases when getting all aliases via /_alias'],
// https://github.com/elastic/elasticsearch/pull/39400
'ml/jobs_crud.yml': 'Test put job with id that is already taken',
// TODO: investigate why this is failing
'monitoring/bulk/10_basic.yml': '*',
'monitoring/bulk/20_privileges.yml': '*',
'license/20_put_license.yml': '*',
'snapshot/10_basic.yml': '*',
'ml/jobs_crud.yml': ['Test put job with id that is already taken'],
// it gets random failures on CI, must investigate
'ml/set_upgrade_mode.yml': [
'Attempt to open job when upgrade_mode is enabled',
'Setting upgrade mode to disabled from enabled'
],
// investigate why this is failing
'monitoring/bulk/10_basic.yml': ['*'],
'monitoring/bulk/20_privileges.yml': ['*'],
'license/20_put_license.yml': ['*'],
'snapshot/10_basic.yml': ['*'],
// the body is correct, but the regex is failing
'sql/sql.yml': 'Getting textual representation',
'sql/sql.yml': ['Getting textual representation'],
// we are setting two certificates in the docker config
'ssl/10_basic.yml': '*',
'ssl/10_basic.yml': ['*'],
// docker issue?
'watcher/execute_watch/60_http_input.yml': '*',
'watcher/execute_watch/60_http_input.yml': ['*'],
// the checks are correct, but for some reason the test is failing on js side
// I bet is because the backslashes in the rg
'watcher/execute_watch/70_invalid.yml': '*',
'watcher/put_watch/10_basic.yml': '*',
'xpack/15_basic.yml': '*'
'watcher/execute_watch/70_invalid.yml': ['*'],
'watcher/put_watch/10_basic.yml': ['*'],
'xpack/15_basic.yml': ['*']
}
function Runner (opts) {
@ -93,7 +98,7 @@ Runner.prototype.waitCluster = function (callback, times = 0) {
this.client.cluster.health(
{ waitForStatus: 'green', timeout: '50s' },
(err, res) => {
if (++times < 10) {
if (err && ++times < 10) {
setTimeout(() => {
this.waitCluster(callback, times)
}, 5000)
@ -184,10 +189,13 @@ Runner.prototype.start = function (opts) {
if (opts.isPlatinum) {
const list = Object.keys(platinumBlackList)
for (i = 0; i < list.length; i++) {
if (file.endsWith(list[i]) && (name === platinumBlackList[list[i]] || platinumBlackList[list[i]] === '*')) {
const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name
tap.skip(`Skipping test ${testName} because is blacklisted in the platinum test`)
return
const platTest = platinumBlackList[list[i]]
for (var j = 0; j < platTest.length; j++) {
if (file.endsWith(list[i]) && (name === platTest[j] || platTest[j] === '*')) {
const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name
tap.skip(`Skipping test ${testName} because is blacklisted in the platinum test`)
return
}
}
}
}

View File

@ -182,15 +182,15 @@ TestRunner.prototype.cleanupPlatinum = function (q, done) {
})
q.add((q, done) => {
this.client.xpack.rollup.getJobs({ id: '_all' }, (err, { body }) => {
this.client.rollup.getJobs({ id: '_all' }, (err, { body }) => {
this.tap.error(err, 'should not error: rollup.getJobs')
const jobs = body.jobs.map(j => j.config.id)
helper.runInParallel(
this.client, 'xpack.rollup.stopJob',
this.client, 'rollup.stopJob',
jobs.map(j => ({ id: j, waitForCompletion: true }))
)
.then(() => helper.runInParallel(
this.client, 'xpack.rollup.deleteJob',
this.client, 'rollup.deleteJob',
jobs.map(j => ({ id: j }))
))
.then(() => done())