@elastic/elasticsearch 7.9.1 → 7.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -3
- package/api/api/async_search.js +27 -0
- package/api/api/autoscaling.js +3 -3
- package/api/api/bulk.js +2 -2
- package/api/api/cat.js +2 -2
- package/api/api/close_point_in_time.js +50 -0
- package/api/api/index.js +2 -2
- package/api/api/indices.js +62 -21
- package/api/api/ml.js +46 -8
- package/api/api/open_point_in_time.js +55 -0
- package/api/api/rollup.js +41 -0
- package/api/api/security.js +56 -0
- package/api/api/snapshot.js +48 -0
- package/api/api/transform.js +2 -2
- package/api/api/update.js +2 -2
- package/api/api/watcher.js +23 -1
- package/api/index.js +24 -3
- package/api/kibana.d.ts +31 -5
- package/api/requestParams.d.ts +105 -10
- package/index.d.ts +119 -20
- package/index.js +56 -6
- package/index.mjs +19 -0
- package/lib/Connection.d.ts +24 -6
- package/lib/Connection.js +70 -55
- package/lib/Helpers.d.ts +18 -3
- package/lib/Helpers.js +34 -6
- package/lib/Serializer.d.ts +18 -3
- package/lib/Serializer.js +18 -3
- package/lib/Transport.d.ts +18 -3
- package/lib/Transport.js +171 -92
- package/lib/errors.d.ts +18 -3
- package/lib/errors.js +18 -3
- package/lib/pool/BaseConnectionPool.js +21 -3
- package/lib/pool/CloudConnectionPool.js +18 -3
- package/lib/pool/ConnectionPool.js +18 -3
- package/lib/pool/index.d.ts +20 -3
- package/lib/pool/index.js +18 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -26,9 +26,33 @@ The official Node.js client for Elasticsearch.
|
|
|
26
26
|
npm install @elastic/elasticsearch
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### Node.js support
|
|
30
|
+
|
|
31
|
+
NOTE: The minimum supported version of Node.js is `v8`.
|
|
32
|
+
|
|
33
|
+
The client versioning follows the Elastc Stack versioning, this means that
|
|
34
|
+
major, minor, and patch releases are done following a precise schedule that
|
|
35
|
+
often does not coincide with the [Node.js release](https://nodejs.org/en/about/releases/) times.
|
|
36
|
+
|
|
37
|
+
To avoid support insecure and unsupported versions of Node.js, the
|
|
38
|
+
client **will drop the support of EOL versions of Node.js between minor releases**.
|
|
39
|
+
Typically, as soon as a Node.js version goes into EOL, the client will continue
|
|
40
|
+
to support that version for at least another minor release. If you are using the client
|
|
41
|
+
with a version of Node.js that will be unsupported soon, you will see a warning
|
|
42
|
+
in your logs (the client will start logging the warning with two minors in advance).
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
Unless you are **always** using a supported version of Node.js,
|
|
45
|
+
we recommend defining the client dependency in your
|
|
46
|
+
`package.json` with the `~` instead of `^`. In this way, you will lock the
|
|
47
|
+
dependency on the minor release and not the major. (for example, `~7.10.0` instead
|
|
48
|
+
of `^7.10.0`).
|
|
49
|
+
|
|
50
|
+
| Node.js Version | Node.js EOL date | End of support |
|
|
51
|
+
| --------------- |------------------| ---------------------- |
|
|
52
|
+
| `8.x` | `December 2019` | `7.11` (early 2021) |
|
|
53
|
+
| `10.x` | `Apri 2021` | `7.12` (mid 2021) |
|
|
54
|
+
|
|
55
|
+
### Compatibility
|
|
32
56
|
|
|
33
57
|
The library is compatible with all Elasticsearch versions since 5.x, and you should use the same major version of the Elasticsearch instance that you are using.
|
|
34
58
|
|
|
@@ -47,7 +71,7 @@ npm install @elastic/elasticsearch@<major>
|
|
|
47
71
|
#### Browser
|
|
48
72
|
|
|
49
73
|
WARNING: There is no official support for the browser environment. It exposes your Elasticsearch instance to everyone, which could lead to security issues.
|
|
50
|
-
We recommend that you write a lightweight proxy that uses this client instead.
|
|
74
|
+
We recommend that you write a lightweight proxy that uses this client instead, you can see a proxy example [here](./docs/examples/proxy).
|
|
51
75
|
|
|
52
76
|
## Documentation
|
|
53
77
|
|
package/api/api/async_search.js
CHANGED
|
@@ -85,6 +85,33 @@ AsyncSearchApi.prototype.get = function asyncSearchGetApi (params, options, call
|
|
|
85
85
|
return this.transport.request(request, options, callback)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
AsyncSearchApi.prototype.status = function asyncSearchStatusApi (params, options, callback) {
|
|
89
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
90
|
+
|
|
91
|
+
// check required parameters
|
|
92
|
+
if (params['id'] == null) {
|
|
93
|
+
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
94
|
+
return handleError(err, callback)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var { method, body, id, ...querystring } = params
|
|
98
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
99
|
+
|
|
100
|
+
var path = ''
|
|
101
|
+
if (method == null) method = 'GET'
|
|
102
|
+
path = '/' + '_async_search' + '/' + 'status' + '/' + encodeURIComponent(id)
|
|
103
|
+
|
|
104
|
+
// build request object
|
|
105
|
+
const request = {
|
|
106
|
+
method,
|
|
107
|
+
path,
|
|
108
|
+
body: null,
|
|
109
|
+
querystring
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return this.transport.request(request, options, callback)
|
|
113
|
+
}
|
|
114
|
+
|
|
88
115
|
AsyncSearchApi.prototype.submit = function asyncSearchSubmitApi (params, options, callback) {
|
|
89
116
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
90
117
|
|
package/api/api/autoscaling.js
CHANGED
|
@@ -58,7 +58,7 @@ AutoscalingApi.prototype.deleteAutoscalingPolicy = function autoscalingDeleteAut
|
|
|
58
58
|
return this.transport.request(request, options, callback)
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
AutoscalingApi.prototype.
|
|
61
|
+
AutoscalingApi.prototype.getAutoscalingCapacity = function autoscalingGetAutoscalingCapacityApi (params, options, callback) {
|
|
62
62
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
63
63
|
|
|
64
64
|
var { method, body, ...querystring } = params
|
|
@@ -66,7 +66,7 @@ AutoscalingApi.prototype.getAutoscalingDecision = function autoscalingGetAutosca
|
|
|
66
66
|
|
|
67
67
|
var path = ''
|
|
68
68
|
if (method == null) method = 'GET'
|
|
69
|
-
path = '/' + '_autoscaling' + '/' + '
|
|
69
|
+
path = '/' + '_autoscaling' + '/' + 'capacity'
|
|
70
70
|
|
|
71
71
|
// build request object
|
|
72
72
|
const request = {
|
|
@@ -139,7 +139,7 @@ AutoscalingApi.prototype.putAutoscalingPolicy = function autoscalingPutAutoscali
|
|
|
139
139
|
|
|
140
140
|
Object.defineProperties(AutoscalingApi.prototype, {
|
|
141
141
|
delete_autoscaling_policy: { get () { return this.deleteAutoscalingPolicy } },
|
|
142
|
-
|
|
142
|
+
get_autoscaling_capacity: { get () { return this.getAutoscalingCapacity } },
|
|
143
143
|
get_autoscaling_policy: { get () { return this.getAutoscalingPolicy } },
|
|
144
144
|
put_autoscaling_policy: { get () { return this.putAutoscalingPolicy } }
|
|
145
145
|
})
|
package/api/api/bulk.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
/* eslint no-unused-vars: 0 */
|
|
24
24
|
|
|
25
25
|
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
-
const acceptedQuerystring = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
-
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
26
|
+
const acceptedQuerystring = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
28
|
|
|
29
29
|
function bulkApi (params, options, callback) {
|
|
30
30
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
package/api/api/cat.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
/* eslint no-unused-vars: 0 */
|
|
24
24
|
|
|
25
25
|
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
-
const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'full_id', 'active_only', 'detailed', 'index', 'ignore_unavailable', '
|
|
27
|
-
const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', fullId: 'full_id', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable',
|
|
26
|
+
const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'full_id', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id', 'size', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from']
|
|
27
|
+
const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', fullId: 'full_id', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs' }
|
|
28
28
|
|
|
29
29
|
function CatApi (transport, ConfigurationError) {
|
|
30
30
|
this.transport = transport
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function closePointInTimeApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
var { method, body, ...querystring } = params
|
|
33
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
34
|
+
|
|
35
|
+
var path = ''
|
|
36
|
+
if (method == null) method = 'DELETE'
|
|
37
|
+
path = '/' + '_pit'
|
|
38
|
+
|
|
39
|
+
// build request object
|
|
40
|
+
const request = {
|
|
41
|
+
method,
|
|
42
|
+
path,
|
|
43
|
+
body: body || '',
|
|
44
|
+
querystring
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return this.transport.request(request, options, callback)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = closePointInTimeApi
|
package/api/api/index.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
/* eslint no-unused-vars: 0 */
|
|
24
24
|
|
|
25
25
|
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
-
const acceptedQuerystring = ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
-
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', opType: 'op_type', versionType: 'version_type', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
26
|
+
const acceptedQuerystring = ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', opType: 'op_type', versionType: 'version_type', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
28
|
|
|
29
29
|
function indexApi (params, options, callback) {
|
|
30
30
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
package/api/api/indices.js
CHANGED
|
@@ -517,13 +517,8 @@ IndicesApi.prototype.flushSynced = function indicesFlushSyncedApi (params, optio
|
|
|
517
517
|
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
518
518
|
|
|
519
519
|
var path = ''
|
|
520
|
-
if (
|
|
521
|
-
|
|
522
|
-
path = '/' + encodeURIComponent(index) + '/' + '_flush' + '/' + 'synced'
|
|
523
|
-
} else {
|
|
524
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
525
|
-
path = '/' + '_flush' + '/' + 'synced'
|
|
526
|
-
}
|
|
520
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
521
|
+
path = '/' + encodeURIComponent(index) + '/' + '_flush' + '/' + 'synced'
|
|
527
522
|
|
|
528
523
|
// build request object
|
|
529
524
|
const request = {
|
|
@@ -782,13 +777,8 @@ IndicesApi.prototype.getUpgrade = function indicesGetUpgradeApi (params, options
|
|
|
782
777
|
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
783
778
|
|
|
784
779
|
var path = ''
|
|
785
|
-
if (
|
|
786
|
-
|
|
787
|
-
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
|
788
|
-
} else {
|
|
789
|
-
if (method == null) method = 'GET'
|
|
790
|
-
path = '/' + '_upgrade'
|
|
791
|
-
}
|
|
780
|
+
if (method == null) method = 'GET'
|
|
781
|
+
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
|
792
782
|
|
|
793
783
|
// build request object
|
|
794
784
|
const request = {
|
|
@@ -1376,13 +1366,8 @@ IndicesApi.prototype.upgrade = function indicesUpgradeApi (params, options, call
|
|
|
1376
1366
|
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
1377
1367
|
|
|
1378
1368
|
var path = ''
|
|
1379
|
-
if (
|
|
1380
|
-
|
|
1381
|
-
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
|
1382
|
-
} else {
|
|
1383
|
-
if (method == null) method = 'POST'
|
|
1384
|
-
path = '/' + '_upgrade'
|
|
1385
|
-
}
|
|
1369
|
+
if (method == null) method = 'POST'
|
|
1370
|
+
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
|
1386
1371
|
|
|
1387
1372
|
// build request object
|
|
1388
1373
|
const request = {
|
|
@@ -1563,6 +1548,60 @@ IndicesApi.prototype.getDataStream = function indicesGetDataStreamApi (params, o
|
|
|
1563
1548
|
return this.transport.request(request, options, callback)
|
|
1564
1549
|
}
|
|
1565
1550
|
|
|
1551
|
+
IndicesApi.prototype.migrateToDataStream = function indicesMigrateToDataStreamApi (params, options, callback) {
|
|
1552
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
1553
|
+
|
|
1554
|
+
// check required parameters
|
|
1555
|
+
if (params['name'] == null) {
|
|
1556
|
+
const err = new this[kConfigurationError]('Missing required parameter: name')
|
|
1557
|
+
return handleError(err, callback)
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
var { method, body, name, ...querystring } = params
|
|
1561
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
1562
|
+
|
|
1563
|
+
var path = ''
|
|
1564
|
+
if (method == null) method = 'POST'
|
|
1565
|
+
path = '/' + '_data_stream' + '/' + '_migrate' + '/' + encodeURIComponent(name)
|
|
1566
|
+
|
|
1567
|
+
// build request object
|
|
1568
|
+
const request = {
|
|
1569
|
+
method,
|
|
1570
|
+
path,
|
|
1571
|
+
body: body || '',
|
|
1572
|
+
querystring
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
return this.transport.request(request, options, callback)
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
IndicesApi.prototype.promoteDataStream = function indicesPromoteDataStreamApi (params, options, callback) {
|
|
1579
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
1580
|
+
|
|
1581
|
+
// check required parameters
|
|
1582
|
+
if (params['name'] == null) {
|
|
1583
|
+
const err = new this[kConfigurationError]('Missing required parameter: name')
|
|
1584
|
+
return handleError(err, callback)
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
var { method, body, name, ...querystring } = params
|
|
1588
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
1589
|
+
|
|
1590
|
+
var path = ''
|
|
1591
|
+
if (method == null) method = 'POST'
|
|
1592
|
+
path = '/' + '_data_stream' + '/' + '_promote' + '/' + encodeURIComponent(name)
|
|
1593
|
+
|
|
1594
|
+
// build request object
|
|
1595
|
+
const request = {
|
|
1596
|
+
method,
|
|
1597
|
+
path,
|
|
1598
|
+
body: body || '',
|
|
1599
|
+
querystring
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
return this.transport.request(request, options, callback)
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1566
1605
|
IndicesApi.prototype.reloadSearchAnalyzers = function indicesReloadSearchAnalyzersApi (params, options, callback) {
|
|
1567
1606
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
1568
1607
|
|
|
@@ -1650,6 +1689,8 @@ Object.defineProperties(IndicesApi.prototype, {
|
|
|
1650
1689
|
data_streams_stats: { get () { return this.dataStreamsStats } },
|
|
1651
1690
|
delete_data_stream: { get () { return this.deleteDataStream } },
|
|
1652
1691
|
get_data_stream: { get () { return this.getDataStream } },
|
|
1692
|
+
migrate_to_data_stream: { get () { return this.migrateToDataStream } },
|
|
1693
|
+
promote_data_stream: { get () { return this.promoteDataStream } },
|
|
1653
1694
|
reload_search_analyzers: { get () { return this.reloadSearchAnalyzers } }
|
|
1654
1695
|
})
|
|
1655
1696
|
|
package/api/api/ml.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
/* eslint no-unused-vars: 0 */
|
|
24
24
|
|
|
25
25
|
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
-
const acceptedQuerystring = ['allow_no_jobs', 'force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'requests_per_second', 'allow_no_forecasts', 'wait_for_completion', 'lines_to_sample', 'line_merge_size_limit', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'timestamp_field', 'timestamp_format', 'explain', 'calc_interim', 'start', 'end', 'advance_time', 'skip_time', 'duration', 'expires_in', 'max_model_memory', 'expand', 'exclude_interim', 'from', 'size', 'anomaly_score', 'sort', 'desc', 'job_id', 'partition_field_value', '
|
|
27
|
-
const snakeCase = { allowNoJobs: 'allow_no_jobs', errorTrace: 'error_trace', filterPath: 'filter_path', requestsPerSecond: 'requests_per_second', allowNoForecasts: 'allow_no_forecasts', waitForCompletion: 'wait_for_completion', linesToSample: 'lines_to_sample', lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', grokPattern: 'grok_pattern', timestampField: 'timestamp_field', timestampFormat: 'timestamp_format', calcInterim: 'calc_interim', advanceTime: 'advance_time', skipTime: 'skip_time', expiresIn: 'expires_in', maxModelMemory: 'max_model_memory', excludeInterim: 'exclude_interim', anomalyScore: 'anomaly_score', jobId: 'job_id', partitionFieldValue: 'partition_field_value',
|
|
26
|
+
const acceptedQuerystring = ['allow_no_match', 'allow_no_jobs', 'force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'requests_per_second', 'allow_no_forecasts', 'wait_for_completion', 'lines_to_sample', 'line_merge_size_limit', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'timestamp_field', 'timestamp_format', 'explain', 'calc_interim', 'start', 'end', 'advance_time', 'skip_time', 'duration', 'expires_in', 'max_model_memory', 'expand', 'exclude_interim', 'from', 'size', 'anomaly_score', 'sort', 'desc', 'job_id', 'partition_field_value', 'exclude_generated', 'verbose', 'allow_no_datafeeds', 'influencer_score', 'top_n', 'bucket_span', 'overall_score', 'record_score', 'include', 'include_model_definition', 'decompress_definition', 'tags', 'reset_start', 'reset_end', 'ignore_unavailable', 'allow_no_indices', 'ignore_throttled', 'expand_wildcards', 'delete_intervening_results', 'enabled']
|
|
27
|
+
const snakeCase = { allowNoMatch: 'allow_no_match', allowNoJobs: 'allow_no_jobs', errorTrace: 'error_trace', filterPath: 'filter_path', requestsPerSecond: 'requests_per_second', allowNoForecasts: 'allow_no_forecasts', waitForCompletion: 'wait_for_completion', linesToSample: 'lines_to_sample', lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', grokPattern: 'grok_pattern', timestampField: 'timestamp_field', timestampFormat: 'timestamp_format', calcInterim: 'calc_interim', advanceTime: 'advance_time', skipTime: 'skip_time', expiresIn: 'expires_in', maxModelMemory: 'max_model_memory', excludeInterim: 'exclude_interim', anomalyScore: 'anomaly_score', jobId: 'job_id', partitionFieldValue: 'partition_field_value', excludeGenerated: 'exclude_generated', allowNoDatafeeds: 'allow_no_datafeeds', influencerScore: 'influencer_score', topN: 'top_n', bucketSpan: 'bucket_span', overallScore: 'overall_score', recordScore: 'record_score', includeModelDefinition: 'include_model_definition', decompressDefinition: 'decompress_definition', resetStart: 'reset_start', resetEnd: 'reset_end', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', ignoreThrottled: 'ignore_throttled', expandWildcards: 'expand_wildcards', deleteInterveningResults: 'delete_intervening_results' }
|
|
28
28
|
|
|
29
29
|
function MlApi (transport, ConfigurationError) {
|
|
30
30
|
this.transport = transport
|
|
@@ -382,7 +382,7 @@ MlApi.prototype.deleteTrainedModel = function mlDeleteTrainedModelApi (params, o
|
|
|
382
382
|
|
|
383
383
|
var path = ''
|
|
384
384
|
if (method == null) method = 'DELETE'
|
|
385
|
-
path = '/' + '_ml' + '/' + '
|
|
385
|
+
path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId)
|
|
386
386
|
|
|
387
387
|
// build request object
|
|
388
388
|
const request = {
|
|
@@ -995,10 +995,10 @@ MlApi.prototype.getTrainedModels = function mlGetTrainedModelsApi (params, optio
|
|
|
995
995
|
var path = ''
|
|
996
996
|
if ((model_id || modelId) != null) {
|
|
997
997
|
if (method == null) method = 'GET'
|
|
998
|
-
path = '/' + '_ml' + '/' + '
|
|
998
|
+
path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId)
|
|
999
999
|
} else {
|
|
1000
1000
|
if (method == null) method = 'GET'
|
|
1001
|
-
path = '/' + '_ml' + '/' + '
|
|
1001
|
+
path = '/' + '_ml' + '/' + 'trained_models'
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
1004
|
// build request object
|
|
@@ -1021,10 +1021,10 @@ MlApi.prototype.getTrainedModelsStats = function mlGetTrainedModelsStatsApi (par
|
|
|
1021
1021
|
var path = ''
|
|
1022
1022
|
if ((model_id || modelId) != null) {
|
|
1023
1023
|
if (method == null) method = 'GET'
|
|
1024
|
-
path = '/' + '_ml' + '/' + '
|
|
1024
|
+
path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId) + '/' + '_stats'
|
|
1025
1025
|
} else {
|
|
1026
1026
|
if (method == null) method = 'GET'
|
|
1027
|
-
path = '/' + '_ml' + '/' + '
|
|
1027
|
+
path = '/' + '_ml' + '/' + 'trained_models' + '/' + '_stats'
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
1030
|
// build request object
|
|
@@ -1381,7 +1381,7 @@ MlApi.prototype.putTrainedModel = function mlPutTrainedModelApi (params, options
|
|
|
1381
1381
|
|
|
1382
1382
|
var path = ''
|
|
1383
1383
|
if (method == null) method = 'PUT'
|
|
1384
|
-
path = '/' + '_ml' + '/' + '
|
|
1384
|
+
path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId)
|
|
1385
1385
|
|
|
1386
1386
|
// build request object
|
|
1387
1387
|
const request = {
|
|
@@ -1725,6 +1725,43 @@ MlApi.prototype.updateModelSnapshot = function mlUpdateModelSnapshotApi (params,
|
|
|
1725
1725
|
return this.transport.request(request, options, callback)
|
|
1726
1726
|
}
|
|
1727
1727
|
|
|
1728
|
+
MlApi.prototype.upgradeJobSnapshot = function mlUpgradeJobSnapshotApi (params, options, callback) {
|
|
1729
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
1730
|
+
|
|
1731
|
+
// check required parameters
|
|
1732
|
+
if (params['job_id'] == null && params['jobId'] == null) {
|
|
1733
|
+
const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
|
|
1734
|
+
return handleError(err, callback)
|
|
1735
|
+
}
|
|
1736
|
+
if (params['snapshot_id'] == null && params['snapshotId'] == null) {
|
|
1737
|
+
const err = new this[kConfigurationError]('Missing required parameter: snapshot_id or snapshotId')
|
|
1738
|
+
return handleError(err, callback)
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// check required url components
|
|
1742
|
+
if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null && params['jobId'] == null))) {
|
|
1743
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
|
|
1744
|
+
return handleError(err, callback)
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params
|
|
1748
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
1749
|
+
|
|
1750
|
+
var path = ''
|
|
1751
|
+
if (method == null) method = 'POST'
|
|
1752
|
+
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_upgrade'
|
|
1753
|
+
|
|
1754
|
+
// build request object
|
|
1755
|
+
const request = {
|
|
1756
|
+
method,
|
|
1757
|
+
path,
|
|
1758
|
+
body: body || '',
|
|
1759
|
+
querystring
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
return this.transport.request(request, options, callback)
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1728
1765
|
MlApi.prototype.validate = function mlValidateApi (params, options, callback) {
|
|
1729
1766
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
1730
1767
|
|
|
@@ -1836,6 +1873,7 @@ Object.defineProperties(MlApi.prototype, {
|
|
|
1836
1873
|
update_filter: { get () { return this.updateFilter } },
|
|
1837
1874
|
update_job: { get () { return this.updateJob } },
|
|
1838
1875
|
update_model_snapshot: { get () { return this.updateModelSnapshot } },
|
|
1876
|
+
upgrade_job_snapshot: { get () { return this.upgradeJobSnapshot } },
|
|
1839
1877
|
validate_detector: { get () { return this.validateDetector } }
|
|
1840
1878
|
})
|
|
1841
1879
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { ignoreUnavailable: 'ignore_unavailable', expandWildcards: 'expand_wildcards', keepAlive: 'keep_alive', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function openPointInTimeApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
var { method, body, index, ...querystring } = params
|
|
33
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
34
|
+
|
|
35
|
+
var path = ''
|
|
36
|
+
if ((index) != null) {
|
|
37
|
+
if (method == null) method = 'POST'
|
|
38
|
+
path = '/' + encodeURIComponent(index) + '/' + '_pit'
|
|
39
|
+
} else {
|
|
40
|
+
if (method == null) method = 'POST'
|
|
41
|
+
path = '/' + '_pit'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// build request object
|
|
45
|
+
const request = {
|
|
46
|
+
method,
|
|
47
|
+
path,
|
|
48
|
+
body: body || '',
|
|
49
|
+
querystring
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return this.transport.request(request, options, callback)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = openPointInTimeApi
|
package/api/api/rollup.js
CHANGED
|
@@ -168,6 +168,47 @@ RollupApi.prototype.putJob = function rollupPutJobApi (params, options, callback
|
|
|
168
168
|
return this.transport.request(request, options, callback)
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
RollupApi.prototype.rollup = function rollupRollupApi (params, options, callback) {
|
|
172
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
173
|
+
|
|
174
|
+
// check required parameters
|
|
175
|
+
if (params['index'] == null) {
|
|
176
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
177
|
+
return handleError(err, callback)
|
|
178
|
+
}
|
|
179
|
+
if (params['rollup_index'] == null && params['rollupIndex'] == null) {
|
|
180
|
+
const err = new this[kConfigurationError]('Missing required parameter: rollup_index or rollupIndex')
|
|
181
|
+
return handleError(err, callback)
|
|
182
|
+
}
|
|
183
|
+
if (params['body'] == null) {
|
|
184
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
185
|
+
return handleError(err, callback)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// check required url components
|
|
189
|
+
if ((params['rollup_index'] != null || params['rollupIndex'] != null) && (params['index'] == null)) {
|
|
190
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
191
|
+
return handleError(err, callback)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
var { method, body, index, rollupIndex, rollup_index, ...querystring } = params
|
|
195
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
196
|
+
|
|
197
|
+
var path = ''
|
|
198
|
+
if (method == null) method = 'POST'
|
|
199
|
+
path = '/' + encodeURIComponent(index) + '/' + '_rollup' + '/' + encodeURIComponent(rollup_index || rollupIndex)
|
|
200
|
+
|
|
201
|
+
// build request object
|
|
202
|
+
const request = {
|
|
203
|
+
method,
|
|
204
|
+
path,
|
|
205
|
+
body: body || '',
|
|
206
|
+
querystring
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return this.transport.request(request, options, callback)
|
|
210
|
+
}
|
|
211
|
+
|
|
171
212
|
RollupApi.prototype.rollupSearch = function rollupRollupSearchApi (params, options, callback) {
|
|
172
213
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
173
214
|
|
package/api/api/security.js
CHANGED
|
@@ -84,6 +84,33 @@ SecurityApi.prototype.changePassword = function securityChangePasswordApi (param
|
|
|
84
84
|
return this.transport.request(request, options, callback)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
SecurityApi.prototype.clearApiKeyCache = function securityClearApiKeyCacheApi (params, options, callback) {
|
|
88
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
89
|
+
|
|
90
|
+
// check required parameters
|
|
91
|
+
if (params['ids'] == null) {
|
|
92
|
+
const err = new this[kConfigurationError]('Missing required parameter: ids')
|
|
93
|
+
return handleError(err, callback)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var { method, body, ids, ...querystring } = params
|
|
97
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
98
|
+
|
|
99
|
+
var path = ''
|
|
100
|
+
if (method == null) method = 'POST'
|
|
101
|
+
path = '/' + '_security' + '/' + 'api_key' + '/' + encodeURIComponent(ids) + '/' + '_clear_cache'
|
|
102
|
+
|
|
103
|
+
// build request object
|
|
104
|
+
const request = {
|
|
105
|
+
method,
|
|
106
|
+
path,
|
|
107
|
+
body: body || '',
|
|
108
|
+
querystring
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return this.transport.request(request, options, callback)
|
|
112
|
+
}
|
|
113
|
+
|
|
87
114
|
SecurityApi.prototype.clearCachedPrivileges = function securityClearCachedPrivilegesApi (params, options, callback) {
|
|
88
115
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
89
116
|
|
|
@@ -567,6 +594,33 @@ SecurityApi.prototype.getUserPrivileges = function securityGetUserPrivilegesApi
|
|
|
567
594
|
return this.transport.request(request, options, callback)
|
|
568
595
|
}
|
|
569
596
|
|
|
597
|
+
SecurityApi.prototype.grantApiKey = function securityGrantApiKeyApi (params, options, callback) {
|
|
598
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
599
|
+
|
|
600
|
+
// check required parameters
|
|
601
|
+
if (params['body'] == null) {
|
|
602
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
603
|
+
return handleError(err, callback)
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
var { method, body, ...querystring } = params
|
|
607
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
608
|
+
|
|
609
|
+
var path = ''
|
|
610
|
+
if (method == null) method = 'POST'
|
|
611
|
+
path = '/' + '_security' + '/' + 'api_key' + '/' + 'grant'
|
|
612
|
+
|
|
613
|
+
// build request object
|
|
614
|
+
const request = {
|
|
615
|
+
method,
|
|
616
|
+
path,
|
|
617
|
+
body: body || '',
|
|
618
|
+
querystring
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return this.transport.request(request, options, callback)
|
|
622
|
+
}
|
|
623
|
+
|
|
570
624
|
SecurityApi.prototype.hasPrivileges = function securityHasPrivilegesApi (params, options, callback) {
|
|
571
625
|
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
572
626
|
|
|
@@ -775,6 +829,7 @@ SecurityApi.prototype.putUser = function securityPutUserApi (params, options, ca
|
|
|
775
829
|
|
|
776
830
|
Object.defineProperties(SecurityApi.prototype, {
|
|
777
831
|
change_password: { get () { return this.changePassword } },
|
|
832
|
+
clear_api_key_cache: { get () { return this.clearApiKeyCache } },
|
|
778
833
|
clear_cached_privileges: { get () { return this.clearCachedPrivileges } },
|
|
779
834
|
clear_cached_realms: { get () { return this.clearCachedRealms } },
|
|
780
835
|
clear_cached_roles: { get () { return this.clearCachedRoles } },
|
|
@@ -793,6 +848,7 @@ Object.defineProperties(SecurityApi.prototype, {
|
|
|
793
848
|
get_token: { get () { return this.getToken } },
|
|
794
849
|
get_user: { get () { return this.getUser } },
|
|
795
850
|
get_user_privileges: { get () { return this.getUserPrivileges } },
|
|
851
|
+
grant_api_key: { get () { return this.grantApiKey } },
|
|
796
852
|
has_privileges: { get () { return this.hasPrivileges } },
|
|
797
853
|
invalidate_api_key: { get () { return this.invalidateApiKey } },
|
|
798
854
|
invalidate_token: { get () { return this.invalidateToken } },
|