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
125 changes: 85 additions & 40 deletions docs/reference/api-reference.md

Large diffs are not rendered by default.

117 changes: 106 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 @@ -121,6 +122,7 @@ export default class AsyncSearch {
'lenient',
'max_concurrent_shard_requests',
'preference',
'project_routing',
'request_cache',
'routing',
'search_type',
Expand Down Expand Up @@ -160,7 +162,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 +192,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 +210,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 +240,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 +261,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 +291,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 +312,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 +364,87 @@ 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',
'project_routing',
'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