Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/reference/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -8420,6 +8420,7 @@ client.logstash.putPipeline({ id })

#### Request (object) [_request_logstash.put_pipeline]
- **`id` (string)**: An identifier for the pipeline.
Pipeline IDs must begin with a letter or underscore and contain only letters, underscores, dashes, hyphens and numbers.
- **`pipeline` (Optional, { description, on_failure, processors, version, deprecated, _meta })**

## client.migration.deprecations [_migration.deprecations]
Expand Down
115 changes: 104 additions & 11 deletions src/api/api/async_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
import { kAcceptedParams } from '../../client'

interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
[kAcceptedParams]: Record<string, { path: string[], body: string[], query: string[] }>
}

const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']

export default class AsyncSearch {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
[kAcceptedParams]: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
this[kAcceptedParams] = {
'async_search.delete': {
path: [
'id'
Expand Down Expand Up @@ -160,7 +161,7 @@ export default class AsyncSearch {
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this.acceptedParams['async_search.delete']
} = this[kAcceptedParams]['async_search.delete']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -190,7 +191,10 @@ export default class AsyncSearch {
name: 'async_search.delete',
pathParts: {
id: params.id
}
},
acceptedParams: [
'id'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand All @@ -205,7 +209,7 @@ export default class AsyncSearch {
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this.acceptedParams['async_search.get']
} = this[kAcceptedParams]['async_search.get']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -235,7 +239,13 @@ export default class AsyncSearch {
name: 'async_search.get',
pathParts: {
id: params.id
}
},
acceptedParams: [
'id',
'keep_alive',
'typed_keys',
'wait_for_completion_timeout'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand All @@ -250,7 +260,7 @@ export default class AsyncSearch {
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this.acceptedParams['async_search.status']
} = this[kAcceptedParams]['async_search.status']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -280,7 +290,11 @@ export default class AsyncSearch {
name: 'async_search.status',
pathParts: {
id: params.id
}
},
acceptedParams: [
'id',
'keep_alive'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand All @@ -297,7 +311,7 @@ export default class AsyncSearch {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['async_search.submit']
} = this[kAcceptedParams]['async_search.submit']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -349,7 +363,86 @@ export default class AsyncSearch {
name: 'async_search.submit',
pathParts: {
index: params.index
}
},
acceptedParams: [
'index',
'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',
'wait_for_completion_timeout',
'keep_alive',
'keep_on_completion',
'allow_no_indices',
'allow_partial_search_results',
'analyzer',
'analyze_wildcard',
'batched_reduce_size',
'ccs_minimize_roundtrips',
'default_operator',
'df',
'docvalue_fields',
'expand_wildcards',
'explain',
'ignore_throttled',
'ignore_unavailable',
'lenient',
'max_concurrent_shard_requests',
'preference',
'request_cache',
'routing',
'search_type',
'stats',
'stored_fields',
'suggest_field',
'suggest_mode',
'suggest_size',
'suggest_text',
'terminate_after',
'timeout',
'track_total_hits',
'track_scores',
'typed_keys',
'rest_total_hits_as_int',
'version',
'_source',
'_source_excludes',
'_source_includes',
'seq_no_primary_term',
'q',
'size',
'from',
'sort'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand Down
41 changes: 30 additions & 11 deletions src/api/api/autoscaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
import { kAcceptedParams } from '../../client'

interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
[kAcceptedParams]: Record<string, { path: string[], body: string[], query: string[] }>
}

const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']

export default class Autoscaling {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
[kAcceptedParams]: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
this[kAcceptedParams] = {
'autoscaling.delete_autoscaling_policy': {
path: [
'name'
Expand Down Expand Up @@ -86,7 +87,7 @@ export default class Autoscaling {
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.delete_autoscaling_policy']
} = this[kAcceptedParams]['autoscaling.delete_autoscaling_policy']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -116,7 +117,12 @@ export default class Autoscaling {
name: 'autoscaling.delete_autoscaling_policy',
pathParts: {
name: params.name
}
},
acceptedParams: [
'name',
'master_timeout',
'timeout'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand All @@ -131,7 +137,7 @@ export default class Autoscaling {
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.get_autoscaling_capacity']
} = this[kAcceptedParams]['autoscaling.get_autoscaling_capacity']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -159,7 +165,10 @@ export default class Autoscaling {
const method = 'GET'
const path = '/_autoscaling/capacity'
const meta: TransportRequestMetadata = {
name: 'autoscaling.get_autoscaling_capacity'
name: 'autoscaling.get_autoscaling_capacity',
acceptedParams: [
'master_timeout'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand All @@ -174,7 +183,7 @@ export default class Autoscaling {
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.get_autoscaling_policy']
} = this[kAcceptedParams]['autoscaling.get_autoscaling_policy']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -204,7 +213,11 @@ export default class Autoscaling {
name: 'autoscaling.get_autoscaling_policy',
pathParts: {
name: params.name
}
},
acceptedParams: [
'name',
'master_timeout'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand All @@ -221,7 +234,7 @@ export default class Autoscaling {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['autoscaling.put_autoscaling_policy']
} = this[kAcceptedParams]['autoscaling.put_autoscaling_policy']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
Expand Down Expand Up @@ -251,7 +264,13 @@ export default class Autoscaling {
name: 'autoscaling.put_autoscaling_policy',
pathParts: {
name: params.name
}
},
acceptedParams: [
'name',
'policy',
'master_timeout',
'timeout'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Expand Down
18 changes: 17 additions & 1 deletion src/api/api/bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,23 @@ export default async function BulkApi<TDocument = unknown, TPartialDocument = un
name: 'bulk',
pathParts: {
index: params.index
}
},
acceptedParams: [
'index',
'operations',
'include_source_on_error',
'list_executed_pipelines',
'pipeline',
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'timeout',
'wait_for_active_shards',
'require_alias',
'require_data_stream'
]
}
return await this.transport.request({ path, method, querystring, bulkBody: body, meta }, options)
}
4 changes: 3 additions & 1 deletion src/api/api/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export default async function CapabilitiesApi (this: That, params?: T.TODO, opti
const method = 'GET'
const path = '/_capabilities'
const meta: TransportRequestMetadata = {
name: 'capabilities'
name: 'capabilities',
acceptedParams: [
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
Loading
Loading