Compare commits

..

98 Commits

Author SHA1 Message Date
75d58a895f Bumped v7.3.0 2019-08-01 10:12:55 +02:00
74f933a2a6 API generation 2019-08-01 10:10:05 +02:00
8c78f47ac3 Support for Elasticsearch 7.3 (#928) 2019-08-01 10:09:16 +02:00
823c209c32 API generation 2019-07-25 11:14:14 +02:00
6ec653e7ac Better reference code examples (#920)
* Updated documentation genertation script to build small code snippets

* Updated docs reference

* Removed slm doc

* Add commas and remove empty objects
2019-07-25 11:13:12 +02:00
29ad0735c2 Updated automatically the main typings file with the generated t… (#919)
* Updated automatically the main typings file with the generated types

* Removed useless log
2019-07-25 11:12:32 +02:00
f74123fb53 fix(Typings): sniffInterval can also be boolean (#914) 2019-07-22 10:40:22 +02:00
f10d55f32d Updated test matrix 2019-07-17 18:40:11 +02:00
2ceb04697b Fix typo in comments (#912) 2019-07-17 17:05:16 +02:00
4d5a79cae0 Improve README (#909)
* Updated README

* Updated asciidoc intro

* Updated intro title

* Update README.md

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Update README.md

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Update README.md

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Update README.md

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Update README.md

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Update docs/introduction.asciidoc

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Update docs/introduction.asciidoc

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Updated asciidoc intro
2019-07-17 10:30:13 +02:00
52416cd072 Added support for arbitrary_key (#910) 2019-07-16 12:21:39 +02:00
eb069b10a2 Update deepmerge requirement from ^3.2.0 to ^4.0.0 (#898) 2019-07-15 16:54:31 +02:00
715aee4dd1 Update tap requirement from ^13.0.1 to ^14.4.1 (#900) 2019-07-15 16:54:31 +02:00
94679a2001 Update @types/node requirement from ^11.13.7 to ^12.6.2 (#899) 2019-07-15 16:54:31 +02:00
0df026d3ff Update standard requirement from ^12.0.1 to ^13.0.2 (#906) 2019-07-15 16:54:31 +02:00
33ad918e2e Merge branch '7.x' of https://github.com/elastic/elasticsearch-js into 7.x 2019-07-10 15:48:09 +02:00
af8f3feaf9 Improve integration test (#859)
* CI: Added junit plugin

* Updated .gitignore

* Added integration test reporter

* Updated integration testing suite

* Updated ci config

* Updated report file path

* Use refresh 'true' instead of 'wait_for'

* Disable junit reporting

* Refresh one single time

* Update security index name

* Updated skip test handling and use class syntax

* Updated test script

* Disable test timeout

* Added command to automatically remove an old snapshot

* Disable timeout in integration test script

* Updated logs and cleaned up git handling

* Fixed shouldSkip utility

* Updated cleanup code

* Updated cleanup code pt 2

* Rename Platinum to XPack
2019-07-10 15:47:57 +02:00
63c62b6b68 Updated travis configuration (#894)
* Updated travis configuration

* Run license checker only in Linux

* Fixed script

* Fix windows test
2019-07-08 16:30:15 +02:00
3942ed722c Bumped v7.2.0 2019-07-05 11:39:08 +02:00
2e62e4ac58 Merge branch '7.x' of https://github.com/elastic/elasticsearch-js into 7.x 2019-07-04 14:43:15 +02:00
060d4ae5fc Remove auth data from inspect and toJSON in connection class (#887)
* Remove auth data from inspect and toJSON in connection class

* Updated test
2019-07-04 14:43:01 +02:00
b0861fae0d Support for 7.2 (#884)
* API generation

* Add 7.2.0 to testing matrix

* Use 7.2.0-SNAPSHOT

* API generation

* Updated custom skips

* Updated ES version

* Updated esDefaultRoles
2019-07-04 11:27:14 +02:00
0918df8e7d Updated type definitions (#882)
* Updated type definitions

* Updated test
2019-06-19 09:15:31 +02:00
e86a6371c5 Support branch for code generation (#883) 2019-06-18 15:46:22 +02:00
53e326275b Added cloud configuration example (#880)
* Added cloud configuration example

* Used cloud example from auth docs and added link
2019-06-14 10:13:01 +02:00
48e277fd07 [DOCS] Fixes typo (#877) 2019-06-12 08:42:01 +02:00
40603cde72 Merge branch '7.x' of https://github.com/elastic/elasticsearch-js into 7.x 2019-06-03 12:28:57 +02:00
896c742407 Docs: added missing configuration options (#870) 2019-06-03 12:28:50 +02:00
22880d4659 Added ES 7.1 2019-05-22 17:53:08 +02:00
21a84654f6 Bumped v7.1.0 2019-05-22 12:18:55 +02:00
bb0ff22fd2 Support for non-friendly chars in url username and password (#858)
* Support for non-friendly chars in url username and password
- Added auth option to Connection class
- Updated pool.addConnection

* Updated test
2019-05-20 17:10:17 +02:00
9897ba8831 Patch #855 2019-05-17 09:07:01 -04:00
c922661fda API generation 2019-05-16 16:53:38 -04:00
597dd28340 Patch deprecated parameters (#851)
* Updated code generation

* API generation

* API generation

* Updated code generation
2019-05-16 16:53:05 -04:00
cc0dc10c64 missing comma (#854) 2019-05-16 09:39:11 -04:00
9c5394ecdb Bumped v7.0.1 2019-05-14 17:49:52 -04:00
96a103b305 Added toJSON method to Connection class (#849)
* Added toJSON method to Connection class

* Updated test

* Updated typings
2019-05-14 12:01:21 -04:00
3e9ae8b29c Fix #803 (#846) 2019-05-14 12:01:21 -04:00
064807c5a9 Fix 843 (#845)
* Fix #843

* Updated test
2019-05-10 10:56:06 +02:00
72b67fe4d7 Bumped v7.0.0 2019-05-09 15:33:58 +02:00
6f2767628c Fix 841 (#842)
* Added errors to exported members

* Updated test
2019-05-09 14:57:33 +02:00
96137788db Bumped v7.0.0-rc.3 2019-05-06 12:05:27 +02:00
8136846a78 API generation 2019-05-06 12:04:41 +02:00
62e9805311 Updated installation instructions (#840) 2019-05-06 12:02:08 +02:00
907f9d085c Added User-Agent header (#807)
* Added User-Agent header

* Updated test

* Updated user-agent format

* Updated test
2019-05-06 09:59:55 +02:00
0c1fb22631 API generation 2019-05-03 19:03:34 +02:00
132072b8ab Simplify API wrappers (#839)
* Updated code generation

* API generation

* Updated test

* Updated code generation

* API generation

* API generation
2019-05-03 19:03:09 +02:00
99ada00747 API generation 2019-05-03 17:26:07 +02:00
b1458e3511 Improve observability (#834)
* API generation

* Added correlation id support

* Updated docs

* Updated test

* Updated code generation

* API generation

* Updated code generation

* Added support for client name and custom context object

* Updated docs

* Updated test

* Fix docs

* Updated docs

* Added id support also for sniffing

* Updated test

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Apply suggestions

* Update docs/configuration.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/configuration.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Apply suggestions

* Updated README.md

* Fixed test

* Addressed suggestions
2019-05-03 17:25:25 +02:00
9dacd9d9ee Better handling of hostname/ip:port format (#837)
* Better handling of hostname/ip:port format

* Updated test
2019-05-03 17:25:04 +02:00
d6577b7fa1 Updated installation instructions (#835)
* Updated installation instructions

* Added a note about Elasticsearch master
2019-05-03 17:25:04 +02:00
ddb72d6e50 Fix resurrect timeout formula (#833)
* Fixes #827

* Updated test
2019-04-29 09:19:53 +02:00
9bb2d237e4 Node v12 and bumped dependencies (#832)
* Node v12

* Bumped dependencies

* Disable automatic code coverage
2019-04-26 17:26:14 +02:00
4099532617 Updated .travis.yml (#831) 2019-04-26 15:04:17 +02:00
37544399ce API generation 2019-04-26 15:03:20 +02:00
12e88d6f87 Support for deprecated paths (#828)
* Updated code generation

* API generation

* Updated test
2019-04-26 15:02:49 +02:00
dbfeb5d1a9 Update RequestEvent to use parameterized type T (#822)
Updated `RequestEvent` to use parameterized type `T`.  In reference to:

https://github.com/elastic/elasticsearch-js/pull/819#issuecomment-484594841
2019-04-19 10:07:17 +02:00
84a837ce11 Bumped v7.0.0-rc.2 2019-04-17 14:16:43 +02:00
dc009dc3a5 Use Elasticsearch 7.0.0 (#820) 2019-04-17 14:13:04 +02:00
d4f4b47d7e Updated typings (#819) 2019-04-17 11:24:28 +02:00
cfd4e70fb9 Drop Node.js v6 support (#818)
Node.js v6 will go EOL at the end of April 2019, and already two of the production dependencies of the client have already dropped support for it, and soon others will do *(as well as development dependencies)*.

Furthermore, since Node.js will go in EOL it will never get security patches, plus, also OpenSSL-1.0.2 will go EOL [this year](https://github.com/nodejs/Release#release-schedule); to avoid risks for the client users it is better to drop support for Node.js v6 right away.
2019-04-17 11:24:28 +02:00
68f8b7bb5f Fix a typo in usage example (#806) 2019-04-11 08:27:57 +02:00
777e438482 API generation 2019-04-10 11:44:12 +02:00
29beb44bf5 Improve typings (#813)
The ApiResponse now accepts a generics that defaults to any, same for every API method that might need a body.
2019-04-10 11:43:14 +02:00
ef3126b361 Custom http agent support (#810) 2019-04-10 11:42:51 +02:00
6cc2b21ce2 Use Elasticsearch 7.0.0-rc2 2019-04-09 12:10:10 +02:00
02c656c364 Support for publish_address as hostname/ip:port (#804) 2019-04-09 12:06:22 +02:00
77fcca871f Updated README.md 2019-04-01 09:50:23 +02:00
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
194 changed files with 3940 additions and 2591 deletions

224
.ci/Jenkinsfile vendored
View File

@ -1,224 +0,0 @@
#!/usr/bin/env groovy
@Library('apm@current') _
def NODE_JS_VERSIONS = [8,10,12]
def nodeJsVersion = NODE_JS_VERSIONS[randomNumber(min: 0, max:2)]
pipeline {
agent {
label 'docker && immutable'
}
environment {
REPO = 'elasticsearch-js'
BASE_DIR = "src/github.com/elastic/${env.REPO}"
NODE_JS_DEFAULT_VERSION = "${nodeJsVersion}"
NODE_JS_VERSIONS = "${NODE_JS_VERSIONS.join(',')}"
HOME = "${env.WORKSPACE}"
npm_config_cache = 'npm-cache'
}
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
timestamps()
ansiColor('xterm')
disableResume()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
triggers {
issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*')
// env.CHANGE_ID as a value in case of a commit or a pr, which means
// that we will have a daily cron job only for branches that don't have an active pr
cron(env.CHANGE_ID ? '' : '@daily')
}
stages {
stage('Checkout') {
options { skipDefaultCheckout() }
steps {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false)
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
}
}
stage('Install dependencies') {
options { skipDefaultCheckout() }
steps {
deleteDir()
unstash 'source'
script {
buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){
dir("${BASE_DIR}"){
sh(label: 'System info', script: 'node --version; npm --version')
sh(label: 'Install dependencies', script: 'npm install')
}
}
}
stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false
}
}
stage('License check') {
options { skipDefaultCheckout() }
steps {
withGithubNotify(context: 'License check') {
deleteDir()
unstash 'source-dependencies'
script {
buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){
dir("${BASE_DIR}"){
sh(label: 'Check production dependencies licenses', script: 'npm run license-checker')
}
}
}
}
}
}
stage('Linter') {
options { skipDefaultCheckout() }
steps {
withGithubNotify(context: 'Linter') {
deleteDir()
unstash 'source-dependencies'
script {
buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){
dir("${BASE_DIR}"){
sh(label: 'Lint code with standardjs', script: 'npm run lint')
}
}
}
}
}
}
stage('Unit test') {
failFast true
options { skipDefaultCheckout() }
steps {
withGithubNotify(context: 'Unit test') {
script {
def versions = env.NODE_JS_VERSIONS.split(',')
def parallelTasks = [:]
versions.each{ version ->
parallelTasks["Node.js v${version}"] = buildUnitTest(version: version)
}
parallel(parallelTasks)
}
}
}
}
stage('Integration test') {
failFast true
options { skipDefaultCheckout() }
parallel {
stage('OSS') {
agent { label 'docker && immutable' }
options { skipDefaultCheckout() }
environment {
TEST_ES_SERVER = 'http://elasticsearch:9200'
}
steps {
withGithubNotify(context: 'Integration test OSS') {
deleteDir()
unstash 'source-dependencies'
dir("${BASE_DIR}"){
// Sometimes the docker registry fails and has random timeouts
// this block will retry a doker image 3 times before to fail.
retry(3) {
sleep randomNumber(min: 5, max: 10)
sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach')
}
}
script {
buildDockerImage(fromDockerfile: true).inside('--network=elastic'){
dir("${BASE_DIR}"){
sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap')
sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml')
}
}
}
sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)')
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml")
}
}
}
stage('xPack') {
agent { label 'docker && immutable' }
options { skipDefaultCheckout() }
environment {
TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200'
}
steps {
withGithubNotify(context: 'Integration test xPack') {
deleteDir()
unstash 'source-dependencies'
dir("${BASE_DIR}"){
// Sometimes the docker registry fails and has random timeouts
// this block will retry a doker image 3 times before to fail.
retry(3) {
sleep randomNumber(min: 5, max: 10)
sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach')
}
}
script {
buildDockerImage(fromDockerfile: true).inside('--network=elastic'){
dir("${BASE_DIR}"){
sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap')
sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml')
}
}
}
sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)')
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml")
}
}
}
}
}
}
}
// Sometimes the docker registry fails and has random timeouts
// this function will retry a doker image 3 times before to fail.
def buildDockerImage(args) {
def image
retry(3) {
sleep randomNumber(min: 5, max: 10)
if (args.fromDockerfile == true) {
image = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker")
} else {
image = docker.image(args.image)
// make sure we have the latest available from Docker Hub
image.pull()
}
}
return image
}
def buildUnitTest(args) {
return {
node('docker && immutable') {
deleteDir()
unstash 'source'
script {
buildDockerImage(image: "node:${args.version}-alpine").inside(){
dir("${BASE_DIR}"){
sh(label: 'Install dependencies', script: 'npm install')
sh(label: 'Run unit test', script: 'npm run test:unit | tee test-unit.tap')
sh(label: 'Run behavior test', script: 'npm run test:behavior | tee test-behavior.tap')
sh(label: 'Run types test', script: 'npm run test:types')
sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-unit.tap > junit-unit.xml; ./node_modules/.bin/tap-mocha-reporter xunit < test-behavior.tap > junit-behavior.xml')
}
}
}
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml")
}
}
}

View File

@ -22,7 +22,7 @@ services:
- elasticsearch-oss
elasticsearch-oss:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:${ELASTICSEARCH_VERSION:-6.6.2}
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.0.0-SNAPSHOT}
volumes:
- esvol:/tmp
networks:
@ -58,7 +58,7 @@ services:
command: ["npm", "run", "test:integration"]
elasticsearch-platinum:
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-6.6.2}
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.0.0-SNAPSHOT}
ports:
- "9200:9200"
networks:

View File

@ -1,7 +0,0 @@
ARG NODE_JS_VERSION=10
FROM node:${NODE_JS_VERSION}-alpine
RUN apk --no-cache add git
# Create app directory
WORKDIR /usr/src/app

70
.ci/jobs/defaults.yml Normal file
View File

@ -0,0 +1,70 @@
---
##### GLOBAL METADATA
- meta:
cluster: clients-ci
##### JOB DEFAULTS
- job:
project-type: matrix
logrotate:
daysToKeep: 30
numToKeep: 100
properties:
- github:
url: https://github.com/elastic/elasticsearch-js/
- inject:
properties-content: HOME=$JENKINS_HOME
concurrent: true
node: flyweight
scm:
- git:
name: origin
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
reference-repo: /var/lib/jenkins/.git-references/elasticsearch-js.git
branches:
- ${branch_specifier}
url: https://github.com/elastic/elasticsearch-js.git
wipe-workspace: 'True'
triggers:
- github
vault:
# vault read auth/approle/role/clients-ci/role-id
role_id: ddbd0d44-0e51-105b-177a-c8fdfd445126
axes:
- axis:
type: slave
name: label
values:
- linux
- axis:
type: yaml
filename: .ci/test-matrix.yml
name: ELASTICSEARCH_VERSION
- axis:
type: yaml
filename: .ci/test-matrix.yml
name: NODE_JS_VERSION
yaml-strategy:
exclude-key: exclude
filename: .ci/test-matrix.yml
wrappers:
- ansicolor
- timeout:
type: absolute
timeout: 120
fail: true
- timestamps
- workspace-cleanup
builders:
- shell: |-
#!/usr/local/bin/runbld
.ci/run-tests
publishers:
- email:
recipients: infra-root+build@elastic.co
# - junit:
# results: "*-junit.xml"
# allow-empty-results: true

View File

@ -0,0 +1,14 @@
---
- job:
name: elastic+elasticsearch-js+5.x
display-name: 'elastic / elasticsearch-js # 5.x'
description: Testing the elasticsearch-js 5.x branch.
parameters:
- string:
name: branch_specifier
default: refs/heads/5.x
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: '@weekly'

View File

@ -0,0 +1,14 @@
---
- job:
name: elastic+elasticsearch-js+6.x
display-name: 'elastic / elasticsearch-js # 6.x'
description: Testing the elasticsearch-js 6.x branch.
parameters:
- string:
name: branch_specifier
default: refs/heads/6.x
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: '@weekly'

View File

@ -0,0 +1,14 @@
---
- job:
name: elastic+elasticsearch-js+7.3
display-name: 'elastic / elasticsearch-js # 7.3'
description: Testing the elasticsearch-js 7.3 branch.
parameters:
- string:
name: branch_specifier
default: refs/heads/7.3
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: '@weekly'

View File

@ -0,0 +1,14 @@
---
- job:
name: elastic+elasticsearch-js+7.x
display-name: 'elastic / elasticsearch-js # 7.x'
description: Testing the elasticsearch-js 7.x branch.
parameters:
- string:
name: branch_specifier
default: refs/heads/7.x
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: '@weekly'

View File

@ -1,25 +1,24 @@
---
- job:
name: elastic+elasticsearch-js+mbp
display-name: 'elastic / elasticsearch-js'
description: Testing elasticsearch-js.
name: elastic+elasticsearch-js+jenkins-pipelines
display-name: 'elastic / elasticsearch-js # jenkins-pipelines'
description: Testing the elasticsearch-js jenkins-pipelines branch.
project-type: multibranch
properties: []
triggers: []
logrotate:
daysToKeep: 30
numToKeep: 100
number-to-keep: '5'
days-to-keep: '1'
concurrent: true
node: linux
script-path: .ci/Jenkinsfile
script-path: Jenkinsfile
scm:
- github:
branch-discovery: no-pr
branch-discovery: all
discover-pr-forks-strategy: merge-current
discover-pr-forks-trust: permission
discover-pr-origin: merge-current
discover-tags: false
discover-tags: true
repo: elasticsearch-js
repo-owner: elastic
credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken

View File

@ -0,0 +1,14 @@
---
- job:
name: elastic+elasticsearch-js+master
display-name: 'elastic / elasticsearch-js # master'
description: Testing the elasticsearch-js master branch.
parameters:
- string:
name: branch_specifier
default: refs/heads/master
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: '@daily'

View File

@ -0,0 +1,19 @@
---
- job:
name: elastic+elasticsearch-js+pull-request
display-name: 'elastic / elasticsearch-js # pull-request'
description: Testing of elasticsearch-js pull requests.
scm:
- git:
branches:
- ${ghprbActualCommit}
refspec: +refs/pull/*:refs/remotes/origin/pr/*
triggers:
- github-pull-request:
org-list:
- elastic
allow-whitelist-orgs-as-admins: true
github-hooks: true
status-context: clients-ci
cancel-builds-on-update: true
publishers: []

View File

@ -1,14 +0,0 @@
#!/usr/bin/env bash
source /usr/local/bin/bash_standard_lib.sh
DOCKER_IMAGES="node:12-alpine
node:10-alpine
node:8-alpine
"
for di in ${DOCKER_IMAGES}
do
(retry 2 docker pull "${di}") || echo "Error pulling ${di} Docker image, we continue"
done

View File

@ -1,6 +1,6 @@
---
ELASTICSEARCH_VERSION:
- 6.8.1
- 7.3.0
NODE_JS_VERSION:
- 12

View File

@ -3,7 +3,7 @@
#### You have already researched for similar issues?
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
#### Are you sure this is an issue with @elastic/elasticsearch or are you just looking for some help?
#### Are you sure this is an issue with `@elastic/elasticsearch` or are you just looking for some help?
Issues should only be posted in this repository after you have been able to reproduce them and confirm that they are a bug or incorrect/missing information in the [docs](https://github.com/elastic/elasticsearch-js/docs).

View File

@ -23,6 +23,14 @@ Paste your code here:
```
<!--
In some cases, it might be challenging to reproduce the bug in a few lines of code.
You can fork the following repository, which contains all the configuration needed
to spin up a three nodes Elasticsearch cluster with security enabled.
The repository also contains a preconfigured client instance that you can use to reproduce the issue.
https://github.com/delvedor/es-reproduce-issue
--->
## Expected behavior
A clear and concise description of what you expected to happen.
@ -36,6 +44,6 @@ Paste the results here:
## Your Environment
- *node version*: 6,8,10
- *@elastic/elasticsearch version*: >=7.0.0
- `@elastic/elasticsearch` *version*: >=7.0.0
- *os*: Mac, Windows, Linux
- *any other relevant information*

View File

@ -29,6 +29,14 @@ Paste your code here:
```
<!--
In some cases, it might be challenging to reproduce the bug in a few lines of code.
You can fork the following repository, which contains all the configuration needed
to spin up a three nodes Elasticsearch cluster with security enabled.
The repository also contains a preconfigured client instance that you can use to reproduce the issue.
https://github.com/delvedor/es-reproduce-issue
--->
## Expected behavior
A clear and concise description of what you expected to happen.
@ -42,6 +50,6 @@ Paste the results here:
## Your Environment
- *node version*: 6,8,10
- *@elastic/elasticsearch version*: >=7.0.0
- `@elastic/elasticsearch` *version*: >=7.0.0
- *os*: Mac, Windows, Linux
- *any other relevant information*

1
.github/stale.yml vendored
View File

@ -9,6 +9,7 @@ exemptLabels:
- "discussion"
- "feature request"
- "bug"
- "todo"
# Label to use when marking an issue as stale
staleLabel: stale

View File

@ -5,9 +5,6 @@ node_js:
- "10"
- "8"
cache:
npm: false
os:
- windows
- linux
@ -17,9 +14,7 @@ install:
script:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then npm run license-checker; fi
- npm run lint
- npm run test:coverage
- npm run test:types
- npm run test
notifications:
email:

View File

@ -20,7 +20,6 @@ function buildBulk (opts) {
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
* @param {string} type - Default document type for items which don't provide one
* @param {list} fields - Default comma-separated list of fields to return in the response for updates, can be overridden on each sub-request
* @param {list} _source - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request
* @param {list} _source_excludes - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
* @param {list} _source_includes - Default list of fields to extract and return from the _source field, can be overridden on each sub-request
@ -34,7 +33,6 @@ function buildBulk (opts) {
'routing',
'timeout',
'type',
'fields',
'_source',
'_source_excludes',
'_source_exclude',

View File

@ -24,6 +24,7 @@ function buildCatIndices (opts) {
* @param {boolean} pri - Set to true to return stats only for primary shards
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
* @param {boolean} include_unloaded_segments - If set to true segment stats will include stats for segments that are not currently loaded into memory
*/
const acceptedQuerystring = [
@ -37,6 +38,7 @@ function buildCatIndices (opts) {
'pri',
's',
'v',
'include_unloaded_segments',
'pretty',
'human',
'error_trace',
@ -46,6 +48,7 @@ function buildCatIndices (opts) {
const snakeCase = {
masterTimeout: 'master_timeout',
includeUnloadedSegments: 'include_unloaded_segments',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -36,6 +36,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

@ -11,7 +11,7 @@ function buildClearScroll (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request
* Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll) request
*
* @param {list} scroll_id - A comma-separated list of scroll IDs to clear
* @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter

View File

@ -14,6 +14,7 @@ function buildClusterHealth (opts) {
* Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request
*
* @param {list} index - Limit the information returned to a specific index
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {enum} level - Specify the level of detail for returned information
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
@ -27,6 +28,7 @@ function buildClusterHealth (opts) {
*/
const acceptedQuerystring = [
'expand_wildcards',
'level',
'local',
'master_timeout',
@ -45,6 +47,7 @@ function buildClusterHealth (opts) {
]
const snakeCase = {
expandWildcards: 'expand_wildcards',
masterTimeout: 'master_timeout',
waitForActiveShards: 'wait_for_active_shards',
waitForNodes: 'wait_for_nodes',

View File

@ -17,7 +17,6 @@ function buildCreate (opts) {
* @param {string} index - The name of the index
* @param {string} type - The type of the document
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
* @param {string} parent - ID of the parent document
* @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
@ -29,7 +28,6 @@ function buildCreate (opts) {
const acceptedQuerystring = [
'wait_for_active_shards',
'parent',
'refresh',
'routing',
'timeout',
@ -71,10 +69,6 @@ function buildCreate (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
@ -101,7 +95,11 @@ function buildCreate (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -0,0 +1,85 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFrameDeleteDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.delete_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform to delete
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function dataFrameDeleteDataFrameTransform (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'DELETE'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
// build request object
const request = {
method,
path,
body: '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFrameDeleteDataFrameTransform

View File

@ -0,0 +1,90 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFrameGetDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.get_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html) request
*
* @param {string} transform_id - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms
* @param {int} from - skips a number of transform configs, defaults to 0
* @param {int} size - specifies a max number of transforms to get, defaults to 100
* @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified)
*/
const acceptedQuerystring = [
'from',
'size',
'allow_no_match'
]
const snakeCase = {
allowNoMatch: 'allow_no_match'
}
return function dataFrameGetDataFrameTransform (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((transform_id || transformId) != null) {
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
} else {
path = '/' + '_data_frame' + '/' + 'transforms'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFrameGetDataFrameTransform

View File

@ -0,0 +1,86 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFrameGetDataFrameTransformStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request
*
* @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms
* @param {number} from - skips a number of transform stats, defaults to 0
* @param {number} size - specifies a max number of transform stats to get, defaults to 100
* @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified)
*/
const acceptedQuerystring = [
'from',
'size',
'allow_no_match'
]
const snakeCase = {
allowNoMatch: 'allow_no_match'
}
return function dataFrameGetDataFrameTransformStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stats'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFrameGetDataFrameTransformStats

View File

@ -0,0 +1,81 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFramePreviewDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.preview_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html) request
*
* @param {object} body - The definition for the data_frame transform to preview
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function dataFramePreviewDataFrameTransform (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + '_preview'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFramePreviewDataFrameTransform

View File

@ -0,0 +1,86 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFramePutDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.put_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the new transform.
* @param {object} body - The data frame transform definition
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function dataFramePutDataFrameTransform (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'PUT'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFramePutDataFrameTransform

View File

@ -0,0 +1,86 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFrameStartDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.start_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform to start
* @param {time} timeout - Controls the time to wait for the transform to start
*/
const acceptedQuerystring = [
'timeout'
]
const snakeCase = {
}
return function dataFrameStartDataFrameTransform (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_start'
// build request object
const request = {
method,
path,
body: '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFrameStartDataFrameTransform

View File

@ -0,0 +1,91 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFrameStopDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.stop_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform to stop
* @param {boolean} wait_for_completion - Whether to wait for the transform to fully stop before returning or not. Default to false
* @param {time} timeout - Controls the time to wait until the transform has stopped. Default to 30 seconds
* @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame transforms. (This includes `_all` string or when no data frame transforms have been specified)
*/
const acceptedQuerystring = [
'wait_for_completion',
'timeout',
'allow_no_match'
]
const snakeCase = {
waitForCompletion: 'wait_for_completion',
allowNoMatch: 'allow_no_match'
}
return function dataFrameStopDataFrameTransform (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stop'
// build request object
const request = {
method,
path,
body: '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFrameStopDataFrameTransform

View File

@ -17,7 +17,6 @@ function buildDelete (opts) {
* @param {string} index - The name of the index
* @param {string} type - The type of the document
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
* @param {string} parent - ID of parent document
* @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
@ -29,7 +28,6 @@ function buildDelete (opts) {
const acceptedQuerystring = [
'wait_for_active_shards',
'parent',
'refresh',
'routing',
'timeout',
@ -74,24 +72,11 @@ function buildDelete (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// check required url components
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: type, index')
return handleError(err, callback)
} else if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -113,7 +98,11 @@ function buildDelete (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -31,7 +31,8 @@ function buildDeleteByQuery (opts) {
* @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search
* @param {enum} search_type - Search operation type
* @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout.
* @param {number} size - Number of hits to return (default: 10)
* @param {number} size - Deprecated, please use `max_docs` instead
* @param {number} max_docs - Maximum number of documents to process (default: all documents)
* @param {list} sort - A comma-separated list of <field>:<direction> pairs
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
@ -68,6 +69,7 @@ function buildDeleteByQuery (opts) {
'search_type',
'search_timeout',
'size',
'max_docs',
'sort',
'_source',
'_source_excludes',
@ -100,6 +102,7 @@ function buildDeleteByQuery (opts) {
expandWildcards: 'expand_wildcards',
searchType: 'search_type',
searchTimeout: 'search_timeout',
maxDocs: 'max_docs',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',

View File

@ -17,7 +17,6 @@ function buildExists (opts) {
* @param {string} index - The name of the index
* @param {string} type - The type of the document (use `_all` to fetch the first document matching the ID across all types)
* @param {list} stored_fields - A comma-separated list of stored fields to return in the response
* @param {string} parent - The ID of the parent document
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
@ -31,7 +30,6 @@ function buildExists (opts) {
const acceptedQuerystring = [
'stored_fields',
'parent',
'preference',
'realtime',
'refresh',
@ -82,10 +80,6 @@ function buildExists (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
@ -112,7 +106,11 @@ function buildExists (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -15,8 +15,7 @@ function buildExistsSource (opts) {
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
* @param {string} type - The type of the document; use `_all` to fetch the first document matching the ID across all types
* @param {string} parent - The ID of the parent document
* @param {string} type - The type of the document; deprecated and optional starting with 7.0
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
@ -29,7 +28,6 @@ function buildExistsSource (opts) {
*/
const acceptedQuerystring = [
'parent',
'preference',
'realtime',
'refresh',
@ -79,10 +77,6 @@ function buildExistsSource (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
@ -118,7 +112,11 @@ function buildExistsSource (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -22,7 +22,6 @@ function buildExplain (opts) {
* @param {string} df - The default field for query string query (default: _all)
* @param {list} stored_fields - A comma-separated list of stored fields to return in the response
* @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
* @param {string} parent - The ID of the parent document
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {string} q - Query in the Lucene query string syntax
* @param {string} routing - Specific routing value
@ -39,7 +38,6 @@ function buildExplain (opts) {
'df',
'stored_fields',
'lenient',
'parent',
'preference',
'q',
'routing',
@ -88,10 +86,6 @@ function buildExplain (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
@ -114,7 +108,11 @@ function buildExplain (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -18,7 +18,7 @@ function buildFieldCaps (opts) {
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {object} body - Field json objects containing an array of field names
* @param {boolean} include_unmapped - Indicates whether unmapped fields should be included in the response.
*/
const acceptedQuerystring = [
@ -26,6 +26,7 @@ function buildFieldCaps (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'include_unmapped',
'pretty',
'human',
'error_trace',
@ -37,6 +38,7 @@ function buildFieldCaps (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
includeUnmapped: 'include_unmapped',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -53,6 +55,12 @@ function buildFieldCaps (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}`)
@ -84,7 +92,7 @@ function buildFieldCaps (opts) {
const request = {
method,
path,
body: body || '',
body: '',
querystring
}

View File

@ -17,7 +17,6 @@ function buildGet (opts) {
* @param {string} index - The name of the index
* @param {string} type - The type of the document (use `_all` to fetch the first document matching the ID across all types)
* @param {list} stored_fields - A comma-separated list of stored fields to return in the response
* @param {string} parent - The ID of the parent document
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
@ -25,15 +24,12 @@ function buildGet (opts) {
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
const acceptedQuerystring = [
'stored_fields',
'parent',
'preference',
'realtime',
'refresh',
@ -84,10 +80,6 @@ function buildGet (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
@ -114,7 +106,11 @@ function buildGet (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -15,8 +15,7 @@ function buildGetSource (opts) {
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
* @param {string} type - The type of the document; use `_all` to fetch the first document matching the ID across all types
* @param {string} parent - The ID of the parent document
* @param {string} type - The type of the document; deprecated and optional starting with 7.0
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
@ -29,7 +28,6 @@ function buildGetSource (opts) {
*/
const acceptedQuerystring = [
'parent',
'preference',
'realtime',
'refresh',
@ -79,10 +77,6 @@ function buildGetSource (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
@ -109,7 +103,11 @@ function buildGetSource (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
}
// build request object
const request = {

View File

@ -7,11 +7,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, snakeCaseKeys } = opts
/**
* Perform a [xpack.graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request
* Perform a [graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request
*
* @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
* @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types
@ -29,7 +29,7 @@ function buildXpackGraphExplore (opts) {
}
return function xpackGraphExplore (params, options, callback) {
return function graphExplore (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -69,9 +69,9 @@ function buildXpackGraphExplore (opts) {
var path = ''
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_xpack' + '/' + 'graph' + '/' + '_explore'
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_xpack' + '/' + 'graph' + '/' + '_explore'
path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore'
}
// build request object
@ -87,4 +87,4 @@ function buildXpackGraphExplore (opts) {
}
}
module.exports = buildXpackGraphExplore
module.exports = buildGraphExplore

View File

@ -14,11 +14,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

@ -18,7 +18,6 @@ function buildIndex (opts) {
* @param {string} type - The type of the document
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
* @param {enum} op_type - Explicit operation type
* @param {string} parent - ID of the parent document
* @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
@ -33,7 +32,6 @@ function buildIndex (opts) {
const acceptedQuerystring = [
'wait_for_active_shards',
'op_type',
'parent',
'refresh',
'routing',
'timeout',
@ -76,24 +74,11 @@ function buildIndex (opts) {
const err = new ConfigurationError('Missing required parameter: index')
return handleError(err, callback)
}
if (params['type'] == null) {
const err = new ConfigurationError('Missing required parameter: type')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// check required url components
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: type, index')
return handleError(err, callback)
} else if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -117,8 +102,12 @@ function buildIndex (opts) {
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
} else if ((index) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc'
}
// build request object

View File

@ -14,7 +14,6 @@ function buildIndicesClearCache (opts) {
* Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request
*
* @param {list} index - A comma-separated list of index name to limit the operation
* @param {boolean} field_data - Clear field data. This is deprecated. Prefer `fielddata`.
* @param {boolean} fielddata - Clear field data
* @param {list} fields - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)
* @param {boolean} query - Clear query caches
@ -22,12 +21,10 @@ function buildIndicesClearCache (opts) {
* @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 {list} index - A comma-separated list of index name to limit the operation
* @param {boolean} request_cache - Clear request cache
* @param {boolean} request - Clear request cache
*/
const acceptedQuerystring = [
'field_data',
'fielddata',
'fields',
'query',
@ -35,7 +32,6 @@ function buildIndicesClearCache (opts) {
'allow_no_indices',
'expand_wildcards',
'index',
'request_cache',
'request',
'pretty',
'human',
@ -45,11 +41,9 @@ function buildIndicesClearCache (opts) {
]
const snakeCase = {
fieldData: 'field_data',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
requestCache: 'request_cache',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -83,7 +77,7 @@ function buildIndicesClearCache (opts) {
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = body == null ? 'GET' : 'POST'
method = 'POST'
}
var ignore = options.ignore

View File

@ -19,6 +19,7 @@ function buildIndicesClose (opts) {
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns.
*/
const acceptedQuerystring = [
@ -27,6 +28,7 @@ function buildIndicesClose (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'wait_for_active_shards',
'pretty',
'human',
'error_trace',
@ -39,6 +41,7 @@ function buildIndicesClose (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
waitForActiveShards: 'wait_for_active_shards',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -18,7 +18,6 @@ function buildIndicesCreate (opts) {
* @param {string} wait_for_active_shards - Set the number of active shards to wait for before the operation returns.
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not
* @param {object} body - The configuration for the index (`settings` and `mappings`)
*/
@ -27,7 +26,6 @@ function buildIndicesCreate (opts) {
'wait_for_active_shards',
'timeout',
'master_timeout',
'update_all_types',
'pretty',
'human',
'error_trace',
@ -39,7 +37,6 @@ function buildIndicesCreate (opts) {
includeTypeName: 'include_type_name',
waitForActiveShards: 'wait_for_active_shards',
masterTimeout: 'master_timeout',
updateAllTypes: 'update_all_types',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -11,7 +11,7 @@ function buildIndicesFlushSynced (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request
* Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html#synced-flush-api) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string for all indices
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)

View File

@ -14,7 +14,7 @@ function buildIndicesGet (opts) {
* Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request
*
* @param {list} index - A comma-separated list of index names
* @param {boolean} include_type_name - Whether to add the type name to the response (default: true)
* @param {boolean} include_type_name - Whether to add the type name to the response (default: false)
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {boolean} ignore_unavailable - Ignore unavailable indexes (default: false)
* @param {boolean} allow_no_indices - Ignore if a wildcard expression resolves to no concrete indices (default: false)

View File

@ -15,7 +15,7 @@ function buildIndicesGetMapping (opts) {
*
* @param {list} index - A comma-separated list of index names
* @param {list} type - A comma-separated list of document types
* @param {boolean} include_type_name - Whether to add the type name to the response.
* @param {boolean} include_type_name - Whether to add the type name to the response (default: false)
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.

View File

@ -21,7 +21,6 @@ function buildIndicesPutMapping (opts) {
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not
* @param {object} body - The mapping definition
*/
@ -32,7 +31,6 @@ function buildIndicesPutMapping (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'update_all_types',
'pretty',
'human',
'error_trace',
@ -46,7 +44,6 @@ function buildIndicesPutMapping (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
updateAllTypes: 'update_all_types',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -98,14 +95,14 @@ function buildIndicesPutMapping (opts) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings'
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
}
// build request object

View File

@ -7,31 +7,31 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMigrationGetAssistance (opts) {
function buildIndicesReloadSearchAnalyzers (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request
* Perform a [indices.reload_search_analyzers](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} index - A comma-separated list of index names to reload analyzers for
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
*/
const acceptedQuerystring = [
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'ignore_unavailable'
'expand_wildcards'
]
const snakeCase = {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
ignoreUnavailable: 'ignore_unavailable'
expandWildcards: 'expand_wildcards'
}
return function xpackMigrationGetAssistance (params, options, callback) {
return function indicesReloadSearchAnalyzers (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -43,6 +43,12 @@ function buildXpackMigrationGetAssistance (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}`)
@ -54,7 +60,7 @@ function buildXpackMigrationGetAssistance (opts) {
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore
@ -64,17 +70,13 @@ function buildXpackMigrationGetAssistance (opts) {
var path = ''
if ((index) != null) {
path = '/' + '_xpack' + '/' + 'migration' + '/' + 'assistance' + '/' + encodeURIComponent(index)
} else {
path = '/' + '_xpack' + '/' + 'migration' + '/' + 'assistance'
}
path = '/' + encodeURIComponent(index) + '/' + '_reload_search_analyzers'
// build request object
const request = {
method,
path,
body: null,
body: '',
querystring
}
@ -83,4 +85,4 @@ function buildXpackMigrationGetAssistance (opts) {
}
}
module.exports = buildXpackMigrationGetAssistance
module.exports = buildIndicesReloadSearchAnalyzers

View File

@ -22,6 +22,9 @@ function buildIndicesStats (opts) {
* @param {enum} level - Return stats aggregated at cluster, index or shard level
* @param {list} types - A comma-separated list of document types for the `indexing` index metric
* @param {boolean} include_segment_file_sizes - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)
* @param {boolean} include_unloaded_segments - If set to true segment stats will include stats for segments that are not currently loaded into memory
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} forbid_closed_indices - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices
*/
const acceptedQuerystring = [
@ -32,6 +35,9 @@ function buildIndicesStats (opts) {
'level',
'types',
'include_segment_file_sizes',
'include_unloaded_segments',
'expand_wildcards',
'forbid_closed_indices',
'pretty',
'human',
'error_trace',
@ -43,6 +49,9 @@ function buildIndicesStats (opts) {
completionFields: 'completion_fields',
fielddataFields: 'fielddata_fields',
includeSegmentFileSizes: 'include_segment_file_sizes',
includeUnloadedSegments: 'include_unloaded_segments',
expandWildcards: 'expand_wildcards',
forbidClosedIndices: 'forbid_closed_indices',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteExpiredData (opts) {
function buildLicenseDelete (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_expired_data](undefined) request
* Perform a [license.delete](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html) request
*
*/
@ -23,7 +23,7 @@ function buildXpackMlDeleteExpiredData (opts) {
}
return function xpackMlDeleteExpiredData (params, options, callback) {
return function licenseDelete (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -62,7 +62,7 @@ function buildXpackMlDeleteExpiredData (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + '_delete_expired_data'
path = '/' + '_license'
// build request object
const request = {
@ -77,4 +77,4 @@ function buildXpackMlDeleteExpiredData (opts) {
}
}
module.exports = buildXpackMlDeleteExpiredData
module.exports = buildLicenseDelete

View File

@ -7,11 +7,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, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.get](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/get-license.html) request
* Perform a [license.get](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html) request
*
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
@ -24,7 +24,7 @@ function buildXpackLicenseGet (opts) {
}
return function xpackLicenseGet (params, options, callback) {
return function licenseGet (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -63,7 +63,7 @@ function buildXpackLicenseGet (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license'
path = '/' + '_license'
// build request object
const request = {
@ -78,4 +78,4 @@ function buildXpackLicenseGet (opts) {
}
}
module.exports = buildXpackLicenseGet
module.exports = buildLicenseGet

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseGetTrialStatus (opts) {
function buildLicenseGetBasicStatus (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.get_trial_status](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/get-basic-status.html) request
* Perform a [license.get_basic_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html) request
*
*/
@ -23,7 +23,7 @@ function buildXpackLicenseGetTrialStatus (opts) {
}
return function xpackLicenseGetTrialStatus (params, options, callback) {
return function licenseGetBasicStatus (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -62,7 +62,7 @@ function buildXpackLicenseGetTrialStatus (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license' + '/' + 'trial_status'
path = '/' + '_license' + '/' + 'basic_status'
// build request object
const request = {
@ -77,4 +77,4 @@ function buildXpackLicenseGetTrialStatus (opts) {
}
}
module.exports = buildXpackLicenseGetTrialStatus
module.exports = buildLicenseGetBasicStatus

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseGetBasicStatus (opts) {
function buildLicenseGetTrialStatus (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.get_basic_status](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/get-trial-status.html) request
* Perform a [license.get_trial_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html) request
*
*/
@ -23,7 +23,7 @@ function buildXpackLicenseGetBasicStatus (opts) {
}
return function xpackLicenseGetBasicStatus (params, options, callback) {
return function licenseGetTrialStatus (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -62,7 +62,7 @@ function buildXpackLicenseGetBasicStatus (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license' + '/' + 'basic_status'
path = '/' + '_license' + '/' + 'trial_status'
// build request object
const request = {
@ -77,4 +77,4 @@ function buildXpackLicenseGetBasicStatus (opts) {
}
}
module.exports = buildXpackLicenseGetBasicStatus
module.exports = buildLicenseGetTrialStatus

View File

@ -7,11 +7,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, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.post](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/update-license.html) request
* Perform a [license.post](https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html) request
*
* @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false)
* @param {object} body - licenses to be installed
@ -25,7 +25,7 @@ function buildXpackLicensePost (opts) {
}
return function xpackLicensePost (params, options, callback) {
return function licensePost (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -58,7 +58,7 @@ function buildXpackLicensePost (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license'
path = '/' + '_license'
// build request object
const request = {
@ -73,4 +73,4 @@ function buildXpackLicensePost (opts) {
}
}
module.exports = buildXpackLicensePost
module.exports = buildLicensePost

View File

@ -7,11 +7,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, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.post_start_basic](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/start-basic.html) request
* Perform a [license.post_start_basic](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html) request
*
* @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false)
*/
@ -24,7 +24,7 @@ function buildXpackLicensePostStartBasic (opts) {
}
return function xpackLicensePostStartBasic (params, options, callback) {
return function licensePostStartBasic (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -63,7 +63,7 @@ function buildXpackLicensePostStartBasic (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license' + '/' + 'start_basic'
path = '/' + '_license' + '/' + 'start_basic'
// build request object
const request = {
@ -78,4 +78,4 @@ function buildXpackLicensePostStartBasic (opts) {
}
}
module.exports = buildXpackLicensePostStartBasic
module.exports = buildLicensePostStartBasic

View File

@ -7,11 +7,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, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.post_start_trial](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/start-trial.html) request
* Perform a [license.post_start_trial](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html) request
*
* @param {string} type - The type of trial license to generate (default: "trial")
* @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false)
@ -26,7 +26,7 @@ function buildXpackLicensePostStartTrial (opts) {
}
return function xpackLicensePostStartTrial (params, options, callback) {
return function licensePostStartTrial (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -65,7 +65,7 @@ function buildXpackLicensePostStartTrial (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license' + '/' + 'start_trial'
path = '/' + '_license' + '/' + 'start_trial'
// build request object
const request = {
@ -80,4 +80,4 @@ function buildXpackLicensePostStartTrial (opts) {
}
}
module.exports = buildXpackLicensePostStartTrial
module.exports = buildLicensePostStartTrial

View File

@ -7,11 +7,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, snakeCaseKeys } = opts
/**
* Perform a [xpack.migration.deprecations](http://www.elastic.co/guide/en/elasticsearch/reference/6.7/migration-api-deprecation.html) request
* Perform a [migration.deprecations](http://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-deprecation.html) request
*
* @param {string} index - Index pattern
*/
@ -24,7 +24,7 @@ function buildXpackMigrationDeprecations (opts) {
}
return function xpackMigrationDeprecations (params, options, callback) {
return function migrationDeprecations (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -64,9 +64,9 @@ function buildXpackMigrationDeprecations (opts) {
var path = ''
if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_xpack' + '/' + 'migration' + '/' + 'deprecations'
path = '/' + encodeURIComponent(index) + '/' + '_migration' + '/' + 'deprecations'
} else {
path = '/' + '_xpack' + '/' + 'migration' + '/' + 'deprecations'
path = '/' + '_migration' + '/' + 'deprecations'
}
// build request object
@ -82,4 +82,4 @@ function buildXpackMigrationDeprecations (opts) {
}
}
module.exports = buildXpackMigrationDeprecations
module.exports = buildMigrationDeprecations

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlCloseJob (opts) {
function buildMlCloseJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request
* Perform a [ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request
*
* @param {string} job_id - The name of the job to close
* @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
@ -31,7 +31,7 @@ function buildXpackMlCloseJob (opts) {
}
return function xpackMlCloseJob (params, options, callback) {
return function mlCloseJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -70,7 +70,7 @@ function buildXpackMlCloseJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_close'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_close'
// build request object
const request = {
@ -85,4 +85,4 @@ function buildXpackMlCloseJob (opts) {
}
}
module.exports = buildXpackMlCloseJob
module.exports = buildMlCloseJob

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteCalendar (opts) {
function buildMlDeleteCalendar (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_calendar](undefined) request
* Perform a [ml.delete_calendar](undefined) request
*
* @param {string} calendar_id - The ID of the calendar to delete
*/
@ -24,7 +24,7 @@ function buildXpackMlDeleteCalendar (opts) {
}
return function xpackMlDeleteCalendar (params, options, callback) {
return function mlDeleteCalendar (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -67,7 +67,7 @@ function buildXpackMlDeleteCalendar (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
// build request object
const request = {
@ -82,4 +82,4 @@ function buildXpackMlDeleteCalendar (opts) {
}
}
module.exports = buildXpackMlDeleteCalendar
module.exports = buildMlDeleteCalendar

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteCalendarEvent (opts) {
function buildMlDeleteCalendarEvent (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_calendar_event](undefined) request
* Perform a [ml.delete_calendar_event](undefined) request
*
* @param {string} calendar_id - The ID of the calendar to modify
* @param {string} event_id - The ID of the event to remove from the calendar
@ -25,7 +25,7 @@ function buildXpackMlDeleteCalendarEvent (opts) {
}
return function xpackMlDeleteCalendarEvent (params, options, callback) {
return function mlDeleteCalendarEvent (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -78,7 +78,7 @@ function buildXpackMlDeleteCalendarEvent (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + '/' + encodeURIComponent(event_id || eventId)
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + '/' + encodeURIComponent(event_id || eventId)
// build request object
const request = {
@ -93,4 +93,4 @@ function buildXpackMlDeleteCalendarEvent (opts) {
}
}
module.exports = buildXpackMlDeleteCalendarEvent
module.exports = buildMlDeleteCalendarEvent

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteCalendarJob (opts) {
function buildMlDeleteCalendarJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_calendar_job](undefined) request
* Perform a [ml.delete_calendar_job](undefined) request
*
* @param {string} calendar_id - The ID of the calendar to modify
* @param {string} job_id - The ID of the job to remove from the calendar
@ -25,7 +25,7 @@ function buildXpackMlDeleteCalendarJob (opts) {
}
return function xpackMlDeleteCalendarJob (params, options, callback) {
return function mlDeleteCalendarJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -78,7 +78,7 @@ function buildXpackMlDeleteCalendarJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId)
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId)
// build request object
const request = {
@ -93,4 +93,4 @@ function buildXpackMlDeleteCalendarJob (opts) {
}
}
module.exports = buildXpackMlDeleteCalendarJob
module.exports = buildMlDeleteCalendarJob

View File

@ -0,0 +1,85 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlDeleteDataFrameAnalytics (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.delete_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html) request
*
* @param {string} id - The ID of the data frame analytics to delete
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function mlDeleteDataFrameAnalytics (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['id'] == null) {
const err = new ConfigurationError('Missing required parameter: id')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'DELETE'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
// build request object
const request = {
method,
path,
body: '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlDeleteDataFrameAnalytics

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteDatafeed (opts) {
function buildMlDeleteDatafeed (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request
* Perform a [ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request
*
* @param {string} datafeed_id - The ID of the datafeed to delete
* @param {boolean} force - True if the datafeed should be forcefully deleted
@ -25,7 +25,7 @@ function buildXpackMlDeleteDatafeed (opts) {
}
return function xpackMlDeleteDatafeed (params, options, callback) {
return function mlDeleteDatafeed (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -68,7 +68,7 @@ function buildXpackMlDeleteDatafeed (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
// build request object
const request = {
@ -83,4 +83,4 @@ function buildXpackMlDeleteDatafeed (opts) {
}
}
module.exports = buildXpackMlDeleteDatafeed
module.exports = buildMlDeleteDatafeed

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackLicenseDelete (opts) {
function buildMlDeleteExpiredData (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.license.delete](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/delete-license.html) request
* Perform a [ml.delete_expired_data](undefined) request
*
*/
@ -23,7 +23,7 @@ function buildXpackLicenseDelete (opts) {
}
return function xpackLicenseDelete (params, options, callback) {
return function mlDeleteExpiredData (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -62,7 +62,7 @@ function buildXpackLicenseDelete (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'license'
path = '/' + '_ml' + '/' + '_delete_expired_data'
// build request object
const request = {
@ -77,4 +77,4 @@ function buildXpackLicenseDelete (opts) {
}
}
module.exports = buildXpackLicenseDelete
module.exports = buildMlDeleteExpiredData

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteFilter (opts) {
function buildMlDeleteFilter (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_filter](undefined) request
* Perform a [ml.delete_filter](undefined) request
*
* @param {string} filter_id - The ID of the filter to delete
*/
@ -24,7 +24,7 @@ function buildXpackMlDeleteFilter (opts) {
}
return function xpackMlDeleteFilter (params, options, callback) {
return function mlDeleteFilter (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -67,7 +67,7 @@ function buildXpackMlDeleteFilter (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
// build request object
const request = {
@ -82,4 +82,4 @@ function buildXpackMlDeleteFilter (opts) {
}
}
module.exports = buildXpackMlDeleteFilter
module.exports = buildMlDeleteFilter

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteForecast (opts) {
function buildMlDeleteForecast (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_forecast](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html) request
* Perform a [ml.delete_forecast](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html) request
*
* @param {string} job_id - The ID of the job from which to delete forecasts
* @param {string} forecast_id - The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all`
@ -29,7 +29,7 @@ function buildXpackMlDeleteForecast (opts) {
}
return function xpackMlDeleteForecast (params, options, callback) {
return function mlDeleteForecast (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -79,9 +79,9 @@ function buildXpackMlDeleteForecast (opts) {
var path = ''
if ((job_id || jobId) != null && (forecast_id || forecastId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + '/' + encodeURIComponent(forecast_id || forecastId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + '/' + encodeURIComponent(forecast_id || forecastId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast'
}
// build request object
@ -97,4 +97,4 @@ function buildXpackMlDeleteForecast (opts) {
}
}
module.exports = buildXpackMlDeleteForecast
module.exports = buildMlDeleteForecast

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteJob (opts) {
function buildMlDeleteJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request
* Perform a [ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request
*
* @param {string} job_id - The ID of the job to delete
* @param {boolean} force - True if the job should be forcefully deleted
@ -27,7 +27,7 @@ function buildXpackMlDeleteJob (opts) {
waitForCompletion: 'wait_for_completion'
}
return function xpackMlDeleteJob (params, options, callback) {
return function mlDeleteJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -70,7 +70,7 @@ function buildXpackMlDeleteJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
// build request object
const request = {
@ -85,4 +85,4 @@ function buildXpackMlDeleteJob (opts) {
}
}
module.exports = buildXpackMlDeleteJob
module.exports = buildMlDeleteJob

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlDeleteModelSnapshot (opts) {
function buildMlDeleteModelSnapshot (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request
* Perform a [ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request
*
* @param {string} job_id - The ID of the job to fetch
* @param {string} snapshot_id - The ID of the snapshot to delete
@ -25,7 +25,7 @@ function buildXpackMlDeleteModelSnapshot (opts) {
}
return function xpackMlDeleteModelSnapshot (params, options, callback) {
return function mlDeleteModelSnapshot (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -78,7 +78,7 @@ function buildXpackMlDeleteModelSnapshot (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId)
// build request object
const request = {
@ -93,4 +93,4 @@ function buildXpackMlDeleteModelSnapshot (opts) {
}
}
module.exports = buildXpackMlDeleteModelSnapshot
module.exports = buildMlDeleteModelSnapshot

View File

@ -0,0 +1,81 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlEvaluateDataFrame (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.evaluate_data_frame](http://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html) request
*
* @param {object} body - The evaluation definition
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function mlEvaluateDataFrame (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_ml' + '/' + 'data_frame' + '/' + '_evaluate'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlEvaluateDataFrame

View File

@ -7,13 +7,14 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlFindFileStructure (opts) {
function buildMlFindFileStructure (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/6.7/ml-find-file-structure.html) request
* Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html) request
*
* @param {int} lines_to_sample - How many lines of the file should be included in the analysis
* @param {int} line_merge_size_limit - Maximum number of characters permitted in a single message when lines are merged to create messages.
* @param {time} timeout - Timeout after which the analysis will be aborted
* @param {string} charset - Optional parameter to specify the character set of the file
* @param {enum} format - Optional parameter to specify the high level file format
@ -31,6 +32,7 @@ function buildXpackMlFindFileStructure (opts) {
const acceptedQuerystring = [
'lines_to_sample',
'line_merge_size_limit',
'timeout',
'charset',
'format',
@ -47,6 +49,7 @@ function buildXpackMlFindFileStructure (opts) {
const snakeCase = {
linesToSample: 'lines_to_sample',
lineMergeSizeLimit: 'line_merge_size_limit',
hasHeaderRow: 'has_header_row',
columnNames: 'column_names',
shouldTrimFields: 'should_trim_fields',
@ -56,7 +59,7 @@ function buildXpackMlFindFileStructure (opts) {
}
return function xpackMlFindFileStructure (params, options, callback) {
return function mlFindFileStructure (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -95,7 +98,7 @@ function buildXpackMlFindFileStructure (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'find_file_structure'
path = '/' + '_ml' + '/' + 'find_file_structure'
// build request object
const request = {
@ -110,4 +113,4 @@ function buildXpackMlFindFileStructure (opts) {
}
}
module.exports = buildXpackMlFindFileStructure
module.exports = buildMlFindFileStructure

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlFlushJob (opts) {
function buildMlFlushJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request
* Perform a [ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request
*
* @param {string} job_id - The name of the job to flush
* @param {boolean} calc_interim - Calculates interim results for the most recent bucket or all buckets within the latency period
@ -36,7 +36,7 @@ function buildXpackMlFlushJob (opts) {
skipTime: 'skip_time'
}
return function xpackMlFlushJob (params, options, callback) {
return function mlFlushJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -75,7 +75,7 @@ function buildXpackMlFlushJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_flush'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_flush'
// build request object
const request = {
@ -90,4 +90,4 @@ function buildXpackMlFlushJob (opts) {
}
}
module.exports = buildXpackMlFlushJob
module.exports = buildMlFlushJob

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlForecast (opts) {
function buildMlForecast (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.forecast](undefined) request
* Perform a [ml.forecast](undefined) request
*
* @param {string} job_id - The ID of the job to forecast for
* @param {time} duration - The duration of the forecast
@ -27,7 +27,7 @@ function buildXpackMlForecast (opts) {
expiresIn: 'expires_in'
}
return function xpackMlForecast (params, options, callback) {
return function mlForecast (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -70,7 +70,7 @@ function buildXpackMlForecast (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast'
// build request object
const request = {
@ -85,4 +85,4 @@ function buildXpackMlForecast (opts) {
}
}
module.exports = buildXpackMlForecast
module.exports = buildMlForecast

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetBuckets (opts) {
function buildMlGetBuckets (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request
* Perform a [ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request
*
* @param {string} job_id - ID of the job to get bucket results from
* @param {string} timestamp - The timestamp of the desired single bucket result
@ -45,7 +45,7 @@ function buildXpackMlGetBuckets (opts) {
}
return function xpackMlGetBuckets (params, options, callback) {
return function mlGetBuckets (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -91,9 +91,9 @@ function buildXpackMlGetBuckets (opts) {
var path = ''
if ((job_id || jobId) != null && (timestamp) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + '/' + encodeURIComponent(timestamp)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + '/' + encodeURIComponent(timestamp)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets'
}
// build request object
@ -109,4 +109,4 @@ function buildXpackMlGetBuckets (opts) {
}
}
module.exports = buildXpackMlGetBuckets
module.exports = buildMlGetBuckets

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetCalendarEvents (opts) {
function buildMlGetCalendarEvents (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_calendar_events](undefined) request
* Perform a [ml.get_calendar_events](undefined) request
*
* @param {string} calendar_id - The ID of the calendar containing the events
* @param {string} job_id - Get events for the job. When this option is used calendar_id must be '_all'
@ -34,7 +34,7 @@ function buildXpackMlGetCalendarEvents (opts) {
}
return function xpackMlGetCalendarEvents (params, options, callback) {
return function mlGetCalendarEvents (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -77,7 +77,7 @@ function buildXpackMlGetCalendarEvents (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events'
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events'
// build request object
const request = {
@ -92,4 +92,4 @@ function buildXpackMlGetCalendarEvents (opts) {
}
}
module.exports = buildXpackMlGetCalendarEvents
module.exports = buildMlGetCalendarEvents

View File

@ -7,15 +7,16 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetCalendars (opts) {
function buildMlGetCalendars (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_calendars](undefined) request
* Perform a [ml.get_calendars](undefined) request
*
* @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 = [
@ -27,7 +28,7 @@ function buildXpackMlGetCalendars (opts) {
}
return function xpackMlGetCalendars (params, options, callback) {
return function mlGetCalendars (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -39,12 +40,6 @@ function buildXpackMlGetCalendars (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}`)
@ -67,16 +62,16 @@ function buildXpackMlGetCalendars (opts) {
var path = ''
if ((calendar_id || calendarId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars'
path = '/' + '_ml' + '/' + 'calendars'
}
// build request object
const request = {
method,
path,
body: '',
body: body || '',
querystring
}
@ -85,4 +80,4 @@ function buildXpackMlGetCalendars (opts) {
}
}
module.exports = buildXpackMlGetCalendars
module.exports = buildMlGetCalendars

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetCategories (opts) {
function buildMlGetCategories (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request
* Perform a [ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request
*
* @param {string} job_id - The name of the job
* @param {long} category_id - The identifier of the category definition of interest
@ -29,7 +29,7 @@ function buildXpackMlGetCategories (opts) {
}
return function xpackMlGetCategories (params, options, callback) {
return function mlGetCategories (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -69,9 +69,9 @@ function buildXpackMlGetCategories (opts) {
var path = ''
if ((job_id || jobId) != null && (category_id || categoryId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + '/' + encodeURIComponent(category_id || categoryId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + '/' + encodeURIComponent(category_id || categoryId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories'
}
// build request object
@ -87,4 +87,4 @@ function buildXpackMlGetCategories (opts) {
}
}
module.exports = buildXpackMlGetCategories
module.exports = buildMlGetCategories

View File

@ -0,0 +1,91 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlGetDataFrameAnalytics (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.get_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html) request
*
* @param {string} id - The ID of the data frame analytics to fetch
* @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified)
* @param {int} from - skips a number of analytics
* @param {int} size - specifies a max number of analytics to get
*/
const acceptedQuerystring = [
'allow_no_match',
'from',
'size'
]
const snakeCase = {
allowNoMatch: 'allow_no_match'
}
return function mlGetDataFrameAnalytics (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((id) != null) {
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
} else {
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlGetDataFrameAnalytics

View File

@ -0,0 +1,91 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlGetDataFrameAnalyticsStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.get_data_frame_analytics_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html) request
*
* @param {string} id - The ID of the data frame analytics stats to fetch
* @param {boolean} allow_no_match - Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified)
* @param {int} from - skips a number of analytics
* @param {int} size - specifies a max number of analytics to get
*/
const acceptedQuerystring = [
'allow_no_match',
'from',
'size'
]
const snakeCase = {
allowNoMatch: 'allow_no_match'
}
return function mlGetDataFrameAnalyticsStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((id) != null) {
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stats'
} else {
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_stats'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlGetDataFrameAnalyticsStats

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetDatafeedStats (opts) {
function buildMlGetDatafeedStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request
* Perform a [ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request
*
* @param {string} datafeed_id - The ID of the datafeeds stats to fetch
* @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
@ -25,7 +25,7 @@ function buildXpackMlGetDatafeedStats (opts) {
allowNoDatafeeds: 'allow_no_datafeeds'
}
return function xpackMlGetDatafeedStats (params, options, callback) {
return function mlGetDatafeedStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -65,9 +65,9 @@ function buildXpackMlGetDatafeedStats (opts) {
var path = ''
if ((datafeed_id || datafeedId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stats'
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stats'
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + '_stats'
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + '_stats'
}
// build request object
@ -83,4 +83,4 @@ function buildXpackMlGetDatafeedStats (opts) {
}
}
module.exports = buildXpackMlGetDatafeedStats
module.exports = buildMlGetDatafeedStats

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetDatafeeds (opts) {
function buildMlGetDatafeeds (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request
* Perform a [ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request
*
* @param {string} datafeed_id - The ID of the datafeeds to fetch
* @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
@ -25,7 +25,7 @@ function buildXpackMlGetDatafeeds (opts) {
allowNoDatafeeds: 'allow_no_datafeeds'
}
return function xpackMlGetDatafeeds (params, options, callback) {
return function mlGetDatafeeds (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -65,9 +65,9 @@ function buildXpackMlGetDatafeeds (opts) {
var path = ''
if ((datafeed_id || datafeedId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds'
path = '/' + '_ml' + '/' + 'datafeeds'
}
// build request object
@ -83,4 +83,4 @@ function buildXpackMlGetDatafeeds (opts) {
}
}
module.exports = buildXpackMlGetDatafeeds
module.exports = buildMlGetDatafeeds

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetFilters (opts) {
function buildMlGetFilters (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_filters](undefined) request
* Perform a [ml.get_filters](undefined) request
*
* @param {string} filter_id - The ID of the filter to fetch
* @param {int} from - skips a number of filters
@ -27,7 +27,7 @@ function buildXpackMlGetFilters (opts) {
}
return function xpackMlGetFilters (params, options, callback) {
return function mlGetFilters (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -67,9 +67,9 @@ function buildXpackMlGetFilters (opts) {
var path = ''
if ((filter_id || filterId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters'
path = '/' + '_ml' + '/' + 'filters'
}
// build request object
@ -85,4 +85,4 @@ function buildXpackMlGetFilters (opts) {
}
}
module.exports = buildXpackMlGetFilters
module.exports = buildMlGetFilters

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetInfluencers (opts) {
function buildMlGetInfluencers (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request
* Perform a [ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request
*
* @param {string} job_id -
* @param {boolean} exclude_interim - Exclude interim results
@ -42,7 +42,7 @@ function buildXpackMlGetInfluencers (opts) {
}
return function xpackMlGetInfluencers (params, options, callback) {
return function mlGetInfluencers (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -81,7 +81,7 @@ function buildXpackMlGetInfluencers (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'influencers'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'influencers'
// build request object
const request = {
@ -96,4 +96,4 @@ function buildXpackMlGetInfluencers (opts) {
}
}
module.exports = buildXpackMlGetInfluencers
module.exports = buildMlGetInfluencers

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetJobStats (opts) {
function buildMlGetJobStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request
* Perform a [ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request
*
* @param {string} job_id - The ID of the jobs stats to fetch
* @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
@ -25,7 +25,7 @@ function buildXpackMlGetJobStats (opts) {
allowNoJobs: 'allow_no_jobs'
}
return function xpackMlGetJobStats (params, options, callback) {
return function mlGetJobStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -65,9 +65,9 @@ function buildXpackMlGetJobStats (opts) {
var path = ''
if ((job_id || jobId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_stats'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_stats'
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + '_stats'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_stats'
}
// build request object
@ -83,4 +83,4 @@ function buildXpackMlGetJobStats (opts) {
}
}
module.exports = buildXpackMlGetJobStats
module.exports = buildMlGetJobStats

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetJobs (opts) {
function buildMlGetJobs (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request
* Perform a [ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request
*
* @param {string} job_id - The ID of the jobs to fetch
* @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
@ -25,7 +25,7 @@ function buildXpackMlGetJobs (opts) {
allowNoJobs: 'allow_no_jobs'
}
return function xpackMlGetJobs (params, options, callback) {
return function mlGetJobs (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -65,9 +65,9 @@ function buildXpackMlGetJobs (opts) {
var path = ''
if ((job_id || jobId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors'
path = '/' + '_ml' + '/' + 'anomaly_detectors'
}
// build request object
@ -83,4 +83,4 @@ function buildXpackMlGetJobs (opts) {
}
}
module.exports = buildXpackMlGetJobs
module.exports = buildMlGetJobs

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetModelSnapshots (opts) {
function buildMlGetModelSnapshots (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request
* Perform a [ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request
*
* @param {string} job_id - The ID of the job to fetch
* @param {string} snapshot_id - The ID of the snapshot to fetch
@ -37,7 +37,7 @@ function buildXpackMlGetModelSnapshots (opts) {
}
return function xpackMlGetModelSnapshots (params, options, callback) {
return function mlGetModelSnapshots (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -83,9 +83,9 @@ function buildXpackMlGetModelSnapshots (opts) {
var path = ''
if ((job_id || jobId) != null && (snapshot_id || snapshotId) != null) {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId)
} else {
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots'
}
// build request object
@ -101,4 +101,4 @@ function buildXpackMlGetModelSnapshots (opts) {
}
}
module.exports = buildXpackMlGetModelSnapshots
module.exports = buildMlGetModelSnapshots

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetOverallBuckets (opts) {
function buildMlGetOverallBuckets (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request
* Perform a [ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request
*
* @param {string} job_id - The job IDs for which to calculate overall bucket results
* @param {int} top_n - The number of top job bucket scores to be used in the overall_score calculation
@ -42,7 +42,7 @@ function buildXpackMlGetOverallBuckets (opts) {
allowNoJobs: 'allow_no_jobs'
}
return function xpackMlGetOverallBuckets (params, options, callback) {
return function mlGetOverallBuckets (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -81,7 +81,7 @@ function buildXpackMlGetOverallBuckets (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets'
// build request object
const request = {
@ -96,4 +96,4 @@ function buildXpackMlGetOverallBuckets (opts) {
}
}
module.exports = buildXpackMlGetOverallBuckets
module.exports = buildMlGetOverallBuckets

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlGetRecords (opts) {
function buildMlGetRecords (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request
* Perform a [ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request
*
* @param {string} job_id -
* @param {boolean} exclude_interim - Exclude interim results
@ -42,7 +42,7 @@ function buildXpackMlGetRecords (opts) {
}
return function xpackMlGetRecords (params, options, callback) {
return function mlGetRecords (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -81,7 +81,7 @@ function buildXpackMlGetRecords (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'records'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'records'
// build request object
const request = {
@ -96,4 +96,4 @@ function buildXpackMlGetRecords (opts) {
}
}
module.exports = buildXpackMlGetRecords
module.exports = buildMlGetRecords

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlInfo (opts) {
function buildMlInfo (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.info](undefined) request
* Perform a [ml.info](undefined) request
*
*/
@ -23,7 +23,7 @@ function buildXpackMlInfo (opts) {
}
return function xpackMlInfo (params, options, callback) {
return function mlInfo (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -56,7 +56,7 @@ function buildXpackMlInfo (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'info'
path = '/' + '_ml' + '/' + 'info'
// build request object
const request = {
@ -71,4 +71,4 @@ function buildXpackMlInfo (opts) {
}
}
module.exports = buildXpackMlInfo
module.exports = buildMlInfo

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlOpenJob (opts) {
function buildMlOpenJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request
* Perform a [ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request
*
* @param {string} job_id - The ID of the job to open
* @param {boolean} ignore_downtime - Controls if gaps in data are treated as anomalous or as a maintenance window after a job re-start
@ -26,7 +26,7 @@ function buildXpackMlOpenJob (opts) {
}
return function xpackMlOpenJob (params, options, callback) {
return function mlOpenJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -69,7 +69,7 @@ function buildXpackMlOpenJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_open'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_open'
// build request object
const request = {
@ -84,4 +84,4 @@ function buildXpackMlOpenJob (opts) {
}
}
module.exports = buildXpackMlOpenJob
module.exports = buildMlOpenJob

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPostCalendarEvents (opts) {
function buildMlPostCalendarEvents (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.post_calendar_events](undefined) request
* Perform a [ml.post_calendar_events](undefined) request
*
* @param {string} calendar_id - The ID of the calendar to modify
* @param {object} body - A list of events
@ -25,7 +25,7 @@ function buildXpackMlPostCalendarEvents (opts) {
}
return function xpackMlPostCalendarEvents (params, options, callback) {
return function mlPostCalendarEvents (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -68,7 +68,7 @@ function buildXpackMlPostCalendarEvents (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events'
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events'
// build request object
const request = {
@ -83,4 +83,4 @@ function buildXpackMlPostCalendarEvents (opts) {
}
}
module.exports = buildXpackMlPostCalendarEvents
module.exports = buildMlPostCalendarEvents

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPostData (opts) {
function buildMlPostData (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request
* Perform a [ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request
*
* @param {string} job_id - The name of the job receiving the data
* @param {string} reset_start - Optional parameter to specify the start of the bucket resetting range
@ -29,7 +29,7 @@ function buildXpackMlPostData (opts) {
resetEnd: 'reset_end'
}
return function xpackMlPostData (params, options, callback) {
return function mlPostData (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -72,7 +72,7 @@ function buildXpackMlPostData (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_data'
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_data'
// build request object
const request = {
@ -87,4 +87,4 @@ function buildXpackMlPostData (opts) {
}
}
module.exports = buildXpackMlPostData
module.exports = buildMlPostData

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPreviewDatafeed (opts) {
function buildMlPreviewDatafeed (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request
* Perform a [ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request
*
* @param {string} datafeed_id - The ID of the datafeed to preview
*/
@ -24,7 +24,7 @@ function buildXpackMlPreviewDatafeed (opts) {
}
return function xpackMlPreviewDatafeed (params, options, callback) {
return function mlPreviewDatafeed (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -67,7 +67,7 @@ function buildXpackMlPreviewDatafeed (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview'
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview'
// build request object
const request = {
@ -82,4 +82,4 @@ function buildXpackMlPreviewDatafeed (opts) {
}
}
module.exports = buildXpackMlPreviewDatafeed
module.exports = buildMlPreviewDatafeed

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPutCalendar (opts) {
function buildMlPutCalendar (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.put_calendar](undefined) request
* Perform a [ml.put_calendar](undefined) request
*
* @param {string} calendar_id - The ID of the calendar to create
* @param {object} body - The calendar details
@ -25,7 +25,7 @@ function buildXpackMlPutCalendar (opts) {
}
return function xpackMlPutCalendar (params, options, callback) {
return function mlPutCalendar (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -64,7 +64,7 @@ function buildXpackMlPutCalendar (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
// build request object
const request = {
@ -79,4 +79,4 @@ function buildXpackMlPutCalendar (opts) {
}
}
module.exports = buildXpackMlPutCalendar
module.exports = buildMlPutCalendar

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPutCalendarJob (opts) {
function buildMlPutCalendarJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.put_calendar_job](undefined) request
* Perform a [ml.put_calendar_job](undefined) request
*
* @param {string} calendar_id - The ID of the calendar to modify
* @param {string} job_id - The ID of the job to add to the calendar
@ -25,7 +25,7 @@ function buildXpackMlPutCalendarJob (opts) {
}
return function xpackMlPutCalendarJob (params, options, callback) {
return function mlPutCalendarJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -78,7 +78,7 @@ function buildXpackMlPutCalendarJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId)
path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId)
// build request object
const request = {
@ -93,4 +93,4 @@ function buildXpackMlPutCalendarJob (opts) {
}
}
module.exports = buildXpackMlPutCalendarJob
module.exports = buildMlPutCalendarJob

View File

@ -0,0 +1,86 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlPutDataFrameAnalytics (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.put_data_frame_analytics](http://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html) request
*
* @param {string} id - The ID of the data frame analytics to create
* @param {object} body - The data frame analytics configuration
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function mlPutDataFrameAnalytics (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['id'] == null) {
const err = new ConfigurationError('Missing required parameter: id')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'PUT'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlPutDataFrameAnalytics

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPutDatafeed (opts) {
function buildMlPutDatafeed (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request
* Perform a [ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request
*
* @param {string} datafeed_id - The ID of the datafeed to create
* @param {object} body - The datafeed config
@ -25,7 +25,7 @@ function buildXpackMlPutDatafeed (opts) {
}
return function xpackMlPutDatafeed (params, options, callback) {
return function mlPutDatafeed (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -68,7 +68,7 @@ function buildXpackMlPutDatafeed (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
// build request object
const request = {
@ -83,4 +83,4 @@ function buildXpackMlPutDatafeed (opts) {
}
}
module.exports = buildXpackMlPutDatafeed
module.exports = buildMlPutDatafeed

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPutFilter (opts) {
function buildMlPutFilter (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.put_filter](undefined) request
* Perform a [ml.put_filter](undefined) request
*
* @param {string} filter_id - The ID of the filter to create
* @param {object} body - The filter details
@ -25,7 +25,7 @@ function buildXpackMlPutFilter (opts) {
}
return function xpackMlPutFilter (params, options, callback) {
return function mlPutFilter (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -68,7 +68,7 @@ function buildXpackMlPutFilter (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
// build request object
const request = {
@ -83,4 +83,4 @@ function buildXpackMlPutFilter (opts) {
}
}
module.exports = buildXpackMlPutFilter
module.exports = buildMlPutFilter

View File

@ -7,11 +7,11 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMlPutJob (opts) {
function buildMlPutJob (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [xpack.ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request
* Perform a [ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request
*
* @param {string} job_id - The ID of the job to create
* @param {object} body - The job
@ -25,7 +25,7 @@ function buildXpackMlPutJob (opts) {
}
return function xpackMlPutJob (params, options, callback) {
return function mlPutJob (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -68,7 +68,7 @@ function buildXpackMlPutJob (opts) {
var path = ''
path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
// build request object
const request = {
@ -83,4 +83,4 @@ function buildXpackMlPutJob (opts) {
}
}
module.exports = buildXpackMlPutJob
module.exports = buildMlPutJob

Some files were not shown because too many files have changed in this diff Show More