Compare commits

...

11 Commits
8.5 ... v8.6.1

Author SHA1 Message Date
58914fc18c Switch 8.6 clients to only get patch updates to transport (#2210)
* Switch 8.6 clients to only get patch updates to transport

* Fix escaping on asciidocs
2024-04-09 12:46:51 -05:00
e919432cf0 [Backport 8.6] Use correct user-agent header by default (#1869)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-05 11:15:25 -05:00
2fd6f82b0f [8.6] [DOCS] Includes source_branch in docs index 2023-02-22 07:49:51 -06:00
2be9e7cf5d Update bulk.asciidoc (#1752) (#1807)
Fix typo

Co-authored-by: Ryan Har <31252286+nkwwk@users.noreply.github.com>
2023-01-12 14:52:58 +01:00
281ac00af7 [8.6] Add release notes for 8.6.0
Co-authored-by: Seth Michael Larson <seth.larson@elastic.co>
2023-01-10 15:28:28 -05:00
0f0c600bb7 [8.6] Bump @elastic/transport to 8.3.1
Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
2023-01-05 10:28:52 -06:00
38e4b23831 Add a changelog for 8.5.0 2022-11-03 11:06:58 -05:00
04634af552 Update all docs refs to 'current' instead of 'master' 2022-09-28 12:29:57 -05:00
f79f4e8f25 Remove unnecessary ts-expect-error 2022-09-27 06:42:31 -05:00
560dfd3763 Fix docs URLs to use 'current' instead of 'master' 2022-09-27 06:39:47 -05:00
ebbc2961e0 Bumps to version 8.6.0 (#1762) 2022-09-21 09:03:27 -05:00
18 changed files with 457 additions and 385 deletions

View File

@ -1,6 +1,6 @@
---
STACK_VERSION:
- "8.5.0-SNAPSHOT"
- "8.6.0-SNAPSHOT"
NODE_JS_VERSION:
- 18

View File

@ -1,6 +1,37 @@
[[changelog-client]]
== Release notes
[discrete]
=== 8.6.1
[discrete]
===== Bump @elastic/transport to `~8.3.1`
Switching from `^8.3.1` to `~8.3.1` ensures 8.6 client users are not required to update to Node.js v18+, which is a new requirement set by `@elastic/transport` v8.5.0. See https://github.com/elastic/elastic-transport-js/issues/91[elastic/elastic-transport-js#91] for details.
[discrete]
=== 8.6.0
[discrete]
===== Bump @elastic/transport to 8.3.1+ https://github.com/elastic/elasticsearch-js/pull/1802[#1802]
The `@elastic/transport` dependency has been bumped to `~8.3.1` to ensure
fixes to the `maxResponseSize` option are available in the client.
[discrete]
===== Support for Elasticsearch `v8.6.0`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.6/release-notes-8.6.0.html[here].
[discrete]
=== 8.5.0
[discrete]
===== Support for Elasticsearch `v8.5.0`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.5/release-notes-8.5.0.html[here].
[discrete]
=== 8.4.0

View File

@ -77,8 +77,8 @@ async function run () {
// fix the document before to try it again.
status: action[operation].status,
error: action[operation].error,
operation: body[i * 2],
document: body[i * 2 + 1]
operation: operations[i * 2],
document: operations[i * 2 + 1]
})
}
})

View File

@ -1,6 +1,6 @@
= Elasticsearch JavaScript Client
:branch: master
include::{asciidoc-dir}/../../shared/versions/stack/{source_branch}.asciidoc[]
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
include::introduction.asciidoc[]

View File

@ -155,7 +155,7 @@ request: {
The event order is described in the following graph, in some edge cases, the
order is not guaranteed.
You can find in
https://github.com/elastic/elasticsearch-js/blob/master/test/acceptance/events-order.test.js[`test/acceptance/events-order.test.js`]
https://github.com/elastic/elasticsearch-js/blob/main/test/acceptance/events-order.test.js[`test/acceptance/events-order.test.js`]
how the order changes based on the situation.
[source]
@ -377,9 +377,9 @@ child.search({
To improve observability, the client offers an easy way to configure the
`X-Opaque-Id` header. If you set the `X-Opaque-Id` in a specific request, this
allows you to discover this identifier in the
https://www.elastic.co/guide/en/elasticsearch/reference/master/logging.html#deprecation-logging[deprecation logs],
helps you with https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
as well as https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html#_identifying_running_tasks[identifying running tasks].
https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html#deprecation-logging[deprecation logs],
helps you with https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
as well as https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#_identifying_running_tasks[identifying running tasks].
The `X-Opaque-Id` should be configured in each request, for doing that you can
use the `opaqueId` option, as you can see in the following example. The

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "@elastic/elasticsearch",
"version": "8.5.0",
"versionCanary": "8.5.0-canary.0",
"version": "8.6.1",
"versionCanary": "8.6.1-canary.0",
"description": "The official Elasticsearch client for Node.js",
"main": "index.js",
"types": "index.d.ts",
@ -81,7 +81,7 @@
"zx": "^6.1.0"
},
"dependencies": {
"@elastic/transport": "^8.2.0",
"@elastic/transport": "~8.3.1",
"tslib": "^2.4.0"
},
"tap": {
@ -91,4 +91,4 @@
"coverage": false,
"check-coverage": false
}
}
}

View File

@ -114,7 +114,7 @@ export default class AsyncSearch {
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchSubmitResponse<TDocument, TAggregations>>
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -104,7 +104,7 @@ export default class Fleet {
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptions): Promise<T.FleetSearchResponse<TDocument>>
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -418,6 +418,33 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body }, options)
}
async downsample (this: That, params: T.IndicesDownsampleRequest | TB.IndicesDownsampleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesDownsampleResponse>
async downsample (this: That, params: T.IndicesDownsampleRequest | TB.IndicesDownsampleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesDownsampleResponse, unknown>>
async downsample (this: That, params: T.IndicesDownsampleRequest | TB.IndicesDownsampleRequest, options?: TransportRequestOptions): Promise<T.IndicesDownsampleResponse>
async downsample (this: That, params: T.IndicesDownsampleRequest | TB.IndicesDownsampleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index', 'target_index']
const acceptedBody: string[] = ['config']
const querystring: Record<string, any> = {}
// @ts-expect-error
let body: any = params.body ?? undefined
for (const key in params) {
if (acceptedBody.includes(key)) {
// @ts-expect-error
body = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'POST'
const path = `/${encodeURIComponent(params.index.toString())}/_downsample/${encodeURIComponent(params.target_index.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesExistsResponse>
async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesExistsResponse, unknown>>
async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptions): Promise<T.IndicesExistsResponse>

View File

@ -181,33 +181,6 @@ export default class Rollup {
return await this.transport.request({ path, method, querystring, body }, options)
}
async rollup (this: That, params: T.RollupRollupRequest | TB.RollupRollupRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.RollupRollupResponse>
async rollup (this: That, params: T.RollupRollupRequest | TB.RollupRollupRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupRollupResponse, unknown>>
async rollup (this: That, params: T.RollupRollupRequest | TB.RollupRollupRequest, options?: TransportRequestOptions): Promise<T.RollupRollupResponse>
async rollup (this: That, params: T.RollupRollupRequest | TB.RollupRollupRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index', 'rollup_index']
const acceptedBody: string[] = ['config']
const querystring: Record<string, any> = {}
// @ts-expect-error
let body: any = params.body ?? undefined
for (const key in params) {
if (acceptedBody.includes(key)) {
// @ts-expect-error
body = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'POST'
const path = `/${encodeURIComponent(params.index.toString())}/_rollup/${encodeURIComponent(params.rollup_index.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async rollupSearch<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.RollupRollupSearchResponse<TDocument, TAggregations>>
async rollupSearch<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupRollupSearchResponse<TDocument, TAggregations>, unknown>>
async rollupSearch<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptions): Promise<T.RollupRollupSearchResponse<TDocument, TAggregations>>

View File

@ -42,7 +42,7 @@ export default async function SearchApi<TDocument = unknown, TAggregations = Rec
export default async function SearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptions): Promise<T.SearchResponse<TDocument, TAggregations>>
export default async function SearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -891,7 +891,7 @@ export default class Security {
async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest | TB.SecurityGrantApiKeyRequest, options?: TransportRequestOptions): Promise<T.SecurityGrantApiKeyResponse>
async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest | TB.SecurityGrantApiKeyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['api_key', 'grant_type', 'access_token', 'username', 'password']
const acceptedBody: string[] = ['api_key', 'grant_type', 'access_token', 'username', 'password', 'run_as']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -433,7 +433,7 @@ export interface GetScriptLanguagesResponse {
types_allowed: string[]
}
export interface GetSourceRequest {
export interface GetSourceRequest extends RequestBase {
id: Id
index: IndexName
preference?: string
@ -560,6 +560,7 @@ export interface MsearchMultisearchBody {
collapse?: SearchFieldCollapse
query?: QueryDslQueryContainer
explain?: boolean
ext?: Record<string, any>
stored_fields?: Fields
docvalue_fields?: (QueryDslFieldAndFormat | Field)[]
knn?: KnnQuery
@ -987,6 +988,7 @@ export interface SearchRequest extends RequestBase {
aggs?: Record<string, AggregationsAggregationContainer>
collapse?: SearchFieldCollapse
explain?: boolean
ext?: Record<string, any>
from?: integer
highlight?: SearchHighlight
track_total_hits?: SearchTrackHits
@ -1876,7 +1878,7 @@ export type EpochTime<Unit = unknown> = Unit
export interface ErrorCauseKeys {
type: string
reason: string
reason?: string
stack_trace?: string
caused_by?: ErrorCause
root_cause?: ErrorCause[]
@ -1918,7 +1920,7 @@ export interface FieldSort {
export type FieldSortNumericType = 'long' | 'double' | 'date' | 'date_nanos'
export type FieldValue = long | double | string | boolean
export type FieldValue = long | double | string | boolean | any
export interface FielddataStats {
evictions?: long
@ -2954,7 +2956,7 @@ export interface AggregationsFormattableMetricAggregation extends AggregationsMe
export type AggregationsGapPolicy = 'skip' | 'insert_zeros'
export interface AggregationsGeoBoundsAggregate extends AggregationsAggregateBase {
bounds: GeoBounds
bounds?: GeoBounds
}
export interface AggregationsGeoBoundsAggregation extends AggregationsMetricAggregationBase {
@ -3953,17 +3955,18 @@ export type AnalysisIcuCollationStrength = 'primary' | 'secondary' | 'tertiary'
export interface AnalysisIcuCollationTokenFilter extends AnalysisTokenFilterBase {
type: 'icu_collation'
alternate: AnalysisIcuCollationAlternate
caseFirst: AnalysisIcuCollationCaseFirst
caseLevel: boolean
country: string
decomposition: AnalysisIcuCollationDecomposition
hiraganaQuaternaryMode: boolean
language: string
numeric: boolean
strength: AnalysisIcuCollationStrength
alternate?: AnalysisIcuCollationAlternate
caseFirst?: AnalysisIcuCollationCaseFirst
caseLevel?: boolean
country?: string
decomposition?: AnalysisIcuCollationDecomposition
hiraganaQuaternaryMode?: boolean
language?: string
numeric?: boolean
rules?: string
strength?: AnalysisIcuCollationStrength
variableTop?: string
variant: string
variant?: string
}
export interface AnalysisIcuFoldingTokenFilter extends AnalysisTokenFilterBase {
@ -3995,7 +3998,7 @@ export type AnalysisIcuTransformDirection = 'forward' | 'reverse'
export interface AnalysisIcuTransformTokenFilter extends AnalysisTokenFilterBase {
type: 'icu_transform'
dir: AnalysisIcuTransformDirection
dir?: AnalysisIcuTransformDirection
id: string
}
@ -4785,7 +4788,7 @@ export interface MappingRuntimeField {
export type MappingRuntimeFieldType = 'boolean' | 'date' | 'double' | 'geo_point' | 'ip' | 'keyword' | 'long'
export type MappingRuntimeFields = Record<Field, MappingRuntimeField | MappingRuntimeField[]>
export type MappingRuntimeFields = Record<Field, MappingRuntimeField>
export interface MappingScaledFloatNumberProperty extends MappingNumberPropertyBase {
type: 'scaled_float'
@ -5753,6 +5756,7 @@ export interface AsyncSearchSubmitRequest extends RequestBase {
aggs?: Record<string, AggregationsAggregationContainer>
collapse?: SearchFieldCollapse
explain?: boolean
ext?: Record<string, any>
from?: integer
highlight?: SearchHighlight
track_total_hits?: SearchTrackHits
@ -7879,7 +7883,7 @@ export interface ClusterComponentTemplateNode {
export interface ClusterComponentTemplateSummary {
_meta?: Metadata
version?: VersionNumber
settings: Record<IndexName, IndicesIndexSettings>
settings?: Record<IndexName, IndicesIndexSettings>
mappings?: MappingTypeMapping
aliases?: Record<string, IndicesAliasDefinition>
}
@ -8812,6 +8816,7 @@ export interface FleetSearchRequest extends RequestBase {
aggs?: Record<string, AggregationsAggregationContainer>
collapse?: SearchFieldCollapse
explain?: boolean
ext?: Record<string, any>
from?: integer
highlight?: SearchHighlight
track_total_hits?: SearchTrackHits
@ -9329,8 +9334,7 @@ export interface IndicesIndexTemplateSummary {
}
export interface IndicesIndexVersioning {
created: VersionString
created_string?: VersionString
created?: VersionString
}
export interface IndicesIndexingPressure {
@ -9565,7 +9569,7 @@ export interface IndicesAnalyzeAnalyzeDetail {
export interface IndicesAnalyzeAnalyzeToken {
end_offset: long
position: long
position_length?: long
positionLength?: long
start_offset: long
token: string
type: string
@ -9772,6 +9776,14 @@ export interface IndicesDiskUsageRequest extends RequestBase {
export type IndicesDiskUsageResponse = any
export interface IndicesDownsampleRequest extends RequestBase {
index: IndexName
target_index: IndexName
config?: any
}
export type IndicesDownsampleResponse = any
export interface IndicesExistsRequest extends RequestBase {
index: Indices
allow_no_indices?: boolean
@ -14752,14 +14764,6 @@ export interface RollupPutJobRequest extends RequestBase {
export type RollupPutJobResponse = AcknowledgedResponseBase
export interface RollupRollupRequest extends RequestBase {
index: IndexName
rollup_index: IndexName
config?: any
}
export type RollupRollupResponse = any
export interface RollupRollupSearchRequest extends RequestBase {
index: Indices
rest_total_hits_as_int?: boolean
@ -14875,6 +14879,9 @@ export interface SecurityApiKey {
realm?: string
username?: Username
metadata?: Metadata
role_descriptors?: Record<string, SecurityRoleDescriptor>
limited_by?: Record<string, SecurityRoleDescriptor>[]
_sort?: SortResults
}
export interface SecurityApplicationGlobalUserPrivileges {
@ -15001,6 +15008,7 @@ export interface SecurityUser {
roles: string[]
username: Username
enabled: boolean
profile_uid?: SecurityUserProfileId
}
export interface SecurityUserProfile {
@ -15270,6 +15278,7 @@ export interface SecurityGetApiKeyRequest extends RequestBase {
owner?: boolean
realm_name?: Name
username?: Username
with_limited_by?: boolean
}
export interface SecurityGetApiKeyResponse {
@ -15381,7 +15390,7 @@ export interface SecurityGetTokenResponse {
expires_in: long
scope?: string
type: string
refresh_token: string
refresh_token?: string
kerberos_authentication_response_token?: string
authentication: SecurityGetTokenAuthenticatedUser
}
@ -15393,6 +15402,7 @@ export interface SecurityGetTokenUserRealm {
export interface SecurityGetUserRequest extends RequestBase {
username?: Username | Username[]
with_profile_uid?: boolean
}
export type SecurityGetUserResponse = Record<string, SecurityUser>
@ -15411,19 +15421,28 @@ export interface SecurityGetUserPrivilegesResponse {
run_as: string[]
}
export interface SecurityGetUserProfileGetUserProfileErrors {
count: long
details: Record<SecurityUserProfileId, ErrorCause>
}
export interface SecurityGetUserProfileRequest extends RequestBase {
uid: SecurityUserProfileId
uid: SecurityUserProfileId | SecurityUserProfileId[]
data?: string | string[]
}
export type SecurityGetUserProfileResponse = Record<string, SecurityUserProfileWithMetadata>
export interface SecurityGetUserProfileResponse {
profiles: SecurityUserProfileWithMetadata[]
errors?: SecurityGetUserProfileGetUserProfileErrors
}
export type SecurityGrantApiKeyApiKeyGrantType = 'access_token' | 'password'
export interface SecurityGrantApiKeyGrantApiKey {
name: Name
expiration?: Duration
role_descriptors?: Record<string, any>[]
expiration?: DurationLarge
role_descriptors?: Record<string, SecurityRoleDescriptor> | Record<string, SecurityRoleDescriptor>[]
metadata?: Metadata
}
export interface SecurityGrantApiKeyRequest extends RequestBase {
@ -15432,6 +15451,7 @@ export interface SecurityGrantApiKeyRequest extends RequestBase {
access_token?: string
username?: Username
password?: Password
run_as?: Username
}
export interface SecurityGrantApiKeyResponse {
@ -15439,6 +15459,7 @@ export interface SecurityGrantApiKeyResponse {
id: Id
name: Name
expiration?: EpochTime<UnitMillis>
encoded: string
}
export interface SecurityHasPrivilegesApplicationPrivilegesCheck {
@ -15474,6 +15495,11 @@ export interface SecurityHasPrivilegesResponse {
username: Username
}
export interface SecurityHasPrivilegesUserProfileHasPrivilegesUserProfileErrors {
count: long
details: Record<SecurityUserProfileId, ErrorCause>
}
export interface SecurityHasPrivilegesUserProfilePrivilegesCheck {
application?: SecurityHasPrivilegesApplicationPrivilegesCheck[]
cluster?: SecurityClusterPrivilege[]
@ -15487,7 +15513,7 @@ export interface SecurityHasPrivilegesUserProfileRequest extends RequestBase {
export interface SecurityHasPrivilegesUserProfileResponse {
has_privilege_uids: SecurityUserProfileId[]
error_uids?: SecurityUserProfileId[]
errors?: SecurityHasPrivilegesUserProfileHasPrivilegesUserProfileErrors
}
export interface SecurityInvalidateApiKeyRequest extends RequestBase {
@ -15582,6 +15608,7 @@ export interface SecurityPutUserResponse {
}
export interface SecurityQueryApiKeysRequest extends RequestBase {
with_limited_by?: boolean
query?: QueryDslQueryContainer
from?: integer
sort?: Sort
@ -16309,6 +16336,7 @@ export interface TasksParentTaskInfo extends TasksTaskInfo {
export interface TasksTaskInfo {
action: string
cancelled?: boolean
cancellable: boolean
description?: string
headers: Record<string, string>
@ -16764,42 +16792,31 @@ export interface WatcherActivationStatus {
export interface WatcherAlwaysCondition {
}
export interface WatcherArrayCompareCondition {
array_path: string
comparison: string
export interface WatcherArrayCompareConditionKeys {
path: string
}
export type WatcherArrayCompareCondition = WatcherArrayCompareConditionKeys
& { [property: string]: WatcherArrayCompareOpParams | string }
export interface WatcherArrayCompareOpParams {
quantifier: WatcherQuantifier
value: any
value: FieldValue
}
export interface WatcherChainInput {
inputs: WatcherInputContainer[]
}
export interface WatcherCompareCondition {
comparison?: string
path?: string
value?: any
'ctx.payload.match'?: WatcherCompareContextPayloadCondition
'ctx.payload.value'?: WatcherCompareContextPayloadCondition
}
export interface WatcherCompareContextPayloadCondition {
eq?: any
lt?: any
gt?: any
lte?: any
gte?: any
inputs: Partial<Record<string, WatcherInputContainer>>[]
}
export interface WatcherConditionContainer {
always?: WatcherAlwaysCondition
array_compare?: WatcherArrayCompareCondition
compare?: WatcherCompareCondition
array_compare?: Partial<Record<string, WatcherArrayCompareCondition>>
compare?: Partial<Record<string, Partial<Record<WatcherConditionOp, FieldValue>>>>
never?: WatcherNeverCondition
script?: WatcherScriptCondition
}
export type WatcherConditionOp = 'not_eq' | 'eq' | 'lt' | 'gt' | 'lte' | 'gte'
export type WatcherConditionType = 'always' | 'never' | 'script' | 'compare' | 'array_compare'
export type WatcherConnectionScheme = 'http' | 'https'
@ -16919,7 +16936,6 @@ export interface WatcherHttpEmailAttachment {
}
export interface WatcherHttpInput {
http?: WatcherHttpInput
extract?: string[]
request?: WatcherHttpInputRequestDefinition
response_content_type?: WatcherResponseContentType

View File

@ -454,7 +454,7 @@ export interface GetScriptLanguagesResponse {
types_allowed: string[]
}
export interface GetSourceRequest {
export interface GetSourceRequest extends RequestBase {
id: Id
index: IndexName
preference?: string
@ -588,6 +588,7 @@ export interface MsearchMultisearchBody {
collapse?: SearchFieldCollapse
query?: QueryDslQueryContainer
explain?: boolean
ext?: Record<string, any>
stored_fields?: Fields
docvalue_fields?: (QueryDslFieldAndFormat | Field)[]
knn?: KnnQuery
@ -1041,6 +1042,7 @@ export interface SearchRequest extends RequestBase {
aggs?: Record<string, AggregationsAggregationContainer>
collapse?: SearchFieldCollapse
explain?: boolean
ext?: Record<string, any>
from?: integer
highlight?: SearchHighlight
track_total_hits?: SearchTrackHits
@ -1949,7 +1951,7 @@ export type EpochTime<Unit = unknown> = Unit
export interface ErrorCauseKeys {
type: string
reason: string
reason?: string
stack_trace?: string
caused_by?: ErrorCause
root_cause?: ErrorCause[]
@ -1991,7 +1993,7 @@ export interface FieldSort {
export type FieldSortNumericType = 'long' | 'double' | 'date' | 'date_nanos'
export type FieldValue = long | double | string | boolean
export type FieldValue = long | double | string | boolean | any
export interface FielddataStats {
evictions?: long
@ -3027,7 +3029,7 @@ export interface AggregationsFormattableMetricAggregation extends AggregationsMe
export type AggregationsGapPolicy = 'skip' | 'insert_zeros'
export interface AggregationsGeoBoundsAggregate extends AggregationsAggregateBase {
bounds: GeoBounds
bounds?: GeoBounds
}
export interface AggregationsGeoBoundsAggregation extends AggregationsMetricAggregationBase {
@ -4026,17 +4028,18 @@ export type AnalysisIcuCollationStrength = 'primary' | 'secondary' | 'tertiary'
export interface AnalysisIcuCollationTokenFilter extends AnalysisTokenFilterBase {
type: 'icu_collation'
alternate: AnalysisIcuCollationAlternate
caseFirst: AnalysisIcuCollationCaseFirst
caseLevel: boolean
country: string
decomposition: AnalysisIcuCollationDecomposition
hiraganaQuaternaryMode: boolean
language: string
numeric: boolean
strength: AnalysisIcuCollationStrength
alternate?: AnalysisIcuCollationAlternate
caseFirst?: AnalysisIcuCollationCaseFirst
caseLevel?: boolean
country?: string
decomposition?: AnalysisIcuCollationDecomposition
hiraganaQuaternaryMode?: boolean
language?: string
numeric?: boolean
rules?: string
strength?: AnalysisIcuCollationStrength
variableTop?: string
variant: string
variant?: string
}
export interface AnalysisIcuFoldingTokenFilter extends AnalysisTokenFilterBase {
@ -4068,7 +4071,7 @@ export type AnalysisIcuTransformDirection = 'forward' | 'reverse'
export interface AnalysisIcuTransformTokenFilter extends AnalysisTokenFilterBase {
type: 'icu_transform'
dir: AnalysisIcuTransformDirection
dir?: AnalysisIcuTransformDirection
id: string
}
@ -4858,7 +4861,7 @@ export interface MappingRuntimeField {
export type MappingRuntimeFieldType = 'boolean' | 'date' | 'double' | 'geo_point' | 'ip' | 'keyword' | 'long'
export type MappingRuntimeFields = Record<Field, MappingRuntimeField | MappingRuntimeField[]>
export type MappingRuntimeFields = Record<Field, MappingRuntimeField>
export interface MappingScaledFloatNumberProperty extends MappingNumberPropertyBase {
type: 'scaled_float'
@ -5828,6 +5831,7 @@ export interface AsyncSearchSubmitRequest extends RequestBase {
aggs?: Record<string, AggregationsAggregationContainer>
collapse?: SearchFieldCollapse
explain?: boolean
ext?: Record<string, any>
from?: integer
highlight?: SearchHighlight
track_total_hits?: SearchTrackHits
@ -7968,7 +7972,7 @@ export interface ClusterComponentTemplateNode {
export interface ClusterComponentTemplateSummary {
_meta?: Metadata
version?: VersionNumber
settings: Record<IndexName, IndicesIndexSettings>
settings?: Record<IndexName, IndicesIndexSettings>
mappings?: MappingTypeMapping
aliases?: Record<string, IndicesAliasDefinition>
}
@ -8922,6 +8926,7 @@ export interface FleetSearchRequest extends RequestBase {
aggs?: Record<string, AggregationsAggregationContainer>
collapse?: SearchFieldCollapse
explain?: boolean
ext?: Record<string, any>
from?: integer
highlight?: SearchHighlight
track_total_hits?: SearchTrackHits
@ -9452,8 +9457,7 @@ export interface IndicesIndexTemplateSummary {
}
export interface IndicesIndexVersioning {
created: VersionString
created_string?: VersionString
created?: VersionString
}
export interface IndicesIndexingPressure {
@ -9688,7 +9692,7 @@ export interface IndicesAnalyzeAnalyzeDetail {
export interface IndicesAnalyzeAnalyzeToken {
end_offset: long
position: long
position_length?: long
positionLength?: long
start_offset: long
token: string
type: string
@ -9904,6 +9908,15 @@ export interface IndicesDiskUsageRequest extends RequestBase {
export type IndicesDiskUsageResponse = any
export interface IndicesDownsampleRequest extends RequestBase {
index: IndexName
target_index: IndexName
/** @deprecated The use of the 'body' key has been deprecated, use 'config' instead. */
body?: any
}
export type IndicesDownsampleResponse = any
export interface IndicesExistsRequest extends RequestBase {
index: Indices
allow_no_indices?: boolean
@ -15046,15 +15059,6 @@ export interface RollupPutJobRequest extends RequestBase {
export type RollupPutJobResponse = AcknowledgedResponseBase
export interface RollupRollupRequest extends RequestBase {
index: IndexName
rollup_index: IndexName
/** @deprecated The use of the 'body' key has been deprecated, use 'config' instead. */
body?: any
}
export type RollupRollupResponse = any
export interface RollupRollupSearchRequest extends RequestBase {
index: Indices
rest_total_hits_as_int?: boolean
@ -15176,6 +15180,9 @@ export interface SecurityApiKey {
realm?: string
username?: Username
metadata?: Metadata
role_descriptors?: Record<string, SecurityRoleDescriptor>
limited_by?: Record<string, SecurityRoleDescriptor>[]
_sort?: SortResults
}
export interface SecurityApplicationGlobalUserPrivileges {
@ -15302,6 +15309,7 @@ export interface SecurityUser {
roles: string[]
username: Username
enabled: boolean
profile_uid?: SecurityUserProfileId
}
export interface SecurityUserProfile {
@ -15580,6 +15588,7 @@ export interface SecurityGetApiKeyRequest extends RequestBase {
owner?: boolean
realm_name?: Name
username?: Username
with_limited_by?: boolean
}
export interface SecurityGetApiKeyResponse {
@ -15694,7 +15703,7 @@ export interface SecurityGetTokenResponse {
expires_in: long
scope?: string
type: string
refresh_token: string
refresh_token?: string
kerberos_authentication_response_token?: string
authentication: SecurityGetTokenAuthenticatedUser
}
@ -15706,6 +15715,7 @@ export interface SecurityGetTokenUserRealm {
export interface SecurityGetUserRequest extends RequestBase {
username?: Username | Username[]
with_profile_uid?: boolean
}
export type SecurityGetUserResponse = Record<string, SecurityUser>
@ -15724,19 +15734,28 @@ export interface SecurityGetUserPrivilegesResponse {
run_as: string[]
}
export interface SecurityGetUserProfileGetUserProfileErrors {
count: long
details: Record<SecurityUserProfileId, ErrorCause>
}
export interface SecurityGetUserProfileRequest extends RequestBase {
uid: SecurityUserProfileId
uid: SecurityUserProfileId | SecurityUserProfileId[]
data?: string | string[]
}
export type SecurityGetUserProfileResponse = Record<string, SecurityUserProfileWithMetadata>
export interface SecurityGetUserProfileResponse {
profiles: SecurityUserProfileWithMetadata[]
errors?: SecurityGetUserProfileGetUserProfileErrors
}
export type SecurityGrantApiKeyApiKeyGrantType = 'access_token' | 'password'
export interface SecurityGrantApiKeyGrantApiKey {
name: Name
expiration?: Duration
role_descriptors?: Record<string, any>[]
expiration?: DurationLarge
role_descriptors?: Record<string, SecurityRoleDescriptor> | Record<string, SecurityRoleDescriptor>[]
metadata?: Metadata
}
export interface SecurityGrantApiKeyRequest extends RequestBase {
@ -15747,6 +15766,7 @@ export interface SecurityGrantApiKeyRequest extends RequestBase {
access_token?: string
username?: Username
password?: Password
run_as?: Username
}
}
@ -15755,6 +15775,7 @@ export interface SecurityGrantApiKeyResponse {
id: Id
name: Name
expiration?: EpochTime<UnitMillis>
encoded: string
}
export interface SecurityHasPrivilegesApplicationPrivilegesCheck {
@ -15793,6 +15814,11 @@ export interface SecurityHasPrivilegesResponse {
username: Username
}
export interface SecurityHasPrivilegesUserProfileHasPrivilegesUserProfileErrors {
count: long
details: Record<SecurityUserProfileId, ErrorCause>
}
export interface SecurityHasPrivilegesUserProfilePrivilegesCheck {
application?: SecurityHasPrivilegesApplicationPrivilegesCheck[]
cluster?: SecurityClusterPrivilege[]
@ -15809,7 +15835,7 @@ export interface SecurityHasPrivilegesUserProfileRequest extends RequestBase {
export interface SecurityHasPrivilegesUserProfileResponse {
has_privilege_uids: SecurityUserProfileId[]
error_uids?: SecurityUserProfileId[]
errors?: SecurityHasPrivilegesUserProfileHasPrivilegesUserProfileErrors
}
export interface SecurityInvalidateApiKeyRequest extends RequestBase {
@ -15921,6 +15947,7 @@ export interface SecurityPutUserResponse {
}
export interface SecurityQueryApiKeysRequest extends RequestBase {
with_limited_by?: boolean
/** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */
body?: {
query?: QueryDslQueryContainer
@ -16702,6 +16729,7 @@ export interface TasksParentTaskInfo extends TasksTaskInfo {
export interface TasksTaskInfo {
action: string
cancelled?: boolean
cancellable: boolean
description?: string
headers: Record<string, string>
@ -17167,42 +17195,31 @@ export interface WatcherActivationStatus {
export interface WatcherAlwaysCondition {
}
export interface WatcherArrayCompareCondition {
array_path: string
comparison: string
export interface WatcherArrayCompareConditionKeys {
path: string
}
export type WatcherArrayCompareCondition = WatcherArrayCompareConditionKeys
& { [property: string]: WatcherArrayCompareOpParams | string }
export interface WatcherArrayCompareOpParams {
quantifier: WatcherQuantifier
value: any
value: FieldValue
}
export interface WatcherChainInput {
inputs: WatcherInputContainer[]
}
export interface WatcherCompareCondition {
comparison?: string
path?: string
value?: any
'ctx.payload.match'?: WatcherCompareContextPayloadCondition
'ctx.payload.value'?: WatcherCompareContextPayloadCondition
}
export interface WatcherCompareContextPayloadCondition {
eq?: any
lt?: any
gt?: any
lte?: any
gte?: any
inputs: Partial<Record<string, WatcherInputContainer>>[]
}
export interface WatcherConditionContainer {
always?: WatcherAlwaysCondition
array_compare?: WatcherArrayCompareCondition
compare?: WatcherCompareCondition
array_compare?: Partial<Record<string, WatcherArrayCompareCondition>>
compare?: Partial<Record<string, Partial<Record<WatcherConditionOp, FieldValue>>>>
never?: WatcherNeverCondition
script?: WatcherScriptCondition
}
export type WatcherConditionOp = 'not_eq' | 'eq' | 'lt' | 'gt' | 'lte' | 'gte'
export type WatcherConditionType = 'always' | 'never' | 'script' | 'compare' | 'array_compare'
export type WatcherConnectionScheme = 'http' | 'https'
@ -17322,7 +17339,6 @@ export interface WatcherHttpEmailAttachment {
}
export interface WatcherHttpInput {
http?: WatcherHttpInput
extract?: string[]
request?: WatcherHttpInputRequestDefinition
response_content_type?: WatcherResponseContentType

View File

@ -20,6 +20,7 @@
import { ConnectionOptions as TlsConnectionOptions } from 'tls'
import { URL } from 'url'
import buffer from 'buffer'
import os from 'os'
import {
Transport,
UndiciConnection,
@ -173,7 +174,9 @@ export default class Client extends API {
tls: null,
caFingerprint: null,
agent: null,
headers: {},
headers: {
'user-agent': `elasticsearch-js/${clientVersion} Node.js ${nodeVersion}; Transport ${transportVersion}; (${os.platform()} ${os.release()} ${os.arch()})`
},
nodeFilter: null,
generateRequestId: null,
name: 'elasticsearch-js',

View File

@ -229,7 +229,6 @@ export default class Helpers {
rest_total_hits_as_int: params.rest_total_hits_as_int,
scroll_id
}, options as TransportRequestOptionsWithMeta)
// @ts-expect-error
response = r as TransportResult<T.ScrollResponse<TDocument, TAggregations>, unknown>
assert(response !== undefined, 'The response is undefined, please file a bug report')
if (response.statusCode !== 429) break

View File

@ -432,3 +432,12 @@ test('caFingerprint can\'t be configured over http / 2', t => {
)
t.end()
})
test('user agent is in the correct format', t => {
const client = new Client({ node: 'http://localhost:9200' })
const agentRaw = client.transport[symbols.kHeaders]['user-agent'] || ''
const agentSplit = agentRaw.split(/\s+/)
t.equal(agentSplit[0].split('/')[0], 'elasticsearch-js')
t.ok(/^\d+\.\d+\.\d+/.test(agentSplit[0].split('/')[1]))
t.end()
})