Auto-generated API code (#2657)

This commit is contained in:
Elastic Machine
2025-03-21 19:34:10 +02:00
committed by GitHub
parent 8ca68a4178
commit d5552dca2a
88 changed files with 28209 additions and 1534 deletions

16115
docs/reference.asciidoc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -35,12 +35,133 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: 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[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'async_search.delete': {
path: [
'id'
],
body: [],
query: []
},
'async_search.get': {
path: [
'id'
],
body: [],
query: [
'keep_alive',
'typed_keys',
'wait_for_completion_timeout'
]
},
'async_search.status': {
path: [
'id'
],
body: [],
query: [
'keep_alive'
]
},
'async_search.submit': {
path: [
'index'
],
body: [
'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'
],
query: [
'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'
]
}
}
}
/**
@ -51,7 +172,10 @@ export default class AsyncSearch {
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchDeleteResponse, unknown>>
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchDeleteResponse>
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['async_search.delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +217,10 @@ export default class AsyncSearch {
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchGetResponse<TDocument, TAggregations>, unknown>>
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchGetResponse<TDocument, TAggregations>>
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['async_search.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +262,10 @@ export default class AsyncSearch {
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchStatusResponse, unknown>>
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchStatusResponse>
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['async_search.status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -177,8 +307,12 @@ export default class AsyncSearch {
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchSubmitResponse<TDocument, TAggregations>, unknown>>
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchSubmitResponse<TDocument, TAggregations>>
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
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 {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['async_search.submit']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -205,8 +339,14 @@ export default class AsyncSearch {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,59 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: 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[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'autoscaling.delete_autoscaling_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'autoscaling.get_autoscaling_capacity': {
path: [],
body: [],
query: [
'master_timeout'
]
},
'autoscaling.get_autoscaling_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'autoscaling.put_autoscaling_policy': {
path: [
'name'
],
body: [
'policy'
],
query: [
'master_timeout',
'timeout'
]
}
}
}
/**
@ -51,7 +98,10 @@ export default class Autoscaling {
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingDeleteAutoscalingPolicyResponse, unknown>>
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingDeleteAutoscalingPolicyResponse>
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.delete_autoscaling_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +143,10 @@ export default class Autoscaling {
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingGetAutoscalingCapacityResponse, unknown>>
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<T.AutoscalingGetAutoscalingCapacityResponse>
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.get_autoscaling_capacity']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -133,7 +186,10 @@ export default class Autoscaling {
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingGetAutoscalingPolicyResponse, unknown>>
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingGetAutoscalingPolicyResponse>
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.get_autoscaling_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -175,8 +231,12 @@ export default class Autoscaling {
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingPutAutoscalingPolicyResponse, unknown>>
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingPutAutoscalingPolicyResponse>
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['policy']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['autoscaling.put_autoscaling_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -188,8 +248,14 @@ export default class Autoscaling {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,18 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
capabilities: {
path: [],
body: [],
query: []
}
}
/**
* Checks if the specified combination of method, API, parameters, and arbitrary capabilities are supported
@ -45,7 +56,10 @@ export default async function CapabilitiesApi (this: That, params?: T.TODO, opti
export default async function CapabilitiesApi (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
export default async function CapabilitiesApi (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
export default async function CapabilitiesApi (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = acceptedParams.capabilities
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,336 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Cat {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'cat.aliases': {
path: [
'name'
],
body: [],
query: [
'h',
's',
'expand_wildcards',
'master_timeout'
]
},
'cat.allocation': {
path: [
'node_id'
],
body: [],
query: [
'bytes',
'h',
's',
'local',
'master_timeout'
]
},
'cat.component_templates': {
path: [
'name'
],
body: [],
query: [
'h',
's',
'local',
'master_timeout'
]
},
'cat.count': {
path: [
'index'
],
body: [],
query: [
'h',
's'
]
},
'cat.fielddata': {
path: [
'fields'
],
body: [],
query: [
'bytes',
'fields',
'h',
's'
]
},
'cat.health': {
path: [],
body: [],
query: [
'time',
'ts',
'h',
's'
]
},
'cat.help': {
path: [],
body: [],
query: []
},
'cat.indices': {
path: [
'index'
],
body: [],
query: [
'bytes',
'expand_wildcards',
'health',
'include_unloaded_segments',
'pri',
'time',
'master_timeout',
'h',
's'
]
},
'cat.master': {
path: [],
body: [],
query: [
'h',
's',
'local',
'master_timeout'
]
},
'cat.ml_data_frame_analytics': {
path: [
'id'
],
body: [],
query: [
'allow_no_match',
'bytes',
'h',
's',
'time'
]
},
'cat.ml_datafeeds': {
path: [
'datafeed_id'
],
body: [],
query: [
'allow_no_match',
'h',
's',
'time'
]
},
'cat.ml_jobs': {
path: [
'job_id'
],
body: [],
query: [
'allow_no_match',
'bytes',
'h',
's',
'time'
]
},
'cat.ml_trained_models': {
path: [
'model_id'
],
body: [],
query: [
'allow_no_match',
'bytes',
'h',
's',
'from',
'size',
'time'
]
},
'cat.nodeattrs': {
path: [],
body: [],
query: [
'h',
's',
'local',
'master_timeout'
]
},
'cat.nodes': {
path: [],
body: [],
query: [
'bytes',
'full_id',
'include_unloaded_segments',
'h',
's',
'master_timeout',
'time'
]
},
'cat.pending_tasks': {
path: [],
body: [],
query: [
'h',
's',
'local',
'master_timeout',
'time'
]
},
'cat.plugins': {
path: [],
body: [],
query: [
'h',
's',
'include_bootstrap',
'local',
'master_timeout'
]
},
'cat.recovery': {
path: [
'index'
],
body: [],
query: [
'active_only',
'bytes',
'detailed',
'index',
'h',
's',
'time'
]
},
'cat.repositories': {
path: [],
body: [],
query: [
'h',
's',
'local',
'master_timeout'
]
},
'cat.segments': {
path: [
'index'
],
body: [],
query: [
'bytes',
'h',
's',
'local',
'master_timeout'
]
},
'cat.shards': {
path: [
'index'
],
body: [],
query: [
'bytes',
'h',
's',
'master_timeout',
'time'
]
},
'cat.snapshots': {
path: [
'repository'
],
body: [],
query: [
'ignore_unavailable',
'h',
's',
'master_timeout',
'time'
]
},
'cat.tasks': {
path: [],
body: [],
query: [
'actions',
'detailed',
'nodes',
'parent_task_id',
'h',
's',
'time',
'timeout',
'wait_for_completion'
]
},
'cat.templates': {
path: [
'name'
],
body: [],
query: [
'h',
's',
'local',
'master_timeout'
]
},
'cat.thread_pool': {
path: [
'thread_pool_patterns'
],
body: [],
query: [
'h',
's',
'time',
'local',
'master_timeout'
]
},
'cat.transforms': {
path: [
'transform_id'
],
body: [],
query: [
'allow_no_match',
'from',
'h',
's',
'time',
'size'
]
}
}
}
/**
@ -51,7 +375,10 @@ export default class Cat {
async aliases (this: That, params?: T.CatAliasesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatAliasesResponse, unknown>>
async aliases (this: That, params?: T.CatAliasesRequest, options?: TransportRequestOptions): Promise<T.CatAliasesResponse>
async aliases (this: That, params?: T.CatAliasesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['cat.aliases']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -101,7 +428,10 @@ export default class Cat {
async allocation (this: That, params?: T.CatAllocationRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatAllocationResponse, unknown>>
async allocation (this: That, params?: T.CatAllocationRequest, options?: TransportRequestOptions): Promise<T.CatAllocationResponse>
async allocation (this: That, params?: T.CatAllocationRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['cat.allocation']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -151,7 +481,10 @@ export default class Cat {
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatComponentTemplatesResponse, unknown>>
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest, options?: TransportRequestOptions): Promise<T.CatComponentTemplatesResponse>
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['cat.component_templates']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -201,7 +534,10 @@ export default class Cat {
async count (this: That, params?: T.CatCountRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatCountResponse, unknown>>
async count (this: That, params?: T.CatCountRequest, options?: TransportRequestOptions): Promise<T.CatCountResponse>
async count (this: That, params?: T.CatCountRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['cat.count']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -251,7 +587,10 @@ export default class Cat {
async fielddata (this: That, params?: T.CatFielddataRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatFielddataResponse, unknown>>
async fielddata (this: That, params?: T.CatFielddataRequest, options?: TransportRequestOptions): Promise<T.CatFielddataResponse>
async fielddata (this: That, params?: T.CatFielddataRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['fields']
const {
path: acceptedPath
} = this.acceptedParams['cat.fielddata']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -301,7 +640,10 @@ export default class Cat {
async health (this: That, params?: T.CatHealthRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatHealthResponse, unknown>>
async health (this: That, params?: T.CatHealthRequest, options?: TransportRequestOptions): Promise<T.CatHealthResponse>
async health (this: That, params?: T.CatHealthRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.health']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -341,7 +683,10 @@ export default class Cat {
async help (this: That, params?: T.CatHelpRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatHelpResponse, unknown>>
async help (this: That, params?: T.CatHelpRequest, options?: TransportRequestOptions): Promise<T.CatHelpResponse>
async help (this: That, params?: T.CatHelpRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.help']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -381,7 +726,10 @@ export default class Cat {
async indices (this: That, params?: T.CatIndicesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatIndicesResponse, unknown>>
async indices (this: That, params?: T.CatIndicesRequest, options?: TransportRequestOptions): Promise<T.CatIndicesResponse>
async indices (this: That, params?: T.CatIndicesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['cat.indices']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -431,7 +779,10 @@ export default class Cat {
async master (this: That, params?: T.CatMasterRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatMasterResponse, unknown>>
async master (this: That, params?: T.CatMasterRequest, options?: TransportRequestOptions): Promise<T.CatMasterResponse>
async master (this: That, params?: T.CatMasterRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.master']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -471,7 +822,10 @@ export default class Cat {
async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatMlDataFrameAnalyticsResponse, unknown>>
async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise<T.CatMlDataFrameAnalyticsResponse>
async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['cat.ml_data_frame_analytics']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -521,7 +875,10 @@ export default class Cat {
async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatMlDatafeedsResponse, unknown>>
async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest, options?: TransportRequestOptions): Promise<T.CatMlDatafeedsResponse>
async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['datafeed_id']
const {
path: acceptedPath
} = this.acceptedParams['cat.ml_datafeeds']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -571,7 +928,10 @@ export default class Cat {
async mlJobs (this: That, params?: T.CatMlJobsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatMlJobsResponse, unknown>>
async mlJobs (this: That, params?: T.CatMlJobsRequest, options?: TransportRequestOptions): Promise<T.CatMlJobsResponse>
async mlJobs (this: That, params?: T.CatMlJobsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['job_id']
const {
path: acceptedPath
} = this.acceptedParams['cat.ml_jobs']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -621,7 +981,10 @@ export default class Cat {
async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatMlTrainedModelsResponse, unknown>>
async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest, options?: TransportRequestOptions): Promise<T.CatMlTrainedModelsResponse>
async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['model_id']
const {
path: acceptedPath
} = this.acceptedParams['cat.ml_trained_models']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -671,7 +1034,10 @@ export default class Cat {
async nodeattrs (this: That, params?: T.CatNodeattrsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatNodeattrsResponse, unknown>>
async nodeattrs (this: That, params?: T.CatNodeattrsRequest, options?: TransportRequestOptions): Promise<T.CatNodeattrsResponse>
async nodeattrs (this: That, params?: T.CatNodeattrsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.nodeattrs']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -711,7 +1077,10 @@ export default class Cat {
async nodes (this: That, params?: T.CatNodesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatNodesResponse, unknown>>
async nodes (this: That, params?: T.CatNodesRequest, options?: TransportRequestOptions): Promise<T.CatNodesResponse>
async nodes (this: That, params?: T.CatNodesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.nodes']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -751,7 +1120,10 @@ export default class Cat {
async pendingTasks (this: That, params?: T.CatPendingTasksRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatPendingTasksResponse, unknown>>
async pendingTasks (this: That, params?: T.CatPendingTasksRequest, options?: TransportRequestOptions): Promise<T.CatPendingTasksResponse>
async pendingTasks (this: That, params?: T.CatPendingTasksRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.pending_tasks']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -791,7 +1163,10 @@ export default class Cat {
async plugins (this: That, params?: T.CatPluginsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatPluginsResponse, unknown>>
async plugins (this: That, params?: T.CatPluginsRequest, options?: TransportRequestOptions): Promise<T.CatPluginsResponse>
async plugins (this: That, params?: T.CatPluginsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.plugins']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -831,7 +1206,10 @@ export default class Cat {
async recovery (this: That, params?: T.CatRecoveryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatRecoveryResponse, unknown>>
async recovery (this: That, params?: T.CatRecoveryRequest, options?: TransportRequestOptions): Promise<T.CatRecoveryResponse>
async recovery (this: That, params?: T.CatRecoveryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['cat.recovery']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -881,7 +1259,10 @@ export default class Cat {
async repositories (this: That, params?: T.CatRepositoriesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatRepositoriesResponse, unknown>>
async repositories (this: That, params?: T.CatRepositoriesRequest, options?: TransportRequestOptions): Promise<T.CatRepositoriesResponse>
async repositories (this: That, params?: T.CatRepositoriesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.repositories']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -921,7 +1302,10 @@ export default class Cat {
async segments (this: That, params?: T.CatSegmentsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatSegmentsResponse, unknown>>
async segments (this: That, params?: T.CatSegmentsRequest, options?: TransportRequestOptions): Promise<T.CatSegmentsResponse>
async segments (this: That, params?: T.CatSegmentsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['cat.segments']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -971,7 +1355,10 @@ export default class Cat {
async shards (this: That, params?: T.CatShardsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatShardsResponse, unknown>>
async shards (this: That, params?: T.CatShardsRequest, options?: TransportRequestOptions): Promise<T.CatShardsResponse>
async shards (this: That, params?: T.CatShardsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['cat.shards']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -1021,7 +1408,10 @@ export default class Cat {
async snapshots (this: That, params?: T.CatSnapshotsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatSnapshotsResponse, unknown>>
async snapshots (this: That, params?: T.CatSnapshotsRequest, options?: TransportRequestOptions): Promise<T.CatSnapshotsResponse>
async snapshots (this: That, params?: T.CatSnapshotsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository']
const {
path: acceptedPath
} = this.acceptedParams['cat.snapshots']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -1071,7 +1461,10 @@ export default class Cat {
async tasks (this: That, params?: T.CatTasksRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatTasksResponse, unknown>>
async tasks (this: That, params?: T.CatTasksRequest, options?: TransportRequestOptions): Promise<T.CatTasksResponse>
async tasks (this: That, params?: T.CatTasksRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cat.tasks']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -1111,7 +1504,10 @@ export default class Cat {
async templates (this: That, params?: T.CatTemplatesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatTemplatesResponse, unknown>>
async templates (this: That, params?: T.CatTemplatesRequest, options?: TransportRequestOptions): Promise<T.CatTemplatesResponse>
async templates (this: That, params?: T.CatTemplatesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['cat.templates']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -1161,7 +1557,10 @@ export default class Cat {
async threadPool (this: That, params?: T.CatThreadPoolRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatThreadPoolResponse, unknown>>
async threadPool (this: That, params?: T.CatThreadPoolRequest, options?: TransportRequestOptions): Promise<T.CatThreadPoolResponse>
async threadPool (this: That, params?: T.CatThreadPoolRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['thread_pool_patterns']
const {
path: acceptedPath
} = this.acceptedParams['cat.thread_pool']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -1211,7 +1610,10 @@ export default class Cat {
async transforms (this: That, params?: T.CatTransformsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatTransformsResponse, unknown>>
async transforms (this: That, params?: T.CatTransformsRequest, options?: TransportRequestOptions): Promise<T.CatTransformsResponse>
async transforms (this: That, params?: T.CatTransformsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['cat.transforms']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,185 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Ccr {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'ccr.delete_auto_follow_pattern': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'ccr.follow': {
path: [
'index'
],
body: [
'data_stream_name',
'leader_index',
'max_outstanding_read_requests',
'max_outstanding_write_requests',
'max_read_request_operation_count',
'max_read_request_size',
'max_retry_delay',
'max_write_buffer_count',
'max_write_buffer_size',
'max_write_request_operation_count',
'max_write_request_size',
'read_poll_timeout',
'remote_cluster',
'settings'
],
query: [
'master_timeout',
'wait_for_active_shards'
]
},
'ccr.follow_info': {
path: [
'index'
],
body: [],
query: [
'master_timeout'
]
},
'ccr.follow_stats': {
path: [
'index'
],
body: [],
query: [
'timeout'
]
},
'ccr.forget_follower': {
path: [
'index'
],
body: [
'follower_cluster',
'follower_index',
'follower_index_uuid',
'leader_remote_cluster'
],
query: [
'timeout'
]
},
'ccr.get_auto_follow_pattern': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'ccr.pause_auto_follow_pattern': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'ccr.pause_follow': {
path: [
'index'
],
body: [],
query: [
'master_timeout'
]
},
'ccr.put_auto_follow_pattern': {
path: [
'name'
],
body: [
'remote_cluster',
'follow_index_pattern',
'leader_index_patterns',
'leader_index_exclusion_patterns',
'max_outstanding_read_requests',
'settings',
'max_outstanding_write_requests',
'read_poll_timeout',
'max_read_request_operation_count',
'max_read_request_size',
'max_retry_delay',
'max_write_buffer_count',
'max_write_buffer_size',
'max_write_request_operation_count',
'max_write_request_size'
],
query: [
'master_timeout'
]
},
'ccr.resume_auto_follow_pattern': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'ccr.resume_follow': {
path: [
'index'
],
body: [
'max_outstanding_read_requests',
'max_outstanding_write_requests',
'max_read_request_operation_count',
'max_read_request_size',
'max_retry_delay',
'max_write_buffer_count',
'max_write_buffer_size',
'max_write_request_operation_count',
'max_write_request_size',
'read_poll_timeout'
],
query: [
'master_timeout'
]
},
'ccr.stats': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ccr.unfollow': {
path: [
'index'
],
body: [],
query: [
'master_timeout'
]
}
}
}
/**
@ -51,7 +224,10 @@ export default class Ccr {
async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrDeleteAutoFollowPatternResponse, unknown>>
async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<T.CcrDeleteAutoFollowPatternResponse>
async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['ccr.delete_auto_follow_pattern']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,8 +269,12 @@ export default class Ccr {
async follow (this: That, params: T.CcrFollowRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrFollowResponse, unknown>>
async follow (this: That, params: T.CcrFollowRequest, options?: TransportRequestOptions): Promise<T.CcrFollowResponse>
async follow (this: That, params: T.CcrFollowRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['data_stream_name', 'leader_index', 'max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout', 'remote_cluster', 'settings']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ccr.follow']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -116,8 +296,14 @@ export default class Ccr {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -140,7 +326,10 @@ export default class Ccr {
async followInfo (this: That, params: T.CcrFollowInfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrFollowInfoResponse, unknown>>
async followInfo (this: That, params: T.CcrFollowInfoRequest, options?: TransportRequestOptions): Promise<T.CcrFollowInfoResponse>
async followInfo (this: That, params: T.CcrFollowInfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ccr.follow_info']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -182,7 +371,10 @@ export default class Ccr {
async followStats (this: That, params: T.CcrFollowStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrFollowStatsResponse, unknown>>
async followStats (this: That, params: T.CcrFollowStatsRequest, options?: TransportRequestOptions): Promise<T.CcrFollowStatsResponse>
async followStats (this: That, params: T.CcrFollowStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ccr.follow_stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -224,8 +416,12 @@ export default class Ccr {
async forgetFollower (this: That, params: T.CcrForgetFollowerRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrForgetFollowerResponse, unknown>>
async forgetFollower (this: That, params: T.CcrForgetFollowerRequest, options?: TransportRequestOptions): Promise<T.CcrForgetFollowerResponse>
async forgetFollower (this: That, params: T.CcrForgetFollowerRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['follower_cluster', 'follower_index', 'follower_index_uuid', 'leader_remote_cluster']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ccr.forget_follower']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -247,8 +443,14 @@ export default class Ccr {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -271,7 +473,10 @@ export default class Ccr {
async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrGetAutoFollowPatternResponse, unknown>>
async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<T.CcrGetAutoFollowPatternResponse>
async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['ccr.get_auto_follow_pattern']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -321,7 +526,10 @@ export default class Ccr {
async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrPauseAutoFollowPatternResponse, unknown>>
async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<T.CcrPauseAutoFollowPatternResponse>
async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['ccr.pause_auto_follow_pattern']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -363,7 +571,10 @@ export default class Ccr {
async pauseFollow (this: That, params: T.CcrPauseFollowRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrPauseFollowResponse, unknown>>
async pauseFollow (this: That, params: T.CcrPauseFollowRequest, options?: TransportRequestOptions): Promise<T.CcrPauseFollowResponse>
async pauseFollow (this: That, params: T.CcrPauseFollowRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ccr.pause_follow']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -405,8 +616,12 @@ export default class Ccr {
async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrPutAutoFollowPatternResponse, unknown>>
async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<T.CcrPutAutoFollowPatternResponse>
async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['remote_cluster', 'follow_index_pattern', 'leader_index_patterns', 'leader_index_exclusion_patterns', 'max_outstanding_read_requests', 'settings', 'max_outstanding_write_requests', 'read_poll_timeout', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ccr.put_auto_follow_pattern']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -428,8 +643,14 @@ export default class Ccr {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -452,7 +673,10 @@ export default class Ccr {
async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrResumeAutoFollowPatternResponse, unknown>>
async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<T.CcrResumeAutoFollowPatternResponse>
async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['ccr.resume_auto_follow_pattern']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -494,8 +718,12 @@ export default class Ccr {
async resumeFollow (this: That, params: T.CcrResumeFollowRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrResumeFollowResponse, unknown>>
async resumeFollow (this: That, params: T.CcrResumeFollowRequest, options?: TransportRequestOptions): Promise<T.CcrResumeFollowResponse>
async resumeFollow (this: That, params: T.CcrResumeFollowRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ccr.resume_follow']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -517,8 +745,14 @@ export default class Ccr {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -541,7 +775,10 @@ export default class Ccr {
async stats (this: That, params?: T.CcrStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrStatsResponse, unknown>>
async stats (this: That, params?: T.CcrStatsRequest, options?: TransportRequestOptions): Promise<T.CcrStatsResponse>
async stats (this: That, params?: T.CcrStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ccr.stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -581,7 +818,10 @@ export default class Ccr {
async unfollow (this: That, params: T.CcrUnfollowRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CcrUnfollowResponse, unknown>>
async unfollow (this: That, params: T.CcrUnfollowRequest, options?: TransportRequestOptions): Promise<T.CcrUnfollowResponse>
async unfollow (this: That, params: T.CcrUnfollowRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ccr.unfollow']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,22 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
clear_scroll: {
path: [],
body: [
'scroll_id'
],
query: []
}
}
/**
* Clear a scrolling search. Clear the search context and results for a scrolling search.
@ -45,8 +60,12 @@ export default async function ClearScrollApi (this: That, params?: T.ClearScroll
export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClearScrollResponse, unknown>>
export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest, options?: TransportRequestOptions): Promise<T.ClearScrollResponse>
export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['scroll_id']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.clear_scroll
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +88,14 @@ export default async function ClearScrollApi (this: That, params?: T.ClearScroll
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,22 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
close_point_in_time: {
path: [],
body: [
'id'
],
query: []
}
}
/**
* Close a point in time. A point in time must be opened explicitly before being used in search requests. The `keep_alive` parameter tells Elasticsearch how long it should persist. A point in time is automatically closed when the `keep_alive` period has elapsed. However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.
@ -45,8 +60,12 @@ export default async function ClosePointInTimeApi (this: That, params: T.ClosePo
export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClosePointInTimeResponse, unknown>>
export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest, options?: TransportRequestOptions): Promise<T.ClosePointInTimeResponse>
export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['id']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.close_point_in_time
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +87,14 @@ export default async function ClosePointInTimeApi (this: That, params: T.ClosePo
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,202 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Cluster {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'cluster.allocation_explain': {
path: [],
body: [
'current_node',
'index',
'primary',
'shard'
],
query: [
'include_disk_info',
'include_yes_decisions',
'master_timeout'
]
},
'cluster.delete_component_template': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'cluster.delete_voting_config_exclusions': {
path: [],
body: [],
query: [
'master_timeout',
'wait_for_removal'
]
},
'cluster.exists_component_template': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'local'
]
},
'cluster.get_component_template': {
path: [
'name'
],
body: [],
query: [
'flat_settings',
'include_defaults',
'local',
'master_timeout'
]
},
'cluster.get_settings': {
path: [],
body: [],
query: [
'flat_settings',
'include_defaults',
'master_timeout',
'timeout'
]
},
'cluster.health': {
path: [
'index'
],
body: [],
query: [
'expand_wildcards',
'level',
'local',
'master_timeout',
'timeout',
'wait_for_active_shards',
'wait_for_events',
'wait_for_nodes',
'wait_for_no_initializing_shards',
'wait_for_no_relocating_shards',
'wait_for_status'
]
},
'cluster.info': {
path: [
'target'
],
body: [],
query: []
},
'cluster.pending_tasks': {
path: [],
body: [],
query: [
'local',
'master_timeout'
]
},
'cluster.post_voting_config_exclusions': {
path: [],
body: [],
query: [
'node_names',
'node_ids',
'master_timeout',
'timeout'
]
},
'cluster.put_component_template': {
path: [
'name'
],
body: [
'template',
'version',
'_meta',
'deprecated'
],
query: [
'create',
'master_timeout'
]
},
'cluster.put_settings': {
path: [],
body: [
'persistent',
'transient'
],
query: [
'flat_settings',
'master_timeout',
'timeout'
]
},
'cluster.remote_info': {
path: [],
body: [],
query: []
},
'cluster.reroute': {
path: [],
body: [
'commands'
],
query: [
'dry_run',
'explain',
'metric',
'retry_failed',
'master_timeout',
'timeout'
]
},
'cluster.state': {
path: [
'metric',
'index'
],
body: [],
query: [
'allow_no_indices',
'expand_wildcards',
'flat_settings',
'ignore_unavailable',
'local',
'master_timeout',
'wait_for_metadata_version',
'wait_for_timeout'
]
},
'cluster.stats': {
path: [
'node_id'
],
body: [],
query: [
'include_remotes',
'timeout'
]
}
}
}
/**
@ -51,8 +241,12 @@ export default class Cluster {
async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterAllocationExplainResponse, unknown>>
async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest, options?: TransportRequestOptions): Promise<T.ClusterAllocationExplainResponse>
async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['current_node', 'index', 'primary', 'shard']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['cluster.allocation_explain']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -75,8 +269,14 @@ export default class Cluster {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -96,7 +296,10 @@ export default class Cluster {
async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterDeleteComponentTemplateResponse, unknown>>
async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptions): Promise<T.ClusterDeleteComponentTemplateResponse>
async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['cluster.delete_component_template']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -138,7 +341,10 @@ export default class Cluster {
async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterDeleteVotingConfigExclusionsResponse, unknown>>
async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise<T.ClusterDeleteVotingConfigExclusionsResponse>
async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cluster.delete_voting_config_exclusions']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -178,7 +384,10 @@ export default class Cluster {
async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterExistsComponentTemplateResponse, unknown>>
async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptions): Promise<T.ClusterExistsComponentTemplateResponse>
async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['cluster.exists_component_template']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -220,7 +429,10 @@ export default class Cluster {
async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterGetComponentTemplateResponse, unknown>>
async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest, options?: TransportRequestOptions): Promise<T.ClusterGetComponentTemplateResponse>
async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['cluster.get_component_template']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -270,7 +482,10 @@ export default class Cluster {
async getSettings (this: That, params?: T.ClusterGetSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterGetSettingsResponse, unknown>>
async getSettings (this: That, params?: T.ClusterGetSettingsRequest, options?: TransportRequestOptions): Promise<T.ClusterGetSettingsResponse>
async getSettings (this: That, params?: T.ClusterGetSettingsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cluster.get_settings']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -310,7 +525,10 @@ export default class Cluster {
async health (this: That, params?: T.ClusterHealthRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterHealthResponse, unknown>>
async health (this: That, params?: T.ClusterHealthRequest, options?: TransportRequestOptions): Promise<T.ClusterHealthResponse>
async health (this: That, params?: T.ClusterHealthRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['cluster.health']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -360,7 +578,10 @@ export default class Cluster {
async info (this: That, params: T.ClusterInfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterInfoResponse, unknown>>
async info (this: That, params: T.ClusterInfoRequest, options?: TransportRequestOptions): Promise<T.ClusterInfoResponse>
async info (this: That, params: T.ClusterInfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['target']
const {
path: acceptedPath
} = this.acceptedParams['cluster.info']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -402,7 +623,10 @@ export default class Cluster {
async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterPendingTasksResponse, unknown>>
async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest, options?: TransportRequestOptions): Promise<T.ClusterPendingTasksResponse>
async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cluster.pending_tasks']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -442,7 +666,10 @@ export default class Cluster {
async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterPostVotingConfigExclusionsResponse, unknown>>
async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise<T.ClusterPostVotingConfigExclusionsResponse>
async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cluster.post_voting_config_exclusions']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -482,8 +709,12 @@ export default class Cluster {
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterPutComponentTemplateResponse, unknown>>
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise<T.ClusterPutComponentTemplateResponse>
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['template', 'version', '_meta', 'deprecated']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['cluster.put_component_template']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -505,8 +736,14 @@ export default class Cluster {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -529,8 +766,12 @@ export default class Cluster {
async putSettings (this: That, params?: T.ClusterPutSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterPutSettingsResponse, unknown>>
async putSettings (this: That, params?: T.ClusterPutSettingsRequest, options?: TransportRequestOptions): Promise<T.ClusterPutSettingsResponse>
async putSettings (this: That, params?: T.ClusterPutSettingsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['persistent', 'transient']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['cluster.put_settings']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -553,8 +794,14 @@ export default class Cluster {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -574,7 +821,10 @@ export default class Cluster {
async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterRemoteInfoResponse, unknown>>
async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest, options?: TransportRequestOptions): Promise<T.ClusterRemoteInfoResponse>
async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['cluster.remote_info']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -614,8 +864,12 @@ export default class Cluster {
async reroute (this: That, params?: T.ClusterRerouteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterRerouteResponse, unknown>>
async reroute (this: That, params?: T.ClusterRerouteRequest, options?: TransportRequestOptions): Promise<T.ClusterRerouteResponse>
async reroute (this: That, params?: T.ClusterRerouteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['commands']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['cluster.reroute']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -638,8 +892,14 @@ export default class Cluster {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -659,7 +919,10 @@ export default class Cluster {
async state (this: That, params?: T.ClusterStateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterStateResponse, unknown>>
async state (this: That, params?: T.ClusterStateRequest, options?: TransportRequestOptions): Promise<T.ClusterStateResponse>
async state (this: That, params?: T.ClusterStateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['metric', 'index']
const {
path: acceptedPath
} = this.acceptedParams['cluster.state']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -713,7 +976,10 @@ export default class Cluster {
async stats (this: That, params?: T.ClusterStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ClusterStatsResponse, unknown>>
async stats (this: That, params?: T.ClusterStatsRequest, options?: TransportRequestOptions): Promise<T.ClusterStatsResponse>
async stats (this: That, params?: T.ClusterStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['cluster.stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,39 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
count: {
path: [
'index'
],
body: [
'query'
],
query: [
'allow_no_indices',
'analyzer',
'analyze_wildcard',
'default_operator',
'df',
'expand_wildcards',
'ignore_throttled',
'ignore_unavailable',
'lenient',
'min_score',
'preference',
'routing',
'terminate_after',
'q'
]
}
}
/**
* Count search results. Get the number of documents matching a query. The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. The query is optional. When no query is provided, the API uses `match_all` to count all the documents. The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. The operation is broadcast across all shards. For each shard ID group, a replica is chosen and the search is run against it. This means that replicas increase the scalability of the count.
@ -45,8 +77,12 @@ export default async function CountApi (this: That, params?: T.CountRequest, opt
export default async function CountApi (this: That, params?: T.CountRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CountResponse, unknown>>
export default async function CountApi (this: That, params?: T.CountRequest, options?: TransportRequestOptions): Promise<T.CountResponse>
export default async function CountApi (this: That, params?: T.CountRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['query']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.count
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +105,14 @@ export default async function CountApi (this: That, params?: T.CountRequest, opt
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -35,12 +35,46 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class DanglingIndices {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'dangling_indices.delete_dangling_index': {
path: [
'index_uuid'
],
body: [],
query: [
'accept_data_loss',
'master_timeout',
'timeout'
]
},
'dangling_indices.import_dangling_index': {
path: [
'index_uuid'
],
body: [],
query: [
'accept_data_loss',
'master_timeout',
'timeout'
]
},
'dangling_indices.list_dangling_indices': {
path: [],
body: [],
query: []
}
}
}
/**
@ -51,7 +85,10 @@ export default class DanglingIndices {
async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DanglingIndicesDeleteDanglingIndexResponse, unknown>>
async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptions): Promise<T.DanglingIndicesDeleteDanglingIndexResponse>
async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index_uuid']
const {
path: acceptedPath
} = this.acceptedParams['dangling_indices.delete_dangling_index']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +130,10 @@ export default class DanglingIndices {
async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DanglingIndicesImportDanglingIndexResponse, unknown>>
async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions): Promise<T.DanglingIndicesImportDanglingIndexResponse>
async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index_uuid']
const {
path: acceptedPath
} = this.acceptedParams['dangling_indices.import_dangling_index']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +175,10 @@ export default class DanglingIndices {
async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DanglingIndicesListDanglingIndicesResponse, unknown>>
async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions): Promise<T.DanglingIndicesListDanglingIndicesResponse>
async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['dangling_indices.list_dangling_indices']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,30 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
delete: {
path: [
'id',
'index'
],
body: [],
query: [
'if_primary_term',
'if_seq_no',
'refresh',
'routing',
'timeout',
'version',
'version_type',
'wait_for_active_shards'
]
}
}
/**
* Delete a document. Remove a JSON document from the specified index. NOTE: You cannot send deletion requests directly to a data stream. To delete a document in a data stream, you must target the backing index containing the document. **Optimistic concurrency control** Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. **Versioning** Each document indexed is versioned. When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. Every write operation run on a document, deletes included, causes its version to be incremented. The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. The length of time for which a deleted document's version remains available is determined by the `index.gc_deletes` index setting. **Routing** If routing is used during indexing, the routing value also needs to be specified to delete a document. If the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request. For example: ``` DELETE /my-index-000001/_doc/1?routing=shard-1 ``` This request deletes the document with ID 1, but it is routed based on the user. The document is not deleted if the correct routing is not specified. **Distributed** The delete operation gets hashed into a specific shard ID. It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.
@ -45,7 +68,10 @@ export default async function DeleteApi (this: That, params: T.DeleteRequest, op
export default async function DeleteApi (this: That, params: T.DeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DeleteResponse, unknown>>
export default async function DeleteApi (this: That, params: T.DeleteRequest, options?: TransportRequestOptions): Promise<T.DeleteResponse>
export default async function DeleteApi (this: That, params: T.DeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const {
path: acceptedPath
} = acceptedParams.delete
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,22 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
delete_by_query_rethrottle: {
path: [
'task_id'
],
body: [],
query: [
'requests_per_second'
]
}
}
/**
* Throttle a delete by query operation. Change the number of requests per second for a particular delete by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.
@ -45,7 +60,10 @@ export default async function DeleteByQueryRethrottleApi (this: That, params: T.
export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DeleteByQueryRethrottleResponse, unknown>>
export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): Promise<T.DeleteByQueryRethrottleResponse>
export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_id']
const {
path: acceptedPath
} = acceptedParams.delete_by_query_rethrottle
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,23 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
delete_script: {
path: [
'id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
}
}
/**
* Delete a script or search template. Deletes a stored script or search template.
@ -45,7 +61,10 @@ export default async function DeleteScriptApi (this: That, params: T.DeleteScrip
export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DeleteScriptResponse, unknown>>
export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest, options?: TransportRequestOptions): Promise<T.DeleteScriptResponse>
export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = acceptedParams.delete_script
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,69 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Enrich {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'enrich.delete_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'enrich.execute_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'wait_for_completion'
]
},
'enrich.get_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'enrich.put_policy': {
path: [
'name'
],
body: [
'geo_match',
'match',
'range'
],
query: [
'master_timeout'
]
},
'enrich.stats': {
path: [],
body: [],
query: [
'master_timeout'
]
}
}
}
/**
@ -51,7 +108,10 @@ export default class Enrich {
async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EnrichDeletePolicyResponse, unknown>>
async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest, options?: TransportRequestOptions): Promise<T.EnrichDeletePolicyResponse>
async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['enrich.delete_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +153,10 @@ export default class Enrich {
async executePolicy (this: That, params: T.EnrichExecutePolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EnrichExecutePolicyResponse, unknown>>
async executePolicy (this: That, params: T.EnrichExecutePolicyRequest, options?: TransportRequestOptions): Promise<T.EnrichExecutePolicyResponse>
async executePolicy (this: That, params: T.EnrichExecutePolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['enrich.execute_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +198,10 @@ export default class Enrich {
async getPolicy (this: That, params?: T.EnrichGetPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EnrichGetPolicyResponse, unknown>>
async getPolicy (this: That, params?: T.EnrichGetPolicyRequest, options?: TransportRequestOptions): Promise<T.EnrichGetPolicyResponse>
async getPolicy (this: That, params?: T.EnrichGetPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['enrich.get_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -185,8 +251,12 @@ export default class Enrich {
async putPolicy (this: That, params: T.EnrichPutPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EnrichPutPolicyResponse, unknown>>
async putPolicy (this: That, params: T.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise<T.EnrichPutPolicyResponse>
async putPolicy (this: That, params: T.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['geo_match', 'match', 'range']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['enrich.put_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -208,8 +278,14 @@ export default class Enrich {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -232,7 +308,10 @@ export default class Enrich {
async stats (this: That, params?: T.EnrichStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EnrichStatsResponse, unknown>>
async stats (this: That, params?: T.EnrichStatsRequest, options?: TransportRequestOptions): Promise<T.EnrichStatsResponse>
async stats (this: That, params?: T.EnrichStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['enrich.stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,79 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Eql {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'eql.delete': {
path: [
'id'
],
body: [],
query: []
},
'eql.get': {
path: [
'id'
],
body: [],
query: [
'keep_alive',
'wait_for_completion_timeout'
]
},
'eql.get_status': {
path: [
'id'
],
body: [],
query: []
},
'eql.search': {
path: [
'index'
],
body: [
'query',
'case_sensitive',
'event_category_field',
'tiebreaker_field',
'timestamp_field',
'fetch_size',
'filter',
'keep_alive',
'keep_on_completion',
'wait_for_completion_timeout',
'allow_partial_search_results',
'allow_partial_sequence_results',
'size',
'fields',
'result_position',
'runtime_mappings',
'max_samples_per_key'
],
query: [
'allow_no_indices',
'allow_partial_search_results',
'allow_partial_sequence_results',
'expand_wildcards',
'ignore_unavailable',
'keep_alive',
'keep_on_completion',
'wait_for_completion_timeout'
]
}
}
}
/**
@ -51,7 +118,10 @@ export default class Eql {
async delete (this: That, params: T.EqlDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EqlDeleteResponse, unknown>>
async delete (this: That, params: T.EqlDeleteRequest, options?: TransportRequestOptions): Promise<T.EqlDeleteResponse>
async delete (this: That, params: T.EqlDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['eql.delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +163,10 @@ export default class Eql {
async get<TEvent = unknown> (this: That, params: T.EqlGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EqlGetResponse<TEvent>, unknown>>
async get<TEvent = unknown> (this: That, params: T.EqlGetRequest, options?: TransportRequestOptions): Promise<T.EqlGetResponse<TEvent>>
async get<TEvent = unknown> (this: That, params: T.EqlGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['eql.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +208,10 @@ export default class Eql {
async getStatus (this: That, params: T.EqlGetStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EqlGetStatusResponse, unknown>>
async getStatus (this: That, params: T.EqlGetStatusRequest, options?: TransportRequestOptions): Promise<T.EqlGetStatusResponse>
async getStatus (this: That, params: T.EqlGetStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['eql.get_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -177,8 +253,12 @@ export default class Eql {
async search<TEvent = unknown> (this: That, params: T.EqlSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EqlSearchResponse<TEvent>, unknown>>
async search<TEvent = unknown> (this: That, params: T.EqlSearchRequest, options?: TransportRequestOptions): Promise<T.EqlSearchResponse<TEvent>>
async search<TEvent = unknown> (this: That, params: T.EqlSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'keep_alive', 'keep_on_completion', 'wait_for_completion_timeout', 'allow_partial_search_results', 'allow_partial_sequence_results', 'size', 'fields', 'result_position', 'runtime_mappings', 'max_samples_per_key']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['eql.search']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -200,8 +280,14 @@ export default class Eql {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,88 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Esql {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'esql.async_query': {
path: [],
body: [
'columnar',
'filter',
'locale',
'params',
'profile',
'query',
'tables',
'include_ccs_metadata',
'wait_for_completion_timeout'
],
query: [
'delimiter',
'drop_null_columns',
'format',
'keep_alive',
'keep_on_completion',
'wait_for_completion_timeout'
]
},
'esql.async_query_delete': {
path: [
'id'
],
body: [],
query: []
},
'esql.async_query_get': {
path: [
'id'
],
body: [],
query: [
'drop_null_columns',
'keep_alive',
'wait_for_completion_timeout'
]
},
'esql.async_query_stop': {
path: [
'id'
],
body: [],
query: [
'drop_null_columns'
]
},
'esql.query': {
path: [],
body: [
'columnar',
'filter',
'locale',
'params',
'profile',
'query',
'tables',
'include_ccs_metadata'
],
query: [
'format',
'delimiter',
'drop_null_columns'
]
}
}
}
/**
@ -51,8 +127,12 @@ export default class Esql {
async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EsqlAsyncQueryResponse, unknown>>
async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptions): Promise<T.EsqlAsyncQueryResponse>
async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables', 'include_ccs_metadata']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['esql.async_query']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -74,8 +154,14 @@ export default class Esql {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -95,7 +181,10 @@ export default class Esql {
async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EsqlAsyncQueryDeleteResponse, unknown>>
async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptions): Promise<T.EsqlAsyncQueryDeleteResponse>
async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['esql.async_query_delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -137,7 +226,10 @@ export default class Esql {
async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EsqlAsyncQueryGetResponse, unknown>>
async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptions): Promise<T.EsqlAsyncQueryGetResponse>
async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['esql.async_query_get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -173,13 +265,16 @@ export default class Esql {
/**
* Stop async ES|QL query. This API interrupts the query execution and returns the results so far. If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-stop-api.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/esql-async-query-stop-api.html | Elasticsearch API documentation}
*/
async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.EsqlAsyncQueryStopResponse>
async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EsqlAsyncQueryStopResponse, unknown>>
async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest, options?: TransportRequestOptions): Promise<T.EsqlAsyncQueryStopResponse>
async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['esql.async_query_stop']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -215,14 +310,18 @@ export default class Esql {
/**
* Run an ES|QL query. Get search results for an ES|QL (Elasticsearch query language) query.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-rest.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/esql-rest.html | Elasticsearch API documentation}
*/
async query (this: That, params: T.EsqlQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.EsqlQueryResponse>
async query (this: That, params: T.EsqlQueryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EsqlQueryResponse, unknown>>
async query (this: That, params: T.EsqlQueryRequest, options?: TransportRequestOptions): Promise<T.EsqlQueryResponse>
async query (this: That, params: T.EsqlQueryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables', 'include_ccs_metadata']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['esql.query']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -244,8 +343,14 @@ export default class Esql {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,32 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
exists: {
path: [
'id',
'index'
],
body: [],
query: [
'preference',
'realtime',
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'stored_fields',
'version',
'version_type'
]
}
}
/**
* Check a document. Verify that a document exists. For example, check to see if a document with the `_id` 0 exists: ``` HEAD my-index-000001/_doc/0 ``` If the document exists, the API returns a status code of `200 - OK`. If the document doesnt exist, the API returns `404 - Not Found`. **Versioning support** You can use the `version` parameter to check the document only if its current version is equal to the specified one. Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn't disappear immediately, although you won't be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data.
@ -45,7 +70,10 @@ export default async function ExistsApi (this: That, params: T.ExistsRequest, op
export default async function ExistsApi (this: That, params: T.ExistsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ExistsResponse, unknown>>
export default async function ExistsApi (this: That, params: T.ExistsRequest, options?: TransportRequestOptions): Promise<T.ExistsResponse>
export default async function ExistsApi (this: That, params: T.ExistsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const {
path: acceptedPath
} = acceptedParams.exists
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,31 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
exists_source: {
path: [
'id',
'index'
],
body: [],
query: [
'preference',
'realtime',
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'version',
'version_type'
]
}
}
/**
* Check for a document source. Check whether a document source exists in an index. For example: ``` HEAD my-index-000001/_source/1 ``` A document's source is not available if it is disabled in the mapping.
@ -45,7 +69,10 @@ export default async function ExistsSourceApi (this: That, params: T.ExistsSourc
export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ExistsSourceResponse, unknown>>
export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest, options?: TransportRequestOptions): Promise<T.ExistsSourceResponse>
export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const {
path: acceptedPath
} = acceptedParams.exists_source
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,38 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
explain: {
path: [
'id',
'index'
],
body: [
'query'
],
query: [
'analyzer',
'analyze_wildcard',
'default_operator',
'df',
'lenient',
'preference',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'stored_fields',
'q'
]
}
}
/**
* Explain a document match result. Get information about why a specific document matches, or doesn't match, a query. It computes a score explanation for a query and a specific document.
@ -45,8 +76,12 @@ export default async function ExplainApi<TDocument = unknown> (this: That, param
export default async function ExplainApi<TDocument = unknown> (this: That, params: T.ExplainRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ExplainResponse<TDocument>, unknown>>
export default async function ExplainApi<TDocument = unknown> (this: That, params: T.ExplainRequest, options?: TransportRequestOptions): Promise<T.ExplainResponse<TDocument>>
export default async function ExplainApi<TDocument = unknown> (this: That, params: T.ExplainRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const acceptedBody: string[] = ['query']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.explain
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +103,14 @@ export default async function ExplainApi<TDocument = unknown> (this: That, param
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,33 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Features {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'features.get_features': {
path: [],
body: [],
query: [
'master_timeout'
]
},
'features.reset_features': {
path: [],
body: [],
query: [
'master_timeout'
]
}
}
}
/**
@ -51,7 +72,10 @@ export default class Features {
async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FeaturesGetFeaturesResponse, unknown>>
async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest, options?: TransportRequestOptions): Promise<T.FeaturesGetFeaturesResponse>
async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['features.get_features']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -91,7 +115,10 @@ export default class Features {
async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FeaturesResetFeaturesResponse, unknown>>
async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest, options?: TransportRequestOptions): Promise<T.FeaturesResetFeaturesResponse>
async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['features.reset_features']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,35 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
field_caps: {
path: [
'index'
],
body: [
'fields',
'index_filter',
'runtime_mappings'
],
query: [
'allow_no_indices',
'expand_wildcards',
'fields',
'ignore_unavailable',
'include_unmapped',
'filters',
'types',
'include_empty_fields'
]
}
}
/**
* Get the field capabilities. Get information about the capabilities of fields among multiple indices. For data streams, the API returns field capabilities among the streams backing indices. It returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the `keyword` family.
@ -45,8 +73,12 @@ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequ
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FieldCapsResponse, unknown>>
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest, options?: TransportRequestOptions): Promise<T.FieldCapsResponse>
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['fields', 'index_filter', 'runtime_mappings']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.field_caps
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +101,14 @@ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequ
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,159 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Fleet {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'fleet.delete_secret': {
path: [
'id'
],
body: [],
query: []
},
'fleet.get_secret': {
path: [
'id'
],
body: [],
query: []
},
'fleet.global_checkpoints': {
path: [
'index'
],
body: [],
query: [
'wait_for_advance',
'wait_for_index',
'checkpoints',
'timeout'
]
},
'fleet.msearch': {
path: [
'index'
],
body: [
'searches'
],
query: [
'allow_no_indices',
'ccs_minimize_roundtrips',
'expand_wildcards',
'ignore_throttled',
'ignore_unavailable',
'max_concurrent_searches',
'max_concurrent_shard_requests',
'pre_filter_shard_size',
'search_type',
'rest_total_hits_as_int',
'typed_keys',
'wait_for_checkpoints',
'allow_partial_search_results'
]
},
'fleet.post_secret': {
path: [],
body: [],
query: []
},
'fleet.search': {
path: [
'index'
],
body: [
'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'
],
query: [
'allow_no_indices',
'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',
'pre_filter_shard_size',
'request_cache',
'routing',
'scroll',
'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',
'wait_for_checkpoints',
'allow_partial_search_results'
]
}
}
}
/**
@ -50,7 +197,10 @@ export default class Fleet {
async deleteSecret (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async deleteSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async deleteSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['fleet.delete_secret']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -91,7 +241,10 @@ export default class Fleet {
async getSecret (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async getSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async getSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['fleet.get_secret']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -133,7 +286,10 @@ export default class Fleet {
async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FleetGlobalCheckpointsResponse, unknown>>
async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest, options?: TransportRequestOptions): Promise<T.FleetGlobalCheckpointsResponse>
async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['fleet.global_checkpoints']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -175,8 +331,12 @@ export default class Fleet {
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FleetMsearchResponse<TDocument>, unknown>>
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest, options?: TransportRequestOptions): Promise<T.FleetMsearchResponse<TDocument>>
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['searches']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['fleet.msearch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -188,8 +348,14 @@ export default class Fleet {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -218,7 +384,10 @@ export default class Fleet {
async postSecret (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async postSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async postSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['fleet.post_secret']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -257,8 +426,12 @@ export default class Fleet {
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FleetSearchResponse<TDocument>, unknown>>
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest, options?: TransportRequestOptions): Promise<T.FleetSearchResponse<TDocument>>
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
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 {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['fleet.search']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -280,8 +453,14 @@ export default class Fleet {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,33 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
get: {
path: [
'id',
'index'
],
body: [],
query: [
'force_synthetic_source',
'preference',
'realtime',
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'stored_fields',
'version',
'version_type'
]
}
}
/**
* Get a document by its ID. Get a document and its source or stored fields from an index. By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). In the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. To turn off realtime behavior, set the `realtime` parameter to false. **Source filtering** By default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off. You can turn off `_source` retrieval by using the `_source` parameter: ``` GET my-index-000001/_doc/0?_source=false ``` If you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields. This can be helpful with large documents where partial retrieval can save on network overhead Both parameters take a comma separated list of fields or wildcard expressions. For example: ``` GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities ``` If you only want to specify includes, you can use a shorter notation: ``` GET my-index-000001/_doc/0?_source=*.id ``` **Routing** If routing is used during indexing, the routing value also needs to be specified to retrieve a document. For example: ``` GET my-index-000001/_doc/2?routing=user1 ``` This request gets the document with ID 2, but it is routed based on the user. The document is not fetched if the correct routing is not specified. **Distributed** The GET operation is hashed into a specific shard ID. It is then redirected to one of the replicas within that shard ID and returns the result. The replicas are the primary shard and its replicas within that shard ID group. This means that the more replicas you have, the better your GET scaling will be. **Versioning support** You can use the `version` parameter to retrieve the document only if its current version is equal to the specified one. Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn't disappear immediately, although you won't be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data.
@ -45,7 +71,10 @@ export default async function GetApi<TDocument = unknown> (this: That, params: T
export default async function GetApi<TDocument = unknown> (this: That, params: T.GetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GetResponse<TDocument>, unknown>>
export default async function GetApi<TDocument = unknown> (this: That, params: T.GetRequest, options?: TransportRequestOptions): Promise<T.GetResponse<TDocument>>
export default async function GetApi<TDocument = unknown> (this: That, params: T.GetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const {
path: acceptedPath
} = acceptedParams.get
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,22 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
get_script: {
path: [
'id'
],
body: [],
query: [
'master_timeout'
]
}
}
/**
* Get a script or search template. Retrieves a stored script or search template.
@ -45,7 +60,10 @@ export default async function GetScriptApi (this: That, params: T.GetScriptReque
export default async function GetScriptApi (this: That, params: T.GetScriptRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GetScriptResponse, unknown>>
export default async function GetScriptApi (this: That, params: T.GetScriptRequest, options?: TransportRequestOptions): Promise<T.GetScriptResponse>
export default async function GetScriptApi (this: That, params: T.GetScriptRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = acceptedParams.get_script
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,18 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
get_script_context: {
path: [],
body: [],
query: []
}
}
/**
* Get script contexts. Get a list of supported script contexts and their methods.
@ -45,7 +56,10 @@ export default async function GetScriptContextApi (this: That, params?: T.GetScr
export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GetScriptContextResponse, unknown>>
export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest, options?: TransportRequestOptions): Promise<T.GetScriptContextResponse>
export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = acceptedParams.get_script_context
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,18 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
get_script_languages: {
path: [],
body: [],
query: []
}
}
/**
* Get script languages. Get a list of available script types, languages, and contexts.
@ -45,7 +56,10 @@ export default async function GetScriptLanguagesApi (this: That, params?: T.GetS
export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GetScriptLanguagesResponse, unknown>>
export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest, options?: TransportRequestOptions): Promise<T.GetScriptLanguagesResponse>
export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = acceptedParams.get_script_languages
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,32 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
get_source: {
path: [
'id',
'index'
],
body: [],
query: [
'preference',
'realtime',
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'stored_fields',
'version',
'version_type'
]
}
}
/**
* Get a document's source. Get the source of a document. For example: ``` GET my-index-000001/_source/1 ``` You can use the source filtering parameters to control which parts of the `_source` are returned: ``` GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities ```
@ -45,7 +70,10 @@ export default async function GetSourceApi<TDocument = unknown> (this: That, par
export default async function GetSourceApi<TDocument = unknown> (this: That, params: T.GetSourceRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GetSourceResponse<TDocument>, unknown>>
export default async function GetSourceApi<TDocument = unknown> (this: That, params: T.GetSourceRequest, options?: TransportRequestOptions): Promise<T.GetSourceResponse<TDocument>>
export default async function GetSourceApi<TDocument = unknown> (this: That, params: T.GetSourceRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const {
path: acceptedPath
} = acceptedParams.get_source
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,36 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Graph {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'graph.explore': {
path: [
'index'
],
body: [
'connections',
'controls',
'query',
'vertices'
],
query: [
'routing',
'timeout'
]
}
}
}
/**
@ -51,8 +75,12 @@ export default class Graph {
async explore (this: That, params: T.GraphExploreRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GraphExploreResponse, unknown>>
async explore (this: That, params: T.GraphExploreRequest, options?: TransportRequestOptions): Promise<T.GraphExploreResponse>
async explore (this: That, params: T.GraphExploreRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['connections', 'controls', 'query', 'vertices']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['graph.explore']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -74,8 +102,14 @@ export default class Graph {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,24 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
health_report: {
path: [
'feature'
],
body: [],
query: [
'timeout',
'verbose',
'size'
]
}
}
/**
* Get the cluster health. Get a report with the health status of an Elasticsearch cluster. The report contains a list of indicators that compose Elasticsearch functionality. Each indicator has a health status of: green, unknown, yellow or red. The indicator will provide an explanation and metadata describing the reason for its current health status. The clusters status is controlled by the worst indicator status. In the event that an indicators status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. The root cause and remediation steps are encapsulated in a diagnosis. A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.
@ -45,7 +62,10 @@ export default async function HealthReportApi (this: That, params?: T.HealthRepo
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.HealthReportResponse, unknown>>
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest, options?: TransportRequestOptions): Promise<T.HealthReportResponse>
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['feature']
const {
path: acceptedPath
} = acceptedParams.health_report
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,120 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Ilm {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'ilm.delete_lifecycle': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ilm.explain_lifecycle': {
path: [
'index'
],
body: [],
query: [
'only_errors',
'only_managed',
'master_timeout'
]
},
'ilm.get_lifecycle': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ilm.get_status': {
path: [],
body: [],
query: []
},
'ilm.migrate_to_data_tiers': {
path: [],
body: [
'legacy_template_to_delete',
'node_attribute'
],
query: [
'dry_run',
'master_timeout'
]
},
'ilm.move_to_step': {
path: [
'index'
],
body: [
'current_step',
'next_step'
],
query: []
},
'ilm.put_lifecycle': {
path: [
'name'
],
body: [
'policy'
],
query: [
'master_timeout',
'timeout'
]
},
'ilm.remove_policy': {
path: [
'index'
],
body: [],
query: []
},
'ilm.retry': {
path: [
'index'
],
body: [],
query: []
},
'ilm.start': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ilm.stop': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
}
}
}
/**
@ -51,7 +159,10 @@ export default class Ilm {
async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmDeleteLifecycleResponse, unknown>>
async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise<T.IlmDeleteLifecycleResponse>
async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['ilm.delete_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +204,10 @@ export default class Ilm {
async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmExplainLifecycleResponse, unknown>>
async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest, options?: TransportRequestOptions): Promise<T.IlmExplainLifecycleResponse>
async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ilm.explain_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +249,10 @@ export default class Ilm {
async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmGetLifecycleResponse, unknown>>
async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest, options?: TransportRequestOptions): Promise<T.IlmGetLifecycleResponse>
async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['ilm.get_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -185,7 +302,10 @@ export default class Ilm {
async getStatus (this: That, params?: T.IlmGetStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmGetStatusResponse, unknown>>
async getStatus (this: That, params?: T.IlmGetStatusRequest, options?: TransportRequestOptions): Promise<T.IlmGetStatusResponse>
async getStatus (this: That, params?: T.IlmGetStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ilm.get_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -225,8 +345,12 @@ export default class Ilm {
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmMigrateToDataTiersResponse, unknown>>
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest, options?: TransportRequestOptions): Promise<T.IlmMigrateToDataTiersResponse>
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['legacy_template_to_delete', 'node_attribute']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ilm.migrate_to_data_tiers']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -249,8 +373,14 @@ export default class Ilm {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -270,8 +400,12 @@ export default class Ilm {
async moveToStep (this: That, params: T.IlmMoveToStepRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmMoveToStepResponse, unknown>>
async moveToStep (this: That, params: T.IlmMoveToStepRequest, options?: TransportRequestOptions): Promise<T.IlmMoveToStepResponse>
async moveToStep (this: That, params: T.IlmMoveToStepRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['current_step', 'next_step']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ilm.move_to_step']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -293,8 +427,14 @@ export default class Ilm {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -317,8 +457,12 @@ export default class Ilm {
async putLifecycle (this: That, params: T.IlmPutLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmPutLifecycleResponse, unknown>>
async putLifecycle (this: That, params: T.IlmPutLifecycleRequest, options?: TransportRequestOptions): Promise<T.IlmPutLifecycleResponse>
async putLifecycle (this: That, params: T.IlmPutLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['policy']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ilm.put_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -340,8 +484,14 @@ export default class Ilm {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -364,7 +514,10 @@ export default class Ilm {
async removePolicy (this: That, params: T.IlmRemovePolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmRemovePolicyResponse, unknown>>
async removePolicy (this: That, params: T.IlmRemovePolicyRequest, options?: TransportRequestOptions): Promise<T.IlmRemovePolicyResponse>
async removePolicy (this: That, params: T.IlmRemovePolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ilm.remove_policy']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -406,7 +559,10 @@ export default class Ilm {
async retry (this: That, params: T.IlmRetryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmRetryResponse, unknown>>
async retry (this: That, params: T.IlmRetryRequest, options?: TransportRequestOptions): Promise<T.IlmRetryResponse>
async retry (this: That, params: T.IlmRetryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['ilm.retry']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -448,7 +604,10 @@ export default class Ilm {
async start (this: That, params?: T.IlmStartRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmStartResponse, unknown>>
async start (this: That, params?: T.IlmStartRequest, options?: TransportRequestOptions): Promise<T.IlmStartResponse>
async start (this: That, params?: T.IlmStartRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ilm.start']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -488,7 +647,10 @@ export default class Ilm {
async stop (this: That, params?: T.IlmStopRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmStopResponse, unknown>>
async stop (this: That, params?: T.IlmStopRequest, options?: TransportRequestOptions): Promise<T.IlmStopResponse>
async stop (this: That, params?: T.IlmStopRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ilm.stop']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -35,12 +35,275 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Inference {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'inference.chat_completion_unified': {
path: [
'inference_id'
],
body: [
'messages',
'model',
'max_completion_tokens',
'stop',
'temperature',
'tool_choice',
'tools',
'top_p'
],
query: [
'timeout'
]
},
'inference.completion': {
path: [
'inference_id'
],
body: [
'input',
'task_settings'
],
query: [
'timeout'
]
},
'inference.delete': {
path: [
'task_type',
'inference_id'
],
body: [],
query: [
'dry_run',
'force'
]
},
'inference.get': {
path: [
'task_type',
'inference_id'
],
body: [],
query: []
},
'inference.put': {
path: [
'task_type',
'inference_id'
],
body: [
'inference_config'
],
query: []
},
'inference.put_openai': {
path: [
'task_type',
'openai_inference_id'
],
body: [
'chunking_settings',
'service',
'service_settings',
'task_settings'
],
query: []
},
'inference.put_watsonx': {
path: [
'task_type',
'watsonx_inference_id'
],
body: [
'service',
'service_settings'
],
query: []
},
'inference.rerank': {
path: [
'inference_id'
],
body: [
'query',
'input',
'task_settings'
],
query: [
'timeout'
]
},
'inference.sparse_embedding': {
path: [
'inference_id'
],
body: [
'input',
'task_settings'
],
query: [
'timeout'
]
},
'inference.stream_completion': {
path: [
'inference_id'
],
body: [
'input',
'task_settings'
],
query: []
},
'inference.text_embedding': {
path: [
'inference_id'
],
body: [
'input',
'task_settings'
],
query: [
'timeout'
]
},
'inference.update': {
path: [
'inference_id',
'task_type'
],
body: [
'inference_config'
],
query: []
}
}
}
/**
* Perform chat completion inference
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-unified-inference | Elasticsearch API documentation}
*/
async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceChatCompletionUnifiedResponse>
async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceChatCompletionUnifiedResponse, unknown>>
async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptions): Promise<T.InferenceChatCompletionUnifiedResponse>
async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.chat_completion_unified']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
const method = 'POST'
const path = `/_inference/chat_completion/${encodeURIComponent(params.inference_id.toString())}/_stream`
const meta: TransportRequestMetadata = {
name: 'inference.chat_completion_unified',
pathParts: {
inference_id: params.inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform completion inference on the service
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference | Elasticsearch API documentation}
*/
async completion (this: That, params: T.InferenceCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceCompletionResponse>
async completion (this: That, params: T.InferenceCompletionRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceCompletionResponse, unknown>>
async completion (this: That, params: T.InferenceCompletionRequest, options?: TransportRequestOptions): Promise<T.InferenceCompletionResponse>
async completion (this: That, params: T.InferenceCompletionRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.completion']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
const method = 'POST'
const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}`
const meta: TransportRequestMetadata = {
name: 'inference.completion',
pathParts: {
inference_id: params.inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
@ -51,7 +314,10 @@ export default class Inference {
async delete (this: That, params: T.InferenceDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceDeleteResponse, unknown>>
async delete (this: That, params: T.InferenceDeleteRequest, options?: TransportRequestOptions): Promise<T.InferenceDeleteResponse>
async delete (this: That, params: T.InferenceDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const {
path: acceptedPath
} = this.acceptedParams['inference.delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -101,7 +367,10 @@ export default class Inference {
async get (this: That, params?: T.InferenceGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceGetResponse, unknown>>
async get (this: That, params?: T.InferenceGetRequest, options?: TransportRequestOptions): Promise<T.InferenceGetResponse>
async get (this: That, params?: T.InferenceGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const {
path: acceptedPath
} = this.acceptedParams['inference.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -147,61 +416,6 @@ export default class Inference {
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform inference on the service. This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. It returns a response with the results of the tasks. The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API. > info > The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference | Elasticsearch API documentation}
*/
async inference (this: That, params: T.InferenceInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceInferenceResponse>
async inference (this: That, params: T.InferenceInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceInferenceResponse, unknown>>
async inference (this: That, params: T.InferenceInferenceRequest, options?: TransportRequestOptions): Promise<T.InferenceInferenceResponse>
async inference (this: That, params: T.InferenceInferenceRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const acceptedBody: string[] = ['query', 'input', 'task_settings']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
// @ts-expect-error
querystring[key] = params[key]
}
}
let method = ''
let path = ''
if (params.task_type != null && params.inference_id != null) {
method = 'POST'
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`
} else {
method = 'POST'
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`
}
const meta: TransportRequestMetadata = {
name: 'inference.inference',
pathParts: {
task_type: params.task_type,
inference_id: params.inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Create an inference endpoint. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put | Elasticsearch API documentation}
@ -210,8 +424,12 @@ export default class Inference {
async put (this: That, params: T.InferencePutRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferencePutResponse, unknown>>
async put (this: That, params: T.InferencePutRequest, options?: TransportRequestOptions): Promise<T.InferencePutResponse>
async put (this: That, params: T.InferencePutRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const acceptedBody: string[] = ['inference_config']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.put']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -223,8 +441,14 @@ export default class Inference {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -248,15 +472,19 @@ export default class Inference {
}
/**
* Perform streaming inference. Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. This API works only with the completion task type. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-stream-inference | Elasticsearch API documentation}
* Create an OpenAI inference endpoint. Create an inference endpoint to perform an inference task with the `openai` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/infer-service-openai.html | Elasticsearch API documentation}
*/
async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceStreamInferenceResponse>
async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceStreamInferenceResponse, unknown>>
async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptions): Promise<T.InferenceStreamInferenceResponse>
async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['inference_id', 'task_type']
const acceptedBody: string[] = ['input']
async putOpenai (this: That, params: T.InferencePutOpenaiRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferencePutOpenaiResponse>
async putOpenai (this: That, params: T.InferencePutOpenaiRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferencePutOpenaiResponse, unknown>>
async putOpenai (this: That, params: T.InferencePutOpenaiRequest, options?: TransportRequestOptions): Promise<T.InferencePutOpenaiResponse>
async putOpenai (this: That, params: T.InferencePutOpenaiRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.put_openai']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -278,40 +506,43 @@ export default class Inference {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
let method = ''
let path = ''
if (params.task_type != null && params.inference_id != null) {
method = 'POST'
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_stream`
} else {
method = 'POST'
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_stream`
}
const method = 'PUT'
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.openai_inference_id.toString())}`
const meta: TransportRequestMetadata = {
name: 'inference.stream_inference',
name: 'inference.put_openai',
pathParts: {
inference_id: params.inference_id,
task_type: params.task_type
task_type: params.task_type,
openai_inference_id: params.openai_inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform inference on the service using the Unified Schema
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/unified-inference-api.html | Elasticsearch API documentation}
* Create a Watsonx inference endpoint. Create an inference endpoint to perform an inference task with the `watsonxai` service. You need an IBM Cloud Databases for Elasticsearch deployment to use the `watsonxai` inference service. You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-watsonx | Elasticsearch API documentation}
*/
async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceUnifiedInferenceResponse>
async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceUnifiedInferenceResponse, unknown>>
async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptions): Promise<T.InferenceUnifiedInferenceResponse>
async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const acceptedBody: string[] = ['messages', 'model', 'max_completion_tokens', 'stop', 'temperature', 'tool_choice', 'tools', 'top_p']
async putWatsonx (this: That, params: T.InferencePutWatsonxRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferencePutWatsonxResponse>
async putWatsonx (this: That, params: T.InferencePutWatsonxRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferencePutWatsonxResponse, unknown>>
async putWatsonx (this: That, params: T.InferencePutWatsonxRequest, options?: TransportRequestOptions): Promise<T.InferencePutWatsonxResponse>
async putWatsonx (this: That, params: T.InferencePutWatsonxRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.put_watsonx']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -333,24 +564,251 @@ export default class Inference {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
let method = ''
let path = ''
if (params.task_type != null && params.inference_id != null) {
method = 'POST'
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_unified`
} else {
method = 'POST'
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_unified`
}
const method = 'PUT'
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.watsonx_inference_id.toString())}`
const meta: TransportRequestMetadata = {
name: 'inference.unified_inference',
name: 'inference.put_watsonx',
pathParts: {
task_type: params.task_type,
watsonx_inference_id: params.watsonx_inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform rereanking inference on the service
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference | Elasticsearch API documentation}
*/
async rerank (this: That, params: T.InferenceRerankRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceRerankResponse>
async rerank (this: That, params: T.InferenceRerankRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceRerankResponse, unknown>>
async rerank (this: That, params: T.InferenceRerankRequest, options?: TransportRequestOptions): Promise<T.InferenceRerankResponse>
async rerank (this: That, params: T.InferenceRerankRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.rerank']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
const method = 'POST'
const path = `/_inference/rerank/${encodeURIComponent(params.inference_id.toString())}`
const meta: TransportRequestMetadata = {
name: 'inference.rerank',
pathParts: {
inference_id: params.inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform sparse embedding inference on the service
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference | Elasticsearch API documentation}
*/
async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceSparseEmbeddingResponse>
async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceSparseEmbeddingResponse, unknown>>
async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest, options?: TransportRequestOptions): Promise<T.InferenceSparseEmbeddingResponse>
async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.sparse_embedding']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
const method = 'POST'
const path = `/_inference/sparse_embedding/${encodeURIComponent(params.inference_id.toString())}`
const meta: TransportRequestMetadata = {
name: 'inference.sparse_embedding',
pathParts: {
inference_id: params.inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform streaming inference. Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. This API works only with the completion task type. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-stream-inference | Elasticsearch API documentation}
*/
async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceStreamCompletionResponse>
async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceStreamCompletionResponse, unknown>>
async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest, options?: TransportRequestOptions): Promise<T.InferenceStreamCompletionResponse>
async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.stream_completion']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
const method = 'POST'
const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}/_stream`
const meta: TransportRequestMetadata = {
name: 'inference.stream_completion',
pathParts: {
inference_id: params.inference_id
}
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}
/**
* Perform text embedding inference on the service
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference | Elasticsearch API documentation}
*/
async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceTextEmbeddingResponse>
async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceTextEmbeddingResponse, unknown>>
async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest, options?: TransportRequestOptions): Promise<T.InferenceTextEmbeddingResponse>
async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.text_embedding']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
const method = 'POST'
const path = `/_inference/text_embedding/${encodeURIComponent(params.inference_id.toString())}`
const meta: TransportRequestMetadata = {
name: 'inference.text_embedding',
pathParts: {
inference_id: params.inference_id
}
}
@ -365,8 +823,12 @@ export default class Inference {
async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceUpdateResponse, unknown>>
async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptions): Promise<T.InferenceUpdateResponse>
async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['inference_id', 'task_type']
const acceptedBody: string[] = ['inference_config']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['inference.update']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -378,18 +840,24 @@ export default class Inference {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
let method = ''
let path = ''
if (params.task_type != null && params.inference_id != null) {
method = 'POST'
method = 'PUT'
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_update`
} else {
method = 'POST'
method = 'PUT'
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_update`
}
const meta: TransportRequestMetadata = {

View File

@ -35,7 +35,18 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
info: {
path: [],
body: [],
query: []
}
}
/**
* Get cluster info. Get basic build, version, and cluster information.
@ -45,7 +56,10 @@ export default async function InfoApi (this: That, params?: T.InfoRequest, optio
export default async function InfoApi (this: That, params?: T.InfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InfoResponse, unknown>>
export default async function InfoApi (this: That, params?: T.InfoRequest, options?: TransportRequestOptions): Promise<T.InfoResponse>
export default async function InfoApi (this: That, params?: T.InfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = acceptedParams.info
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,142 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Ingest {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'ingest.delete_geoip_database': {
path: [
'id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ingest.delete_ip_location_database': {
path: [
'id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ingest.delete_pipeline': {
path: [
'id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'ingest.geo_ip_stats': {
path: [],
body: [],
query: []
},
'ingest.get_geoip_database': {
path: [
'id'
],
body: [],
query: []
},
'ingest.get_ip_location_database': {
path: [
'id'
],
body: [],
query: [
'master_timeout'
]
},
'ingest.get_pipeline': {
path: [
'id'
],
body: [],
query: [
'master_timeout',
'summary'
]
},
'ingest.processor_grok': {
path: [],
body: [],
query: []
},
'ingest.put_geoip_database': {
path: [
'id'
],
body: [
'name',
'maxmind'
],
query: [
'master_timeout',
'timeout'
]
},
'ingest.put_ip_location_database': {
path: [
'id'
],
body: [
'configuration'
],
query: [
'master_timeout',
'timeout'
]
},
'ingest.put_pipeline': {
path: [
'id'
],
body: [
'_meta',
'description',
'on_failure',
'processors',
'version',
'deprecated'
],
query: [
'master_timeout',
'timeout',
'if_version'
]
},
'ingest.simulate': {
path: [
'id'
],
body: [
'docs',
'pipeline'
],
query: [
'verbose'
]
}
}
}
/**
@ -51,7 +181,10 @@ export default class Ingest {
async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestDeleteGeoipDatabaseResponse, unknown>>
async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptions): Promise<T.IngestDeleteGeoipDatabaseResponse>
async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['ingest.delete_geoip_database']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +226,10 @@ export default class Ingest {
async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestDeleteIpLocationDatabaseResponse, unknown>>
async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise<T.IngestDeleteIpLocationDatabaseResponse>
async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['ingest.delete_ip_location_database']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +271,10 @@ export default class Ingest {
async deletePipeline (this: That, params: T.IngestDeletePipelineRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestDeletePipelineResponse, unknown>>
async deletePipeline (this: That, params: T.IngestDeletePipelineRequest, options?: TransportRequestOptions): Promise<T.IngestDeletePipelineResponse>
async deletePipeline (this: That, params: T.IngestDeletePipelineRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['ingest.delete_pipeline']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -171,13 +310,16 @@ export default class Ingest {
/**
* Get GeoIP statistics. Get download statistics for GeoIP2 databases that are used with the GeoIP processor.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-processor.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/geoip-processor.html | Elasticsearch API documentation}
*/
async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IngestGeoIpStatsResponse>
async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestGeoIpStatsResponse, unknown>>
async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest, options?: TransportRequestOptions): Promise<T.IngestGeoIpStatsResponse>
async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ingest.geo_ip_stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -217,7 +359,10 @@ export default class Ingest {
async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestGetGeoipDatabaseResponse, unknown>>
async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptions): Promise<T.IngestGetGeoipDatabaseResponse>
async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['ingest.get_geoip_database']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -267,7 +412,10 @@ export default class Ingest {
async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestGetIpLocationDatabaseResponse, unknown>>
async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise<T.IngestGetIpLocationDatabaseResponse>
async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['ingest.get_ip_location_database']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -317,7 +465,10 @@ export default class Ingest {
async getPipeline (this: That, params?: T.IngestGetPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestGetPipelineResponse, unknown>>
async getPipeline (this: That, params?: T.IngestGetPipelineRequest, options?: TransportRequestOptions): Promise<T.IngestGetPipelineResponse>
async getPipeline (this: That, params?: T.IngestGetPipelineRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['ingest.get_pipeline']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -361,13 +512,16 @@ export default class Ingest {
/**
* Run a grok processor. Extract structured fields out of a single text field within a document. You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular expression that supports aliased expressions that can be reused.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/grok-processor.html | Elasticsearch API documentation}
*/
async processorGrok (this: That, params?: T.IngestProcessorGrokRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IngestProcessorGrokResponse>
async processorGrok (this: That, params?: T.IngestProcessorGrokRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestProcessorGrokResponse, unknown>>
async processorGrok (this: That, params?: T.IngestProcessorGrokRequest, options?: TransportRequestOptions): Promise<T.IngestProcessorGrokResponse>
async processorGrok (this: That, params?: T.IngestProcessorGrokRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ingest.processor_grok']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -407,8 +561,12 @@ export default class Ingest {
async putGeoipDatabase (this: That, params: T.IngestPutGeoipDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestPutGeoipDatabaseResponse, unknown>>
async putGeoipDatabase (this: That, params: T.IngestPutGeoipDatabaseRequest, options?: TransportRequestOptions): Promise<T.IngestPutGeoipDatabaseResponse>
async putGeoipDatabase (this: That, params: T.IngestPutGeoipDatabaseRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['name', 'maxmind']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ingest.put_geoip_database']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -430,8 +588,14 @@ export default class Ingest {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -454,8 +618,12 @@ export default class Ingest {
async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestPutIpLocationDatabaseResponse, unknown>>
async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise<T.IngestPutIpLocationDatabaseResponse>
async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['configuration']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ingest.put_ip_location_database']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -467,8 +635,14 @@ export default class Ingest {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -485,14 +659,18 @@ export default class Ingest {
/**
* Create or update a pipeline. Changes made using this API take effect immediately.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/ingest.html | Elasticsearch API documentation}
*/
async putPipeline (this: That, params: T.IngestPutPipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IngestPutPipelineResponse>
async putPipeline (this: That, params: T.IngestPutPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestPutPipelineResponse, unknown>>
async putPipeline (this: That, params: T.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise<T.IngestPutPipelineResponse>
async putPipeline (this: That, params: T.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['_meta', 'description', 'on_failure', 'processors', 'version', 'deprecated']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ingest.put_pipeline']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -514,8 +692,14 @@ export default class Ingest {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -538,8 +722,12 @@ export default class Ingest {
async simulate (this: That, params: T.IngestSimulateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IngestSimulateResponse, unknown>>
async simulate (this: That, params: T.IngestSimulateRequest, options?: TransportRequestOptions): Promise<T.IngestSimulateResponse>
async simulate (this: That, params: T.IngestSimulateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['docs', 'pipeline']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['ingest.simulate']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -561,8 +749,14 @@ export default class Ingest {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,18 +35,46 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
knn_search: {
path: [
'index'
],
body: [
'_source',
'docvalue_fields',
'stored_fields',
'fields',
'filter',
'knn'
],
query: [
'routing'
]
}
}
/**
* Run a knn search. NOTE: The kNN search API has been replaced by the `knn` option in the search API. Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. Given a query vector, the API finds the k closest vectors and returns those documents as search hits. Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. This means the results returned are not always the true k closest neighbors. The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query. A kNN search response has the exact same structure as a search API response. However, certain sections have a meaning specific to kNN search: * The document `_score` is determined by the similarity between the query and document vector. * The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/knn-search-api.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/knn-search-api.html | Elasticsearch API documentation}
*/
export default async function KnnSearchApi<TDocument = unknown> (this: That, params: T.KnnSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.KnnSearchResponse<TDocument>>
export default async function KnnSearchApi<TDocument = unknown> (this: That, params: T.KnnSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.KnnSearchResponse<TDocument>, unknown>>
export default async function KnnSearchApi<TDocument = unknown> (this: That, params: T.KnnSearchRequest, options?: TransportRequestOptions): Promise<T.KnnSearchResponse<TDocument>>
export default async function KnnSearchApi<TDocument = unknown> (this: That, params: T.KnnSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['_source', 'docvalue_fields', 'stored_fields', 'fields', 'filter', 'knn']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.knn_search
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +96,14 @@ export default async function KnnSearchApi<TDocument = unknown> (this: That, par
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,77 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class License {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'license.delete': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'license.get': {
path: [],
body: [],
query: [
'accept_enterprise',
'local'
]
},
'license.get_basic_status': {
path: [],
body: [],
query: []
},
'license.get_trial_status': {
path: [],
body: [],
query: []
},
'license.post': {
path: [],
body: [
'license',
'licenses'
],
query: [
'acknowledge',
'master_timeout',
'timeout'
]
},
'license.post_start_basic': {
path: [],
body: [],
query: [
'acknowledge',
'master_timeout',
'timeout'
]
},
'license.post_start_trial': {
path: [],
body: [],
query: [
'acknowledge',
'type_query_string',
'master_timeout'
]
}
}
}
/**
@ -51,7 +116,10 @@ export default class License {
async delete (this: That, params?: T.LicenseDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicenseDeleteResponse, unknown>>
async delete (this: That, params?: T.LicenseDeleteRequest, options?: TransportRequestOptions): Promise<T.LicenseDeleteResponse>
async delete (this: That, params?: T.LicenseDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['license.delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -91,7 +159,10 @@ export default class License {
async get (this: That, params?: T.LicenseGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicenseGetResponse, unknown>>
async get (this: That, params?: T.LicenseGetRequest, options?: TransportRequestOptions): Promise<T.LicenseGetResponse>
async get (this: That, params?: T.LicenseGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['license.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -131,7 +202,10 @@ export default class License {
async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicenseGetBasicStatusResponse, unknown>>
async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest, options?: TransportRequestOptions): Promise<T.LicenseGetBasicStatusResponse>
async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['license.get_basic_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -171,7 +245,10 @@ export default class License {
async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicenseGetTrialStatusResponse, unknown>>
async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest, options?: TransportRequestOptions): Promise<T.LicenseGetTrialStatusResponse>
async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['license.get_trial_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -211,8 +288,12 @@ export default class License {
async post (this: That, params?: T.LicensePostRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicensePostResponse, unknown>>
async post (this: That, params?: T.LicensePostRequest, options?: TransportRequestOptions): Promise<T.LicensePostResponse>
async post (this: That, params?: T.LicensePostRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['license', 'licenses']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['license.post']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -235,8 +316,14 @@ export default class License {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -256,7 +343,10 @@ export default class License {
async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicensePostStartBasicResponse, unknown>>
async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest, options?: TransportRequestOptions): Promise<T.LicensePostStartBasicResponse>
async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['license.post_start_basic']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -296,7 +386,10 @@ export default class License {
async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicensePostStartTrialResponse, unknown>>
async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest, options?: TransportRequestOptions): Promise<T.LicensePostStartTrialResponse>
async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['license.post_start_trial']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,44 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Logstash {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'logstash.delete_pipeline': {
path: [
'id'
],
body: [],
query: []
},
'logstash.get_pipeline': {
path: [
'id'
],
body: [],
query: []
},
'logstash.put_pipeline': {
path: [
'id'
],
body: [
'pipeline'
],
query: []
}
}
}
/**
@ -51,7 +83,10 @@ export default class Logstash {
async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LogstashDeletePipelineResponse, unknown>>
async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest, options?: TransportRequestOptions): Promise<T.LogstashDeletePipelineResponse>
async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['logstash.delete_pipeline']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +128,10 @@ export default class Logstash {
async getPipeline (this: That, params?: T.LogstashGetPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LogstashGetPipelineResponse, unknown>>
async getPipeline (this: That, params?: T.LogstashGetPipelineRequest, options?: TransportRequestOptions): Promise<T.LogstashGetPipelineResponse>
async getPipeline (this: That, params?: T.LogstashGetPipelineRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['logstash.get_pipeline']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -143,8 +181,12 @@ export default class Logstash {
async putPipeline (this: That, params: T.LogstashPutPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LogstashPutPipelineResponse, unknown>>
async putPipeline (this: That, params: T.LogstashPutPipelineRequest, options?: TransportRequestOptions): Promise<T.LogstashPutPipelineResponse>
async putPipeline (this: That, params: T.LogstashPutPipelineRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['pipeline']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['logstash.put_pipeline']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -156,8 +198,14 @@ export default class Logstash {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,35 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
mget: {
path: [
'index'
],
body: [
'docs',
'ids'
],
query: [
'force_synthetic_source',
'preference',
'realtime',
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'stored_fields'
]
}
}
/**
* Get multiple documents. Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. **Filter source fields** By default, the `_source` field is returned for every document (if stored). Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document. You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions. **Get stored fields** Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve. Any requested fields that are not stored are ignored. You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions.
@ -45,8 +73,12 @@ export default async function MgetApi<TDocument = unknown> (this: That, params?:
export default async function MgetApi<TDocument = unknown> (this: That, params?: T.MgetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MgetResponse<TDocument>, unknown>>
export default async function MgetApi<TDocument = unknown> (this: That, params?: T.MgetRequest, options?: TransportRequestOptions): Promise<T.MgetResponse<TDocument>>
export default async function MgetApi<TDocument = unknown> (this: That, params?: T.MgetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['docs', 'ids']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.mget
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +101,14 @@ export default async function MgetApi<TDocument = unknown> (this: That, params?:
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,36 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Migration {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'migration.deprecations': {
path: [
'index'
],
body: [],
query: []
},
'migration.get_feature_upgrade_status': {
path: [],
body: [],
query: []
},
'migration.post_feature_upgrade': {
path: [],
body: [],
query: []
}
}
}
/**
@ -51,7 +75,10 @@ export default class Migration {
async deprecations (this: That, params?: T.MigrationDeprecationsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MigrationDeprecationsResponse, unknown>>
async deprecations (this: That, params?: T.MigrationDeprecationsRequest, options?: TransportRequestOptions): Promise<T.MigrationDeprecationsResponse>
async deprecations (this: That, params?: T.MigrationDeprecationsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['migration.deprecations']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -101,7 +128,10 @@ export default class Migration {
async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MigrationGetFeatureUpgradeStatusResponse, unknown>>
async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptions): Promise<T.MigrationGetFeatureUpgradeStatusResponse>
async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['migration.get_feature_upgrade_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -141,7 +171,10 @@ export default class Migration {
async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MigrationPostFeatureUpgradeResponse, unknown>>
async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptions): Promise<T.MigrationPostFeatureUpgradeResponse>
async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['migration.post_feature_upgrade']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

File diff suppressed because it is too large Load Diff

View File

@ -35,12 +35,34 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Monitoring {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'monitoring.bulk': {
path: [
'type'
],
body: [
'operations'
],
query: [
'system_id',
'system_api_version',
'interval'
]
}
}
}
/**
@ -51,8 +73,12 @@ export default class Monitoring {
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MonitoringBulkResponse, unknown>>
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<T.MonitoringBulkResponse>
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['type']
const acceptedBody: string[] = ['operations']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['monitoring.bulk']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -64,8 +90,14 @@ export default class Monitoring {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,38 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
msearch: {
path: [
'index'
],
body: [
'searches'
],
query: [
'allow_no_indices',
'ccs_minimize_roundtrips',
'expand_wildcards',
'ignore_throttled',
'ignore_unavailable',
'include_named_queries_score',
'max_concurrent_searches',
'max_concurrent_shard_requests',
'pre_filter_shard_size',
'rest_total_hits_as_int',
'routing',
'search_type',
'typed_keys'
]
}
}
/**
* Run multiple searches. The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows: ``` header\n body\n header\n body\n ``` This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. IMPORTANT: The final line of data must end with a newline character `\n`. Each newline character may be preceded by a carriage return `\r`. When sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`.
@ -45,8 +76,12 @@ export default async function MsearchApi<TDocument = unknown, TAggregations = Re
export default async function MsearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.MsearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MsearchResponse<TDocument, TAggregations>, unknown>>
export default async function MsearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.MsearchRequest, options?: TransportRequestOptions): Promise<T.MsearchResponse<TDocument, TAggregations>>
export default async function MsearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.MsearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['searches']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.msearch
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -58,8 +93,14 @@ export default async function MsearchApi<TDocument = unknown, TAggregations = Re
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,30 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
msearch_template: {
path: [
'index'
],
body: [
'search_templates'
],
query: [
'ccs_minimize_roundtrips',
'max_concurrent_searches',
'search_type',
'rest_total_hits_as_int',
'typed_keys'
]
}
}
/**
* Run multiple templated searches. Run multiple templated searches with a single request. If you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines. For example: ``` $ cat requests { "index": "my-index" } { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} { "index": "my-other-index" } { "id": "my-other-search-template", "params": { "query_type": "match_all" }} $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo ```
@ -45,8 +68,12 @@ export default async function MsearchTemplateApi<TDocument = unknown, TAggregati
export default async function MsearchTemplateApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.MsearchTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MsearchTemplateResponse<TDocument, TAggregations>, unknown>>
export default async function MsearchTemplateApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.MsearchTemplateRequest, options?: TransportRequestOptions): Promise<T.MsearchTemplateResponse<TDocument, TAggregations>>
export default async function MsearchTemplateApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.MsearchTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['search_templates']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.msearch_template
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -58,8 +85,14 @@ export default async function MsearchTemplateApi<TDocument = unknown, TAggregati
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,38 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
mtermvectors: {
path: [
'index'
],
body: [
'docs',
'ids'
],
query: [
'ids',
'fields',
'field_statistics',
'offsets',
'payloads',
'positions',
'preference',
'realtime',
'routing',
'term_statistics',
'version',
'version_type'
]
}
}
/**
* Get multiple term vectors. Get multiple term vectors with a single request. You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a `docs` array with all the fetched termvectors. Each element has the structure provided by the termvectors API. **Artificial documents** You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.
@ -45,8 +76,12 @@ export default async function MtermvectorsApi (this: That, params?: T.Mtermvecto
export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MtermvectorsResponse, unknown>>
export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest, options?: TransportRequestOptions): Promise<T.MtermvectorsResponse>
export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['docs', 'ids']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.mtermvectors
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +104,14 @@ export default async function MtermvectorsApi (this: That, params?: T.Mtermvecto
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,102 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Nodes {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'nodes.clear_repositories_metering_archive': {
path: [
'node_id',
'max_archive_version'
],
body: [],
query: []
},
'nodes.get_repositories_metering_info': {
path: [
'node_id'
],
body: [],
query: []
},
'nodes.hot_threads': {
path: [
'node_id'
],
body: [],
query: [
'ignore_idle_threads',
'interval',
'snapshots',
'threads',
'timeout',
'type',
'sort'
]
},
'nodes.info': {
path: [
'node_id',
'metric'
],
body: [],
query: [
'flat_settings',
'timeout'
]
},
'nodes.reload_secure_settings': {
path: [
'node_id'
],
body: [
'secure_settings_password'
],
query: [
'timeout'
]
},
'nodes.stats': {
path: [
'node_id',
'metric',
'index_metric'
],
body: [],
query: [
'completion_fields',
'fielddata_fields',
'fields',
'groups',
'include_segment_file_sizes',
'level',
'timeout',
'types',
'include_unloaded_segments'
]
},
'nodes.usage': {
path: [
'node_id',
'metric'
],
body: [],
query: [
'timeout'
]
}
}
}
/**
@ -51,7 +141,10 @@ export default class Nodes {
async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesClearRepositoriesMeteringArchiveResponse, unknown>>
async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptions): Promise<T.NodesClearRepositoriesMeteringArchiveResponse>
async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id', 'max_archive_version']
const {
path: acceptedPath
} = this.acceptedParams['nodes.clear_repositories_metering_archive']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -94,7 +187,10 @@ export default class Nodes {
async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesGetRepositoriesMeteringInfoResponse, unknown>>
async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptions): Promise<T.NodesGetRepositoriesMeteringInfoResponse>
async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['nodes.get_repositories_metering_info']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -136,7 +232,10 @@ export default class Nodes {
async hotThreads (this: That, params?: T.NodesHotThreadsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesHotThreadsResponse, unknown>>
async hotThreads (this: That, params?: T.NodesHotThreadsRequest, options?: TransportRequestOptions): Promise<T.NodesHotThreadsResponse>
async hotThreads (this: That, params?: T.NodesHotThreadsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['nodes.hot_threads']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -186,7 +285,10 @@ export default class Nodes {
async info (this: That, params?: T.NodesInfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesInfoResponse, unknown>>
async info (this: That, params?: T.NodesInfoRequest, options?: TransportRequestOptions): Promise<T.NodesInfoResponse>
async info (this: That, params?: T.NodesInfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id', 'metric']
const {
path: acceptedPath
} = this.acceptedParams['nodes.info']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -243,8 +345,12 @@ export default class Nodes {
async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesReloadSecureSettingsResponse, unknown>>
async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest, options?: TransportRequestOptions): Promise<T.NodesReloadSecureSettingsResponse>
async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const acceptedBody: string[] = ['secure_settings_password']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['nodes.reload_secure_settings']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -267,8 +373,14 @@ export default class Nodes {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -298,7 +410,10 @@ export default class Nodes {
async stats (this: That, params?: T.NodesStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesStatsResponse, unknown>>
async stats (this: That, params?: T.NodesStatsRequest, options?: TransportRequestOptions): Promise<T.NodesStatsResponse>
async stats (this: That, params?: T.NodesStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id', 'metric', 'index_metric']
const {
path: acceptedPath
} = this.acceptedParams['nodes.stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -362,7 +477,10 @@ export default class Nodes {
async usage (this: That, params?: T.NodesUsageRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.NodesUsageResponse, unknown>>
async usage (this: That, params?: T.NodesUsageRequest, options?: TransportRequestOptions): Promise<T.NodesUsageResponse>
async usage (this: That, params?: T.NodesUsageRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id', 'metric']
const {
path: acceptedPath
} = this.acceptedParams['nodes.usage']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,31 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
open_point_in_time: {
path: [
'index'
],
body: [
'index_filter'
],
query: [
'keep_alive',
'ignore_unavailable',
'preference',
'routing',
'expand_wildcards',
'allow_partial_search_results'
]
}
}
/**
* Open a point in time. A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, its preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. A point in time must be opened explicitly before being used in search requests. A subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time. Just like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits. If you want to retrieve more hits, use PIT with `search_after`. IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception. To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. **Keeping point in time alive** The `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. The value does not need to be long enough to process all data — it just needs to be long enough for the next request. Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. Once the smaller segments are no longer needed they are deleted. However, open point-in-times prevent the old segments from being deleted since they are still in use. TIP: Keeping older segments alive means that more disk space and file handles are needed. Ensure that you have configured your nodes to have ample free file handles. Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. Note that a point-in-time doesn't prevent its associated indices from being deleted. You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.
@ -45,8 +69,12 @@ export default async function OpenPointInTimeApi (this: That, params: T.OpenPoin
export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.OpenPointInTimeResponse, unknown>>
export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise<T.OpenPointInTimeResponse>
export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['index_filter']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.open_point_in_time
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +96,14 @@ export default async function OpenPointInTimeApi (this: That, params: T.OpenPoin
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,18 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
ping: {
path: [],
body: [],
query: []
}
}
/**
* Ping the cluster. Get information about whether the cluster is running.
@ -45,7 +56,10 @@ export default async function PingApi (this: That, params?: T.PingRequest, optio
export default async function PingApi (this: That, params?: T.PingRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.PingResponse, unknown>>
export default async function PingApi (this: That, params?: T.PingRequest, options?: TransportRequestOptions): Promise<T.PingResponse>
export default async function PingApi (this: That, params?: T.PingRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = acceptedParams.ping
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,23 +35,53 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Profiling {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'profiling.flamegraph': {
path: [],
body: [],
query: []
},
'profiling.stacktraces': {
path: [],
body: [],
query: []
},
'profiling.status': {
path: [],
body: [],
query: []
},
'profiling.topn_functions': {
path: [],
body: [],
query: []
}
}
}
/**
* Extracts a UI-optimized structure to render flamegraphs from Universal Profiling.
* @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/observability/9.0/universal-profiling.html | Elasticsearch API documentation}
*/
async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['profiling.flamegraph']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -84,13 +114,16 @@ export default class Profiling {
/**
* Extracts raw stacktrace information from Universal Profiling.
* @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/observability/9.0/universal-profiling.html | Elasticsearch API documentation}
*/
async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['profiling.stacktraces']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -123,13 +156,16 @@ export default class Profiling {
/**
* Returns basic information about the status of Universal Profiling.
* @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/observability/9.0/universal-profiling.html | Elasticsearch API documentation}
*/
async status (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async status (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async status (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async status (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['profiling.status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -162,13 +198,16 @@ export default class Profiling {
/**
* Extracts a list of topN functions from Universal Profiling.
* @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/observability/9.0/universal-profiling.html | Elasticsearch API documentation}
*/
async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['profiling.topn_functions']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,29 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
put_script: {
path: [
'id',
'context'
],
body: [
'script'
],
query: [
'context',
'master_timeout',
'timeout'
]
}
}
/**
* Create or update a script or search template. Creates or updates a stored script or search template.
@ -45,8 +67,12 @@ export default async function PutScriptApi (this: That, params: T.PutScriptReque
export default async function PutScriptApi (this: That, params: T.PutScriptRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.PutScriptResponse, unknown>>
export default async function PutScriptApi (this: That, params: T.PutScriptRequest, options?: TransportRequestOptions): Promise<T.PutScriptResponse>
export default async function PutScriptApi (this: That, params: T.PutScriptRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'context']
const acceptedBody: string[] = ['script']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.put_script
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +94,14 @@ export default async function PutScriptApi (this: That, params: T.PutScriptReque
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,90 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class QueryRules {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'query_rules.delete_rule': {
path: [
'ruleset_id',
'rule_id'
],
body: [],
query: []
},
'query_rules.delete_ruleset': {
path: [
'ruleset_id'
],
body: [],
query: []
},
'query_rules.get_rule': {
path: [
'ruleset_id',
'rule_id'
],
body: [],
query: []
},
'query_rules.get_ruleset': {
path: [
'ruleset_id'
],
body: [],
query: []
},
'query_rules.list_rulesets': {
path: [],
body: [],
query: [
'from',
'size'
]
},
'query_rules.put_rule': {
path: [
'ruleset_id',
'rule_id'
],
body: [
'type',
'criteria',
'actions',
'priority'
],
query: []
},
'query_rules.put_ruleset': {
path: [
'ruleset_id'
],
body: [
'rules'
],
query: []
},
'query_rules.test': {
path: [
'ruleset_id'
],
body: [
'match_criteria'
],
query: []
}
}
}
/**
@ -51,7 +129,10 @@ export default class QueryRules {
async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesDeleteRuleResponse, unknown>>
async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest, options?: TransportRequestOptions): Promise<T.QueryRulesDeleteRuleResponse>
async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id', 'rule_id']
const {
path: acceptedPath
} = this.acceptedParams['query_rules.delete_rule']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -94,7 +175,10 @@ export default class QueryRules {
async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesDeleteRulesetResponse, unknown>>
async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptions): Promise<T.QueryRulesDeleteRulesetResponse>
async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id']
const {
path: acceptedPath
} = this.acceptedParams['query_rules.delete_ruleset']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -136,7 +220,10 @@ export default class QueryRules {
async getRule (this: That, params: T.QueryRulesGetRuleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesGetRuleResponse, unknown>>
async getRule (this: That, params: T.QueryRulesGetRuleRequest, options?: TransportRequestOptions): Promise<T.QueryRulesGetRuleResponse>
async getRule (this: That, params: T.QueryRulesGetRuleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id', 'rule_id']
const {
path: acceptedPath
} = this.acceptedParams['query_rules.get_rule']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -179,7 +266,10 @@ export default class QueryRules {
async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesGetRulesetResponse, unknown>>
async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest, options?: TransportRequestOptions): Promise<T.QueryRulesGetRulesetResponse>
async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id']
const {
path: acceptedPath
} = this.acceptedParams['query_rules.get_ruleset']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -221,7 +311,10 @@ export default class QueryRules {
async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesListRulesetsResponse, unknown>>
async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest, options?: TransportRequestOptions): Promise<T.QueryRulesListRulesetsResponse>
async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['query_rules.list_rulesets']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -261,8 +354,12 @@ export default class QueryRules {
async putRule (this: That, params: T.QueryRulesPutRuleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesPutRuleResponse, unknown>>
async putRule (this: That, params: T.QueryRulesPutRuleRequest, options?: TransportRequestOptions): Promise<T.QueryRulesPutRuleResponse>
async putRule (this: That, params: T.QueryRulesPutRuleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id', 'rule_id']
const acceptedBody: string[] = ['type', 'criteria', 'actions', 'priority']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['query_rules.put_rule']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -284,8 +381,14 @@ export default class QueryRules {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -309,8 +412,12 @@ export default class QueryRules {
async putRuleset (this: That, params: T.QueryRulesPutRulesetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesPutRulesetResponse, unknown>>
async putRuleset (this: That, params: T.QueryRulesPutRulesetRequest, options?: TransportRequestOptions): Promise<T.QueryRulesPutRulesetResponse>
async putRuleset (this: That, params: T.QueryRulesPutRulesetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id']
const acceptedBody: string[] = ['rules']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['query_rules.put_ruleset']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -332,8 +439,14 @@ export default class QueryRules {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -356,8 +469,12 @@ export default class QueryRules {
async test (this: That, params: T.QueryRulesTestRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.QueryRulesTestResponse, unknown>>
async test (this: That, params: T.QueryRulesTestRequest, options?: TransportRequestOptions): Promise<T.QueryRulesTestResponse>
async test (this: That, params: T.QueryRulesTestRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id']
const acceptedBody: string[] = ['match_criteria']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['query_rules.test']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -379,8 +496,14 @@ export default class QueryRules {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,30 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
rank_eval: {
path: [
'index'
],
body: [
'requests',
'metric'
],
query: [
'allow_no_indices',
'expand_wildcards',
'ignore_unavailable',
'search_type'
]
}
}
/**
* Evaluate ranked search results. Evaluate the quality of ranked search results over a set of typical search queries.
@ -45,8 +68,12 @@ export default async function RankEvalApi (this: That, params: T.RankEvalRequest
export default async function RankEvalApi (this: That, params: T.RankEvalRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RankEvalResponse, unknown>>
export default async function RankEvalApi (this: That, params: T.RankEvalRequest, options?: TransportRequestOptions): Promise<T.RankEvalResponse>
export default async function RankEvalApi (this: That, params: T.RankEvalRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['requests', 'metric']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.rank_eval
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +95,14 @@ export default async function RankEvalApi (this: That, params: T.RankEvalRequest
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,22 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
reindex_rethrottle: {
path: [
'task_id'
],
body: [],
query: [
'requests_per_second'
]
}
}
/**
* Throttle a reindex operation. Change the number of requests per second for a particular reindex operation. For example: ``` POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 ``` Rethrottling that speeds up the query takes effect immediately. Rethrottling that slows down the query will take effect after completing the current batch. This behavior prevents scroll timeouts.
@ -45,7 +60,10 @@ export default async function ReindexRethrottleApi (this: That, params: T.Reinde
export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ReindexRethrottleResponse, unknown>>
export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest, options?: TransportRequestOptions): Promise<T.ReindexRethrottleResponse>
export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_id']
const {
path: acceptedPath
} = acceptedParams.reindex_rethrottle
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,25 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
render_search_template: {
path: [],
body: [
'id',
'file',
'params',
'source'
],
query: []
}
}
/**
* Render a search template. Render a search template as a search request body.
@ -45,8 +63,12 @@ export default async function RenderSearchTemplateApi (this: That, params?: T.Re
export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RenderSearchTemplateResponse, unknown>>
export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise<T.RenderSearchTemplateResponse>
export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['id', 'file', 'params', 'source']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.render_search_template
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +91,14 @@ export default async function RenderSearchTemplateApi (this: That, params?: T.Re
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,97 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Rollup {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'rollup.delete_job': {
path: [
'id'
],
body: [],
query: []
},
'rollup.get_jobs': {
path: [
'id'
],
body: [],
query: []
},
'rollup.get_rollup_caps': {
path: [
'id'
],
body: [],
query: []
},
'rollup.get_rollup_index_caps': {
path: [
'index'
],
body: [],
query: []
},
'rollup.put_job': {
path: [
'id'
],
body: [
'cron',
'groups',
'index_pattern',
'metrics',
'page_size',
'rollup_index',
'timeout',
'headers'
],
query: []
},
'rollup.rollup_search': {
path: [
'index'
],
body: [
'aggregations',
'aggs',
'query',
'size'
],
query: [
'rest_total_hits_as_int',
'typed_keys'
]
},
'rollup.start_job': {
path: [
'id'
],
body: [],
query: []
},
'rollup.stop_job': {
path: [
'id'
],
body: [],
query: [
'timeout',
'wait_for_completion'
]
}
}
}
/**
@ -51,7 +136,10 @@ export default class Rollup {
async deleteJob (this: That, params: T.RollupDeleteJobRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupDeleteJobResponse, unknown>>
async deleteJob (this: That, params: T.RollupDeleteJobRequest, options?: TransportRequestOptions): Promise<T.RollupDeleteJobResponse>
async deleteJob (this: That, params: T.RollupDeleteJobRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['rollup.delete_job']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +181,10 @@ export default class Rollup {
async getJobs (this: That, params?: T.RollupGetJobsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupGetJobsResponse, unknown>>
async getJobs (this: That, params?: T.RollupGetJobsRequest, options?: TransportRequestOptions): Promise<T.RollupGetJobsResponse>
async getJobs (this: That, params?: T.RollupGetJobsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['rollup.get_jobs']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -143,7 +234,10 @@ export default class Rollup {
async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupGetRollupCapsResponse, unknown>>
async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest, options?: TransportRequestOptions): Promise<T.RollupGetRollupCapsResponse>
async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['rollup.get_rollup_caps']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -193,7 +287,10 @@ export default class Rollup {
async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupGetRollupIndexCapsResponse, unknown>>
async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptions): Promise<T.RollupGetRollupIndexCapsResponse>
async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['rollup.get_rollup_index_caps']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -235,8 +332,12 @@ export default class Rollup {
async putJob (this: That, params: T.RollupPutJobRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupPutJobResponse, unknown>>
async putJob (this: That, params: T.RollupPutJobRequest, options?: TransportRequestOptions): Promise<T.RollupPutJobResponse>
async putJob (this: That, params: T.RollupPutJobRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['cron', 'groups', 'index_pattern', 'metrics', 'page_size', 'rollup_index', 'timeout', 'headers']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['rollup.put_job']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -258,8 +359,14 @@ export default class Rollup {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -282,8 +389,12 @@ export default class Rollup {
async rollupSearch<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.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, options?: TransportRequestOptions): Promise<T.RollupRollupSearchResponse<TDocument, TAggregations>>
async rollupSearch<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.RollupRollupSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['aggregations', 'aggs', 'query', 'size']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['rollup.rollup_search']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -305,8 +416,14 @@ export default class Rollup {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -329,7 +446,10 @@ export default class Rollup {
async startJob (this: That, params: T.RollupStartJobRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupStartJobResponse, unknown>>
async startJob (this: That, params: T.RollupStartJobRequest, options?: TransportRequestOptions): Promise<T.RollupStartJobResponse>
async startJob (this: That, params: T.RollupStartJobRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['rollup.start_job']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -371,7 +491,10 @@ export default class Rollup {
async stopJob (this: That, params: T.RollupStopJobRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.RollupStopJobResponse, unknown>>
async stopJob (this: That, params: T.RollupStopJobRequest, options?: TransportRequestOptions): Promise<T.RollupStopJobResponse>
async stopJob (this: That, params: T.RollupStopJobRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['rollup.stop_job']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,18 +35,39 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
scripts_painless_execute: {
path: [],
body: [
'context',
'context_setup',
'script'
],
query: []
}
}
/**
* Run a script. Runs a script and returns a result. Use this API to build and test scripts, such as when defining a script for a runtime field. This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. The API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is. Each context requires a script, but additional parameters depend on the context you're using for that script.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/painless/9.0/painless-execute-api.html | Elasticsearch API documentation}
*/
export default async function ScriptsPainlessExecuteApi<TResult = unknown> (this: That, params?: T.ScriptsPainlessExecuteRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.ScriptsPainlessExecuteResponse<TResult>>
export default async function ScriptsPainlessExecuteApi<TResult = unknown> (this: That, params?: T.ScriptsPainlessExecuteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ScriptsPainlessExecuteResponse<TResult>, unknown>>
export default async function ScriptsPainlessExecuteApi<TResult = unknown> (this: That, params?: T.ScriptsPainlessExecuteRequest, options?: TransportRequestOptions): Promise<T.ScriptsPainlessExecuteResponse<TResult>>
export default async function ScriptsPainlessExecuteApi<TResult = unknown> (this: That, params?: T.ScriptsPainlessExecuteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['context', 'context_setup', 'script']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.scripts_painless_execute
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +90,14 @@ export default async function ScriptsPainlessExecuteApi<TResult = unknown> (this
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,27 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
scroll: {
path: [],
body: [
'scroll',
'scroll_id'
],
query: [
'scroll',
'scroll_id',
'rest_total_hits_as_int'
]
}
}
/**
* Run a scrolling search. IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the `search_after` parameter with a point in time (PIT). The scroll API gets large sets of results from a single scrolling search request. To get the necessary scroll ID, submit a search API request that includes an argument for the `scroll` query parameter. The `scroll` parameter indicates how long Elasticsearch should retain the search context for the request. The search response returns a scroll ID in the `_scroll_id` response body parameter. You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search. You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context. IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.
@ -45,8 +65,12 @@ export default async function ScrollApi<TDocument = unknown, TAggregations = Rec
export default async function ScrollApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.ScrollRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ScrollResponse<TDocument, TAggregations>, unknown>>
export default async function ScrollApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.ScrollRequest, options?: TransportRequestOptions): Promise<T.ScrollResponse<TDocument, TAggregations>>
export default async function ScrollApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.ScrollRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['scroll', 'scroll_id']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.scroll
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +92,14 @@ export default async function ScrollApi<TDocument = unknown, TAggregations = Rec
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,103 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
search: {
path: [
'index'
],
body: [
'aggregations',
'aggs',
'collapse',
'explain',
'ext',
'from',
'highlight',
'track_total_hits',
'indices_boost',
'docvalue_fields',
'knn',
'rank',
'min_score',
'post_filter',
'profile',
'query',
'rescore',
'retriever',
'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'
],
query: [
'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',
'include_named_queries_score',
'lenient',
'max_concurrent_shard_requests',
'preference',
'pre_filter_shard_size',
'request_cache',
'routing',
'scroll',
'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',
'force_synthetic_source'
]
}
}
/**
* Run a search. Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. To search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices. **Search slicing** When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties. By default the splitting is done first on the shards, then locally on each shard. The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. IMPORTANT: The same point-in-time ID should be used for all slices. If different PIT IDs are used, slices can overlap and miss documents. This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.
@ -45,8 +141,12 @@ 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, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchResponse<TDocument, TAggregations>, unknown>>
export default async function SearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.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, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'rank', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'retriever', '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 {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.search
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -73,8 +173,14 @@ export default async function SearchApi<TDocument = unknown, TAggregations = Rec
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,108 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class SearchApplication {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'search_application.delete': {
path: [
'name'
],
body: [],
query: []
},
'search_application.delete_behavioral_analytics': {
path: [
'name'
],
body: [],
query: []
},
'search_application.get': {
path: [
'name'
],
body: [],
query: []
},
'search_application.get_behavioral_analytics': {
path: [
'name'
],
body: [],
query: []
},
'search_application.list': {
path: [],
body: [],
query: [
'q',
'from',
'size'
]
},
'search_application.post_behavioral_analytics_event': {
path: [
'collection_name',
'event_type'
],
body: [
'payload'
],
query: [
'debug'
]
},
'search_application.put': {
path: [
'name'
],
body: [
'search_application'
],
query: [
'create'
]
},
'search_application.put_behavioral_analytics': {
path: [
'name'
],
body: [],
query: []
},
'search_application.render_query': {
path: [
'name'
],
body: [
'params'
],
query: []
},
'search_application.search': {
path: [
'name'
],
body: [
'params'
],
query: [
'typed_keys'
]
}
}
}
/**
@ -51,7 +147,10 @@ export default class SearchApplication {
async delete (this: That, params: T.SearchApplicationDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationDeleteResponse, unknown>>
async delete (this: That, params: T.SearchApplicationDeleteRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationDeleteResponse>
async delete (this: That, params: T.SearchApplicationDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['search_application.delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +192,10 @@ export default class SearchApplication {
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationDeleteBehavioralAnalyticsResponse, unknown>>
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationDeleteBehavioralAnalyticsResponse>
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['search_application.delete_behavioral_analytics']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +237,10 @@ export default class SearchApplication {
async get (this: That, params: T.SearchApplicationGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationGetResponse, unknown>>
async get (this: That, params: T.SearchApplicationGetRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationGetResponse>
async get (this: That, params: T.SearchApplicationGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['search_application.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -177,7 +282,10 @@ export default class SearchApplication {
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationGetBehavioralAnalyticsResponse, unknown>>
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationGetBehavioralAnalyticsResponse>
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['search_application.get_behavioral_analytics']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -227,7 +335,10 @@ export default class SearchApplication {
async list (this: That, params?: T.SearchApplicationListRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationListResponse, unknown>>
async list (this: That, params?: T.SearchApplicationListRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationListResponse>
async list (this: That, params?: T.SearchApplicationListRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['search_application.list']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -267,8 +378,12 @@ export default class SearchApplication {
async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationPostBehavioralAnalyticsEventResponse, unknown>>
async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationPostBehavioralAnalyticsEventResponse>
async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['collection_name', 'event_type']
const acceptedBody: string[] = ['payload']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['search_application.post_behavioral_analytics_event']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -280,8 +395,14 @@ export default class SearchApplication {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -305,8 +426,12 @@ export default class SearchApplication {
async put (this: That, params: T.SearchApplicationPutRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationPutResponse, unknown>>
async put (this: That, params: T.SearchApplicationPutRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationPutResponse>
async put (this: That, params: T.SearchApplicationPutRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['search_application']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['search_application.put']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -318,8 +443,14 @@ export default class SearchApplication {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -342,7 +473,10 @@ export default class SearchApplication {
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationPutBehavioralAnalyticsResponse, unknown>>
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationPutBehavioralAnalyticsResponse>
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['search_application.put_behavioral_analytics']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -384,8 +518,12 @@ export default class SearchApplication {
async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationRenderQueryResponse, unknown>>
async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationRenderQueryResponse>
async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['params']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['search_application.render_query']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -407,8 +545,14 @@ export default class SearchApplication {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -431,8 +575,12 @@ export default class SearchApplication {
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationSearchResponse<TDocument, TAggregations>, unknown>>
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationSearchResponse<TDocument, TAggregations>>
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['params']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['search_application.search']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -454,8 +602,14 @@ export default class SearchApplication {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,28 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
search_shards: {
path: [
'index'
],
body: [],
query: [
'allow_no_indices',
'expand_wildcards',
'ignore_unavailable',
'local',
'master_timeout',
'preference',
'routing'
]
}
}
/**
* Get the search shards. Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. When filtered aliases are used, the filter is returned as part of the `indices` section. If the Elasticsearch security features are enabled, you must have the `view_index_metadata` or `manage` index privilege for the target data stream, index, or alias.
@ -45,7 +66,10 @@ export default async function SearchShardsApi (this: That, params?: T.SearchShar
export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchShardsResponse, unknown>>
export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest, options?: TransportRequestOptions): Promise<T.SearchShardsResponse>
export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = acceptedParams.search_shards
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,42 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
search_template: {
path: [
'index'
],
body: [
'explain',
'id',
'params',
'profile',
'source'
],
query: [
'allow_no_indices',
'ccs_minimize_roundtrips',
'expand_wildcards',
'explain',
'ignore_throttled',
'ignore_unavailable',
'preference',
'profile',
'routing',
'scroll',
'search_type',
'rest_total_hits_as_int',
'typed_keys'
]
}
}
/**
* Run a search with a search template.
@ -45,8 +80,12 @@ export default async function SearchTemplateApi<TDocument = unknown> (this: That
export default async function SearchTemplateApi<TDocument = unknown> (this: That, params?: T.SearchTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchTemplateResponse<TDocument>, unknown>>
export default async function SearchTemplateApi<TDocument = unknown> (this: That, params?: T.SearchTemplateRequest, options?: TransportRequestOptions): Promise<T.SearchTemplateResponse<TDocument>>
export default async function SearchTemplateApi<TDocument = unknown> (this: That, params?: T.SearchTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['explain', 'id', 'params', 'profile', 'source']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.search_template
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -69,8 +108,14 @@ export default async function SearchTemplateApi<TDocument = unknown> (this: That
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,67 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class SearchableSnapshots {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'searchable_snapshots.cache_stats': {
path: [
'node_id'
],
body: [],
query: [
'master_timeout'
]
},
'searchable_snapshots.clear_cache': {
path: [
'index'
],
body: [],
query: [
'expand_wildcards',
'allow_no_indices',
'ignore_unavailable'
]
},
'searchable_snapshots.mount': {
path: [
'repository',
'snapshot'
],
body: [
'index',
'renamed_index',
'index_settings',
'ignore_index_settings'
],
query: [
'master_timeout',
'wait_for_completion',
'storage'
]
},
'searchable_snapshots.stats': {
path: [
'index'
],
body: [],
query: [
'level'
]
}
}
}
/**
@ -51,7 +106,10 @@ export default class SearchableSnapshots {
async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchableSnapshotsCacheStatsResponse, unknown>>
async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptions): Promise<T.SearchableSnapshotsCacheStatsResponse>
async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['searchable_snapshots.cache_stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -101,7 +159,10 @@ export default class SearchableSnapshots {
async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchableSnapshotsClearCacheResponse, unknown>>
async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptions): Promise<T.SearchableSnapshotsClearCacheResponse>
async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['searchable_snapshots.clear_cache']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -151,8 +212,12 @@ export default class SearchableSnapshots {
async mount (this: That, params: T.SearchableSnapshotsMountRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchableSnapshotsMountResponse, unknown>>
async mount (this: That, params: T.SearchableSnapshotsMountRequest, options?: TransportRequestOptions): Promise<T.SearchableSnapshotsMountResponse>
async mount (this: That, params: T.SearchableSnapshotsMountRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const acceptedBody: string[] = ['index', 'renamed_index', 'index_settings', 'ignore_index_settings']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['searchable_snapshots.mount']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -174,8 +239,14 @@ export default class SearchableSnapshots {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -199,7 +270,10 @@ export default class SearchableSnapshots {
async stats (this: That, params?: T.SearchableSnapshotsStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchableSnapshotsStatsResponse, unknown>>
async stats (this: That, params?: T.SearchableSnapshotsStatsRequest, options?: TransportRequestOptions): Promise<T.SearchableSnapshotsStatsResponse>
async stats (this: That, params?: T.SearchableSnapshotsStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const {
path: acceptedPath
} = this.acceptedParams['searchable_snapshots.stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

File diff suppressed because it is too large Load Diff

View File

@ -35,12 +35,55 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Shutdown {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'shutdown.delete_node': {
path: [
'node_id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'shutdown.get_node': {
path: [
'node_id'
],
body: [],
query: [
'master_timeout'
]
},
'shutdown.put_node': {
path: [
'node_id'
],
body: [
'type',
'reason',
'allocation_delay',
'target_node_name'
],
query: [
'master_timeout',
'timeout'
]
}
}
}
/**
@ -51,7 +94,10 @@ export default class Shutdown {
async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ShutdownDeleteNodeResponse, unknown>>
async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest, options?: TransportRequestOptions): Promise<T.ShutdownDeleteNodeResponse>
async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['shutdown.delete_node']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +139,10 @@ export default class Shutdown {
async getNode (this: That, params?: T.ShutdownGetNodeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ShutdownGetNodeResponse, unknown>>
async getNode (this: That, params?: T.ShutdownGetNodeRequest, options?: TransportRequestOptions): Promise<T.ShutdownGetNodeResponse>
async getNode (this: That, params?: T.ShutdownGetNodeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const {
path: acceptedPath
} = this.acceptedParams['shutdown.get_node']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -143,8 +192,12 @@ export default class Shutdown {
async putNode (this: That, params: T.ShutdownPutNodeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ShutdownPutNodeResponse, unknown>>
async putNode (this: That, params: T.ShutdownPutNodeRequest, options?: TransportRequestOptions): Promise<T.ShutdownPutNodeResponse>
async putNode (this: That, params: T.ShutdownPutNodeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['node_id']
const acceptedBody: string[] = ['type', 'reason', 'allocation_delay', 'target_node_name']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['shutdown.put_node']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -166,8 +219,14 @@ export default class Shutdown {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,36 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Simulate {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'simulate.ingest': {
path: [
'index'
],
body: [
'docs',
'component_template_substitutions',
'index_template_substitutions',
'mapping_addition',
'pipeline_substitutions'
],
query: [
'pipeline'
]
}
}
}
/**
@ -51,8 +75,12 @@ export default class Simulate {
async ingest (this: That, params: T.SimulateIngestRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SimulateIngestResponse, unknown>>
async ingest (this: That, params: T.SimulateIngestRequest, options?: TransportRequestOptions): Promise<T.SimulateIngestResponse>
async ingest (this: That, params: T.SimulateIngestRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['docs', 'component_template_substitutions', 'index_template_subtitutions', 'mapping_addition', 'pipeline_substitutions']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['simulate.ingest']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -74,8 +102,14 @@ export default class Simulate {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,107 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Slm {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'slm.delete_lifecycle': {
path: [
'policy_id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.execute_lifecycle': {
path: [
'policy_id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.execute_retention': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.get_lifecycle': {
path: [
'policy_id'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.get_stats': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.get_status': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.put_lifecycle': {
path: [
'policy_id'
],
body: [
'config',
'name',
'repository',
'retention',
'schedule'
],
query: [
'master_timeout',
'timeout'
]
},
'slm.start': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'slm.stop': {
path: [],
body: [],
query: [
'master_timeout',
'timeout'
]
}
}
}
/**
@ -51,7 +146,10 @@ export default class Slm {
async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmDeleteLifecycleResponse, unknown>>
async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise<T.SlmDeleteLifecycleResponse>
async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['policy_id']
const {
path: acceptedPath
} = this.acceptedParams['slm.delete_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +191,10 @@ export default class Slm {
async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmExecuteLifecycleResponse, unknown>>
async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest, options?: TransportRequestOptions): Promise<T.SlmExecuteLifecycleResponse>
async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['policy_id']
const {
path: acceptedPath
} = this.acceptedParams['slm.execute_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -135,7 +236,10 @@ export default class Slm {
async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmExecuteRetentionResponse, unknown>>
async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest, options?: TransportRequestOptions): Promise<T.SlmExecuteRetentionResponse>
async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['slm.execute_retention']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -175,7 +279,10 @@ export default class Slm {
async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmGetLifecycleResponse, unknown>>
async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest, options?: TransportRequestOptions): Promise<T.SlmGetLifecycleResponse>
async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['policy_id']
const {
path: acceptedPath
} = this.acceptedParams['slm.get_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -225,7 +332,10 @@ export default class Slm {
async getStats (this: That, params?: T.SlmGetStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmGetStatsResponse, unknown>>
async getStats (this: That, params?: T.SlmGetStatsRequest, options?: TransportRequestOptions): Promise<T.SlmGetStatsResponse>
async getStats (this: That, params?: T.SlmGetStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['slm.get_stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -265,7 +375,10 @@ export default class Slm {
async getStatus (this: That, params?: T.SlmGetStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmGetStatusResponse, unknown>>
async getStatus (this: That, params?: T.SlmGetStatusRequest, options?: TransportRequestOptions): Promise<T.SlmGetStatusResponse>
async getStatus (this: That, params?: T.SlmGetStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['slm.get_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -305,8 +418,12 @@ export default class Slm {
async putLifecycle (this: That, params: T.SlmPutLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmPutLifecycleResponse, unknown>>
async putLifecycle (this: That, params: T.SlmPutLifecycleRequest, options?: TransportRequestOptions): Promise<T.SlmPutLifecycleResponse>
async putLifecycle (this: That, params: T.SlmPutLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['policy_id']
const acceptedBody: string[] = ['config', 'name', 'repository', 'retention', 'schedule']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['slm.put_lifecycle']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -328,8 +445,14 @@ export default class Slm {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -352,7 +475,10 @@ export default class Slm {
async start (this: That, params?: T.SlmStartRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmStartResponse, unknown>>
async start (this: That, params?: T.SlmStartRequest, options?: TransportRequestOptions): Promise<T.SlmStartResponse>
async start (this: That, params?: T.SlmStartRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['slm.start']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -392,7 +518,10 @@ export default class Slm {
async stop (this: That, params?: T.SlmStopRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SlmStopResponse, unknown>>
async stop (this: That, params?: T.SlmStopRequest, options?: TransportRequestOptions): Promise<T.SlmStopResponse>
async stop (this: That, params?: T.SlmStopRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['slm.stop']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,208 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Snapshot {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'snapshot.cleanup_repository': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'snapshot.clone': {
path: [
'repository',
'snapshot',
'target_snapshot'
],
body: [
'indices'
],
query: [
'master_timeout',
'timeout'
]
},
'snapshot.create': {
path: [
'repository',
'snapshot'
],
body: [
'expand_wildcards',
'feature_states',
'ignore_unavailable',
'include_global_state',
'indices',
'metadata',
'partial'
],
query: [
'master_timeout',
'wait_for_completion'
]
},
'snapshot.create_repository': {
path: [
'name'
],
body: [
'repository'
],
query: [
'master_timeout',
'timeout',
'verify'
]
},
'snapshot.delete': {
path: [
'repository',
'snapshot'
],
body: [],
query: [
'master_timeout'
]
},
'snapshot.delete_repository': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'snapshot.get': {
path: [
'repository',
'snapshot'
],
body: [],
query: [
'after',
'from_sort_value',
'ignore_unavailable',
'index_details',
'index_names',
'include_repository',
'master_timeout',
'order',
'offset',
'size',
'slm_policy_filter',
'sort',
'verbose'
]
},
'snapshot.get_repository': {
path: [
'name'
],
body: [],
query: [
'local',
'master_timeout'
]
},
'snapshot.repository_analyze': {
path: [
'name'
],
body: [],
query: [
'blob_count',
'concurrency',
'detailed',
'early_read_node_count',
'max_blob_size',
'max_total_data_size',
'rare_action_probability',
'rarely_abort_writes',
'read_node_count',
'register_operation_count',
'seed',
'timeout'
]
},
'snapshot.repository_verify_integrity': {
path: [
'name'
],
body: [],
query: [
'blob_thread_pool_concurrency',
'index_snapshot_verification_concurrency',
'index_verification_concurrency',
'max_bytes_per_sec',
'max_failed_shard_snapshots',
'meta_thread_pool_concurrency',
'snapshot_verification_concurrency',
'verify_blob_contents'
]
},
'snapshot.restore': {
path: [
'repository',
'snapshot'
],
body: [
'feature_states',
'ignore_index_settings',
'ignore_unavailable',
'include_aliases',
'include_global_state',
'index_settings',
'indices',
'partial',
'rename_pattern',
'rename_replacement'
],
query: [
'master_timeout',
'wait_for_completion'
]
},
'snapshot.status': {
path: [
'repository',
'snapshot'
],
body: [],
query: [
'ignore_unavailable',
'master_timeout'
]
},
'snapshot.verify_repository': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
}
}
}
/**
@ -51,7 +247,10 @@ export default class Snapshot {
async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotCleanupRepositoryResponse, unknown>>
async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptions): Promise<T.SnapshotCleanupRepositoryResponse>
async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.cleanup_repository']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,8 +292,12 @@ export default class Snapshot {
async clone (this: That, params: T.SnapshotCloneRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotCloneResponse, unknown>>
async clone (this: That, params: T.SnapshotCloneRequest, options?: TransportRequestOptions): Promise<T.SnapshotCloneResponse>
async clone (this: That, params: T.SnapshotCloneRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot', 'target_snapshot']
const acceptedBody: string[] = ['indices']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['snapshot.clone']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -116,8 +319,14 @@ export default class Snapshot {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -142,8 +351,12 @@ export default class Snapshot {
async create (this: That, params: T.SnapshotCreateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotCreateResponse, unknown>>
async create (this: That, params: T.SnapshotCreateRequest, options?: TransportRequestOptions): Promise<T.SnapshotCreateResponse>
async create (this: That, params: T.SnapshotCreateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const acceptedBody: string[] = ['expand_wildcards', 'feature_states', 'ignore_unavailable', 'include_global_state', 'indices', 'metadata', 'partial']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['snapshot.create']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -165,8 +378,14 @@ export default class Snapshot {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -190,8 +409,12 @@ export default class Snapshot {
async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotCreateRepositoryResponse, unknown>>
async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise<T.SnapshotCreateRepositoryResponse>
async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['repository']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['snapshot.create_repository']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -203,8 +426,14 @@ export default class Snapshot {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -227,7 +456,10 @@ export default class Snapshot {
async delete (this: That, params: T.SnapshotDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotDeleteResponse, unknown>>
async delete (this: That, params: T.SnapshotDeleteRequest, options?: TransportRequestOptions): Promise<T.SnapshotDeleteResponse>
async delete (this: That, params: T.SnapshotDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.delete']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -270,7 +502,10 @@ export default class Snapshot {
async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotDeleteRepositoryResponse, unknown>>
async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptions): Promise<T.SnapshotDeleteRepositoryResponse>
async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.delete_repository']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -312,7 +547,10 @@ export default class Snapshot {
async get (this: That, params: T.SnapshotGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotGetResponse, unknown>>
async get (this: That, params: T.SnapshotGetRequest, options?: TransportRequestOptions): Promise<T.SnapshotGetResponse>
async get (this: That, params: T.SnapshotGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -355,7 +593,10 @@ export default class Snapshot {
async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotGetRepositoryResponse, unknown>>
async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest, options?: TransportRequestOptions): Promise<T.SnapshotGetRepositoryResponse>
async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.get_repository']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -405,7 +646,10 @@ export default class Snapshot {
async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotRepositoryAnalyzeResponse, unknown>>
async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptions): Promise<T.SnapshotRepositoryAnalyzeResponse>
async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.repository_analyze']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -447,7 +691,10 @@ export default class Snapshot {
async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotRepositoryVerifyIntegrityResponse, unknown>>
async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptions): Promise<T.SnapshotRepositoryVerifyIntegrityResponse>
async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.repository_verify_integrity']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -489,8 +736,12 @@ export default class Snapshot {
async restore (this: That, params: T.SnapshotRestoreRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotRestoreResponse, unknown>>
async restore (this: That, params: T.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise<T.SnapshotRestoreResponse>
async restore (this: That, params: T.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const acceptedBody: string[] = ['feature_states', 'ignore_index_settings', 'ignore_unavailable', 'include_aliases', 'include_global_state', 'index_settings', 'indices', 'partial', 'rename_pattern', 'rename_replacement']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['snapshot.restore']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -512,8 +763,14 @@ export default class Snapshot {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -537,7 +794,10 @@ export default class Snapshot {
async status (this: That, params?: T.SnapshotStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotStatusResponse, unknown>>
async status (this: That, params?: T.SnapshotStatusRequest, options?: TransportRequestOptions): Promise<T.SnapshotStatusResponse>
async status (this: That, params?: T.SnapshotStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -591,7 +851,10 @@ export default class Snapshot {
async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SnapshotVerifyRepositoryResponse, unknown>>
async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptions): Promise<T.SnapshotVerifyRepositoryResponse>
async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['snapshot.verify_repository']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,89 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Sql {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'sql.clear_cursor': {
path: [],
body: [
'cursor'
],
query: []
},
'sql.delete_async': {
path: [
'id'
],
body: [],
query: []
},
'sql.get_async': {
path: [
'id'
],
body: [],
query: [
'delimiter',
'format',
'keep_alive',
'wait_for_completion_timeout'
]
},
'sql.get_async_status': {
path: [
'id'
],
body: [],
query: []
},
'sql.query': {
path: [],
body: [
'allow_partial_search_results',
'catalog',
'columnar',
'cursor',
'fetch_size',
'field_multi_value_leniency',
'filter',
'index_using_frozen',
'keep_alive',
'keep_on_completion',
'page_timeout',
'params',
'query',
'request_timeout',
'runtime_mappings',
'time_zone',
'wait_for_completion_timeout'
],
query: [
'format'
]
},
'sql.translate': {
path: [],
body: [
'fetch_size',
'filter',
'query',
'time_zone'
],
query: []
}
}
}
/**
@ -51,8 +128,12 @@ export default class Sql {
async clearCursor (this: That, params: T.SqlClearCursorRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SqlClearCursorResponse, unknown>>
async clearCursor (this: That, params: T.SqlClearCursorRequest, options?: TransportRequestOptions): Promise<T.SqlClearCursorResponse>
async clearCursor (this: That, params: T.SqlClearCursorRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['cursor']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['sql.clear_cursor']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -74,8 +155,14 @@ export default class Sql {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -95,7 +182,10 @@ export default class Sql {
async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SqlDeleteAsyncResponse, unknown>>
async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest, options?: TransportRequestOptions): Promise<T.SqlDeleteAsyncResponse>
async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['sql.delete_async']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -137,7 +227,10 @@ export default class Sql {
async getAsync (this: That, params: T.SqlGetAsyncRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SqlGetAsyncResponse, unknown>>
async getAsync (this: That, params: T.SqlGetAsyncRequest, options?: TransportRequestOptions): Promise<T.SqlGetAsyncResponse>
async getAsync (this: That, params: T.SqlGetAsyncRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['sql.get_async']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -179,7 +272,10 @@ export default class Sql {
async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SqlGetAsyncStatusResponse, unknown>>
async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest, options?: TransportRequestOptions): Promise<T.SqlGetAsyncStatusResponse>
async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['sql.get_async_status']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -221,8 +317,12 @@ export default class Sql {
async query (this: That, params?: T.SqlQueryRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SqlQueryResponse, unknown>>
async query (this: That, params?: T.SqlQueryRequest, options?: TransportRequestOptions): Promise<T.SqlQueryResponse>
async query (this: That, params?: T.SqlQueryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['allow_partial_search_results', 'catalog', 'columnar', 'cursor', 'fetch_size', 'field_multi_value_leniency', 'filter', 'index_using_frozen', 'keep_alive', 'keep_on_completion', 'page_timeout', 'params', 'query', 'request_timeout', 'runtime_mappings', 'time_zone', 'wait_for_completion_timeout']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['sql.query']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -245,8 +345,14 @@ export default class Sql {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -266,8 +372,12 @@ export default class Sql {
async translate (this: That, params: T.SqlTranslateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SqlTranslateResponse, unknown>>
async translate (this: That, params: T.SqlTranslateRequest, options?: TransportRequestOptions): Promise<T.SqlTranslateResponse>
async translate (this: That, params: T.SqlTranslateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['fetch_size', 'filter', 'query', 'time_zone']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['sql.translate']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -289,8 +399,14 @@ export default class Sql {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,24 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Ssl {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'ssl.certificates': {
path: [],
body: [],
query: []
}
}
}
/**
@ -51,7 +63,10 @@ export default class Ssl {
async certificates (this: That, params?: T.SslCertificatesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SslCertificatesResponse, unknown>>
async certificates (this: That, params?: T.SslCertificatesRequest, options?: TransportRequestOptions): Promise<T.SslCertificatesResponse>
async certificates (this: That, params?: T.SslCertificatesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['ssl.certificates']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,81 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Synonyms {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'synonyms.delete_synonym': {
path: [
'id'
],
body: [],
query: []
},
'synonyms.delete_synonym_rule': {
path: [
'set_id',
'rule_id'
],
body: [],
query: []
},
'synonyms.get_synonym': {
path: [
'id'
],
body: [],
query: [
'from',
'size'
]
},
'synonyms.get_synonym_rule': {
path: [
'set_id',
'rule_id'
],
body: [],
query: []
},
'synonyms.get_synonyms_sets': {
path: [],
body: [],
query: [
'from',
'size'
]
},
'synonyms.put_synonym': {
path: [
'id'
],
body: [
'synonyms_set'
],
query: []
},
'synonyms.put_synonym_rule': {
path: [
'set_id',
'rule_id'
],
body: [
'synonyms'
],
query: []
}
}
}
/**
@ -51,7 +120,10 @@ export default class Synonyms {
async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsDeleteSynonymResponse, unknown>>
async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest, options?: TransportRequestOptions): Promise<T.SynonymsDeleteSynonymResponse>
async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['synonyms.delete_synonym']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -93,7 +165,10 @@ export default class Synonyms {
async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsDeleteSynonymRuleResponse, unknown>>
async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptions): Promise<T.SynonymsDeleteSynonymRuleResponse>
async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['set_id', 'rule_id']
const {
path: acceptedPath
} = this.acceptedParams['synonyms.delete_synonym_rule']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -136,7 +211,10 @@ export default class Synonyms {
async getSynonym (this: That, params: T.SynonymsGetSynonymRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsGetSynonymResponse, unknown>>
async getSynonym (this: That, params: T.SynonymsGetSynonymRequest, options?: TransportRequestOptions): Promise<T.SynonymsGetSynonymResponse>
async getSynonym (this: That, params: T.SynonymsGetSynonymRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['synonyms.get_synonym']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -178,7 +256,10 @@ export default class Synonyms {
async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsGetSynonymRuleResponse, unknown>>
async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptions): Promise<T.SynonymsGetSynonymRuleResponse>
async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['set_id', 'rule_id']
const {
path: acceptedPath
} = this.acceptedParams['synonyms.get_synonym_rule']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -221,7 +302,10 @@ export default class Synonyms {
async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsGetSynonymsSetsResponse, unknown>>
async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptions): Promise<T.SynonymsGetSynonymsSetsResponse>
async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['synonyms.get_synonyms_sets']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -261,8 +345,12 @@ export default class Synonyms {
async putSynonym (this: That, params: T.SynonymsPutSynonymRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsPutSynonymResponse, unknown>>
async putSynonym (this: That, params: T.SynonymsPutSynonymRequest, options?: TransportRequestOptions): Promise<T.SynonymsPutSynonymResponse>
async putSynonym (this: That, params: T.SynonymsPutSynonymRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['synonyms_set']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['synonyms.put_synonym']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -284,8 +372,14 @@ export default class Synonyms {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -308,8 +402,12 @@ export default class Synonyms {
async putSynonymRule (this: That, params: T.SynonymsPutSynonymRuleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SynonymsPutSynonymRuleResponse, unknown>>
async putSynonymRule (this: That, params: T.SynonymsPutSynonymRuleRequest, options?: TransportRequestOptions): Promise<T.SynonymsPutSynonymRuleResponse>
async putSynonymRule (this: That, params: T.SynonymsPutSynonymRuleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['set_id', 'rule_id']
const acceptedBody: string[] = ['synonyms']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['synonyms.put_synonym_rule']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -331,8 +429,14 @@ export default class Synonyms {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,54 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Tasks {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'tasks.cancel': {
path: [
'task_id'
],
body: [],
query: [
'actions',
'nodes',
'parent_task_id',
'wait_for_completion'
]
},
'tasks.get': {
path: [
'task_id'
],
body: [],
query: [
'timeout',
'wait_for_completion'
]
},
'tasks.list': {
path: [],
body: [],
query: [
'actions',
'detailed',
'group_by',
'nodes',
'parent_task_id',
'timeout',
'wait_for_completion'
]
}
}
}
/**
@ -51,7 +93,10 @@ export default class Tasks {
async cancel (this: That, params?: T.TasksCancelRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TasksCancelResponse, unknown>>
async cancel (this: That, params?: T.TasksCancelRequest, options?: TransportRequestOptions): Promise<T.TasksCancelResponse>
async cancel (this: That, params?: T.TasksCancelRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_id']
const {
path: acceptedPath
} = this.acceptedParams['tasks.cancel']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -101,7 +146,10 @@ export default class Tasks {
async get (this: That, params: T.TasksGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TasksGetResponse, unknown>>
async get (this: That, params: T.TasksGetRequest, options?: TransportRequestOptions): Promise<T.TasksGetResponse>
async get (this: That, params: T.TasksGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_id']
const {
path: acceptedPath
} = this.acceptedParams['tasks.get']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -143,7 +191,10 @@ export default class Tasks {
async list (this: That, params?: T.TasksListRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TasksListResponse, unknown>>
async list (this: That, params?: T.TasksListRequest, options?: TransportRequestOptions): Promise<T.TasksListResponse>
async list (this: That, params?: T.TasksListRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['tasks.list']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,30 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
terms_enum: {
path: [
'index'
],
body: [
'field',
'size',
'timeout',
'case_insensitive',
'index_filter',
'string',
'search_after'
],
query: []
}
}
/**
* Get terms in an index. Discover terms that match a partial string in an index. This API is designed for low-latency look-ups used in auto-complete scenarios. > info > The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.
@ -45,8 +68,12 @@ export default async function TermsEnumApi (this: That, params: T.TermsEnumReque
export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TermsEnumResponse, unknown>>
export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest, options?: TransportRequestOptions): Promise<T.TermsEnumResponse>
export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['field', 'size', 'timeout', 'case_insensitive', 'index_filter', 'string', 'search_after']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.terms_enum
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +95,14 @@ export default async function TermsEnumApi (this: That, params: T.TermsEnumReque
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,7 +35,48 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
termvectors: {
path: [
'index',
'id'
],
body: [
'doc',
'filter',
'per_field_analyzer',
'fields',
'field_statistics',
'offsets',
'payloads',
'positions',
'term_statistics',
'routing',
'version',
'version_type'
],
query: [
'fields',
'field_statistics',
'offsets',
'payloads',
'positions',
'preference',
'realtime',
'routing',
'term_statistics',
'version',
'version_type'
]
}
}
/**
* Get term vector information. Get information and statistics about terms in the fields of a particular document. You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body. For example: ``` GET /my-index-000001/_termvectors/1?fields=message ``` Fields can be specified using wildcards, similar to the multi match query. Term vectors are real-time by default, not near real-time. This can be changed by setting `realtime` parameter to `false`. You can request three types of values: _term information_, _term statistics_, and _field statistics_. By default, all term information and field statistics are returned for all fields but term statistics are excluded. **Term information** * term frequency in the field (always returned) * term positions (`positions: true`) * start and end offsets (`offsets: true`) * term payloads (`payloads: true`), as base64 encoded bytes If the requested information wasn't stored in the index, it will be computed on the fly if possible. Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. > warn > Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. **Behaviour** The term and field statistics are not accurate. Deleted documents are not taken into account. The information is only retrieved for the shard the requested document resides in. The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. Use `routing` only to hit a particular shard.
@ -45,8 +86,12 @@ export default async function TermvectorsApi<TDocument = unknown> (this: That, p
export default async function TermvectorsApi<TDocument = unknown> (this: That, params: T.TermvectorsRequest<TDocument>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TermvectorsResponse, unknown>>
export default async function TermvectorsApi<TDocument = unknown> (this: That, params: T.TermvectorsRequest<TDocument>, options?: TransportRequestOptions): Promise<T.TermvectorsResponse>
export default async function TermvectorsApi<TDocument = unknown> (this: That, params: T.TermvectorsRequest<TDocument>, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index', 'id']
const acceptedBody: string[] = ['doc', 'filter', 'per_field_analyzer']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.termvectors
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +113,14 @@ export default async function TermvectorsApi<TDocument = unknown> (this: That, p
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,93 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class TextStructure {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'text_structure.find_field_structure': {
path: [],
body: [],
query: [
'column_names',
'delimiter',
'documents_to_sample',
'ecs_compatibility',
'explain',
'field',
'format',
'grok_pattern',
'index',
'quote',
'should_trim_fields',
'timeout',
'timestamp_field',
'timestamp_format'
]
},
'text_structure.find_message_structure': {
path: [],
body: [
'messages'
],
query: [
'column_names',
'delimiter',
'ecs_compatibility',
'explain',
'format',
'grok_pattern',
'quote',
'should_trim_fields',
'timeout',
'timestamp_field',
'timestamp_format'
]
},
'text_structure.find_structure': {
path: [],
body: [
'text_files'
],
query: [
'charset',
'column_names',
'delimiter',
'ecs_compatibility',
'explain',
'format',
'grok_pattern',
'has_header_row',
'line_merge_size_limit',
'lines_to_sample',
'quote',
'should_trim_fields',
'timeout',
'timestamp_field',
'timestamp_format'
]
},
'text_structure.test_grok_pattern': {
path: [],
body: [
'grok_pattern',
'text'
],
query: [
'ecs_compatibility'
]
}
}
}
/**
@ -51,7 +132,10 @@ export default class TextStructure {
async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TextStructureFindFieldStructureResponse, unknown>>
async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest, options?: TransportRequestOptions): Promise<T.TextStructureFindFieldStructureResponse>
async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['text_structure.find_field_structure']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -90,8 +174,12 @@ export default class TextStructure {
async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TextStructureFindMessageStructureResponse, unknown>>
async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest, options?: TransportRequestOptions): Promise<T.TextStructureFindMessageStructureResponse>
async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['messages']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['text_structure.find_message_structure']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -113,8 +201,14 @@ export default class TextStructure {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -134,8 +228,12 @@ export default class TextStructure {
async findStructure<TJsonDocument = unknown> (this: That, params: T.TextStructureFindStructureRequest<TJsonDocument>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TextStructureFindStructureResponse, unknown>>
async findStructure<TJsonDocument = unknown> (this: That, params: T.TextStructureFindStructureRequest<TJsonDocument>, options?: TransportRequestOptions): Promise<T.TextStructureFindStructureResponse>
async findStructure<TJsonDocument = unknown> (this: That, params: T.TextStructureFindStructureRequest<TJsonDocument>, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['text_files']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['text_structure.find_structure']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -147,8 +245,14 @@ export default class TextStructure {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -168,8 +272,12 @@ export default class TextStructure {
async testGrokPattern (this: That, params: T.TextStructureTestGrokPatternRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TextStructureTestGrokPatternResponse, unknown>>
async testGrokPattern (this: That, params: T.TextStructureTestGrokPatternRequest, options?: TransportRequestOptions): Promise<T.TextStructureTestGrokPatternResponse>
async testGrokPattern (this: That, params: T.TextStructureTestGrokPatternRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['grok_pattern', 'text']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['text_structure.test_grok_pattern']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -191,8 +299,14 @@ export default class TextStructure {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,170 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Transform {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'transform.delete_transform': {
path: [
'transform_id'
],
body: [],
query: [
'force',
'delete_dest_index',
'timeout'
]
},
'transform.get_node_stats': {
path: [],
body: [],
query: []
},
'transform.get_transform': {
path: [
'transform_id'
],
body: [],
query: [
'allow_no_match',
'from',
'size',
'exclude_generated'
]
},
'transform.get_transform_stats': {
path: [
'transform_id'
],
body: [],
query: [
'allow_no_match',
'from',
'size',
'timeout'
]
},
'transform.preview_transform': {
path: [
'transform_id'
],
body: [
'dest',
'description',
'frequency',
'pivot',
'source',
'settings',
'sync',
'retention_policy',
'latest'
],
query: [
'timeout'
]
},
'transform.put_transform': {
path: [
'transform_id'
],
body: [
'dest',
'description',
'frequency',
'latest',
'_meta',
'pivot',
'retention_policy',
'settings',
'source',
'sync'
],
query: [
'defer_validation',
'timeout'
]
},
'transform.reset_transform': {
path: [
'transform_id'
],
body: [],
query: [
'force',
'timeout'
]
},
'transform.schedule_now_transform': {
path: [
'transform_id'
],
body: [],
query: [
'timeout'
]
},
'transform.start_transform': {
path: [
'transform_id'
],
body: [],
query: [
'timeout',
'from'
]
},
'transform.stop_transform': {
path: [
'transform_id'
],
body: [],
query: [
'allow_no_match',
'force',
'timeout',
'wait_for_checkpoint',
'wait_for_completion'
]
},
'transform.update_transform': {
path: [
'transform_id'
],
body: [
'dest',
'description',
'frequency',
'_meta',
'source',
'settings',
'sync',
'retention_policy'
],
query: [
'defer_validation',
'timeout'
]
},
'transform.upgrade_transforms': {
path: [],
body: [],
query: [
'dry_run',
'timeout'
]
}
}
}
/**
@ -51,7 +209,10 @@ export default class Transform {
async deleteTransform (this: That, params: T.TransformDeleteTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformDeleteTransformResponse, unknown>>
async deleteTransform (this: That, params: T.TransformDeleteTransformRequest, options?: TransportRequestOptions): Promise<T.TransformDeleteTransformResponse>
async deleteTransform (this: That, params: T.TransformDeleteTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.delete_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -87,13 +248,16 @@ export default class Transform {
/**
* Retrieves transform usage information for transform nodes.
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform-node-stats.html | Elasticsearch API documentation}
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.0/get-transform-node-stats.html | Elasticsearch API documentation}
*/
async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['transform.get_node_stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -132,7 +296,10 @@ export default class Transform {
async getTransform (this: That, params?: T.TransformGetTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformGetTransformResponse, unknown>>
async getTransform (this: That, params?: T.TransformGetTransformRequest, options?: TransportRequestOptions): Promise<T.TransformGetTransformResponse>
async getTransform (this: That, params?: T.TransformGetTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.get_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -182,7 +349,10 @@ export default class Transform {
async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformGetTransformStatsResponse, unknown>>
async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest, options?: TransportRequestOptions): Promise<T.TransformGetTransformStatsResponse>
async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.get_transform_stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -224,8 +394,12 @@ export default class Transform {
async previewTransform<TTransform = unknown> (this: That, params?: T.TransformPreviewTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformPreviewTransformResponse<TTransform>, unknown>>
async previewTransform<TTransform = unknown> (this: That, params?: T.TransformPreviewTransformRequest, options?: TransportRequestOptions): Promise<T.TransformPreviewTransformResponse<TTransform>>
async previewTransform<TTransform = unknown> (this: That, params?: T.TransformPreviewTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const acceptedBody: string[] = ['dest', 'description', 'frequency', 'pivot', 'source', 'settings', 'sync', 'retention_policy', 'latest']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['transform.preview_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -248,8 +422,14 @@ export default class Transform {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -279,8 +459,12 @@ export default class Transform {
async putTransform (this: That, params: T.TransformPutTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformPutTransformResponse, unknown>>
async putTransform (this: That, params: T.TransformPutTransformRequest, options?: TransportRequestOptions): Promise<T.TransformPutTransformResponse>
async putTransform (this: That, params: T.TransformPutTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const acceptedBody: string[] = ['dest', 'description', 'frequency', 'latest', '_meta', 'pivot', 'retention_policy', 'settings', 'source', 'sync']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['transform.put_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -302,8 +486,14 @@ export default class Transform {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -326,7 +516,10 @@ export default class Transform {
async resetTransform (this: That, params: T.TransformResetTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformResetTransformResponse, unknown>>
async resetTransform (this: That, params: T.TransformResetTransformRequest, options?: TransportRequestOptions): Promise<T.TransformResetTransformResponse>
async resetTransform (this: That, params: T.TransformResetTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.reset_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -368,7 +561,10 @@ export default class Transform {
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformScheduleNowTransformResponse, unknown>>
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest, options?: TransportRequestOptions): Promise<T.TransformScheduleNowTransformResponse>
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.schedule_now_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -410,7 +606,10 @@ export default class Transform {
async startTransform (this: That, params: T.TransformStartTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformStartTransformResponse, unknown>>
async startTransform (this: That, params: T.TransformStartTransformRequest, options?: TransportRequestOptions): Promise<T.TransformStartTransformResponse>
async startTransform (this: That, params: T.TransformStartTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.start_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -452,7 +651,10 @@ export default class Transform {
async stopTransform (this: That, params: T.TransformStopTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformStopTransformResponse, unknown>>
async stopTransform (this: That, params: T.TransformStopTransformRequest, options?: TransportRequestOptions): Promise<T.TransformStopTransformResponse>
async stopTransform (this: That, params: T.TransformStopTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const {
path: acceptedPath
} = this.acceptedParams['transform.stop_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -494,8 +696,12 @@ export default class Transform {
async updateTransform (this: That, params: T.TransformUpdateTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformUpdateTransformResponse, unknown>>
async updateTransform (this: That, params: T.TransformUpdateTransformRequest, options?: TransportRequestOptions): Promise<T.TransformUpdateTransformResponse>
async updateTransform (this: That, params: T.TransformUpdateTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const acceptedBody: string[] = ['dest', 'description', 'frequency', '_meta', 'source', 'settings', 'sync', 'retention_policy']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['transform.update_transform']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -517,8 +723,14 @@ export default class Transform {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -541,7 +753,10 @@ export default class Transform {
async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformUpgradeTransformsResponse, unknown>>
async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest, options?: TransportRequestOptions): Promise<T.TransformUpgradeTransformsResponse>
async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['transform.upgrade_transforms']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,7 +35,45 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
update: {
path: [
'id',
'index'
],
body: [
'detect_noop',
'doc',
'doc_as_upsert',
'script',
'scripted_upsert',
'_source',
'upsert'
],
query: [
'if_primary_term',
'if_seq_no',
'include_source_on_error',
'lang',
'refresh',
'require_alias',
'retry_on_conflict',
'routing',
'timeout',
'wait_for_active_shards',
'_source',
'_source_excludes',
'_source_includes'
]
}
}
/**
* Update a document. Update a document by running a script or passing a partial document. If the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias. The script can update, delete, or skip modifying the document. The API also supports passing a partial document, which is merged into the existing document. To fully replace an existing document, use the index API. This operation: * Gets the document (collocated with the shard) from the index. * Runs the specified script. * Indexes the result. The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. The `_source` field must be enabled to use this API. In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp).
@ -45,8 +83,12 @@ export default async function UpdateApi<TDocument = unknown, TPartialDocument =
export default async function UpdateApi<TDocument = unknown, TPartialDocument = unknown, TDocumentR = unknown> (this: That, params: T.UpdateRequest<TDocument, TPartialDocument>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.UpdateResponse<TDocumentR>, unknown>>
export default async function UpdateApi<TDocument = unknown, TPartialDocument = unknown, TDocumentR = unknown> (this: That, params: T.UpdateRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<T.UpdateResponse<TDocumentR>>
export default async function UpdateApi<TDocument = unknown, TPartialDocument = unknown, TDocumentR = unknown> (this: That, params: T.UpdateRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id', 'index']
const acceptedBody: string[] = ['detect_noop', 'doc', 'doc_as_upsert', 'script', 'scripted_upsert', '_source', 'upsert']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = acceptedParams.update
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -68,8 +110,14 @@ export default async function UpdateApi<TDocument = unknown, TPartialDocument =
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,22 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
}
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
update_by_query_rethrottle: {
path: [
'task_id'
],
body: [],
query: [
'requests_per_second'
]
}
}
/**
* Throttle an update by query operation. Change the number of requests per second for a particular update by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.
@ -45,7 +60,10 @@ export default async function UpdateByQueryRethrottleApi (this: That, params: T.
export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.UpdateByQueryRethrottleResponse, unknown>>
export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest, options?: TransportRequestOptions): Promise<T.UpdateByQueryRethrottleResponse>
export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_id']
const {
path: acceptedPath
} = acceptedParams.update_by_query_rethrottle
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -35,12 +35,148 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
export default class Watcher {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'watcher.ack_watch': {
path: [
'watch_id',
'action_id'
],
body: [],
query: []
},
'watcher.activate_watch': {
path: [
'watch_id'
],
body: [],
query: []
},
'watcher.deactivate_watch': {
path: [
'watch_id'
],
body: [],
query: []
},
'watcher.delete_watch': {
path: [
'id'
],
body: [],
query: []
},
'watcher.execute_watch': {
path: [
'id'
],
body: [
'action_modes',
'alternative_input',
'ignore_condition',
'record_execution',
'simulated_actions',
'trigger_data',
'watch'
],
query: [
'debug'
]
},
'watcher.get_settings': {
path: [],
body: [],
query: [
'master_timeout'
]
},
'watcher.get_watch': {
path: [
'id'
],
body: [],
query: []
},
'watcher.put_watch': {
path: [
'id'
],
body: [
'actions',
'condition',
'input',
'metadata',
'throttle_period',
'throttle_period_in_millis',
'transform',
'trigger'
],
query: [
'active',
'if_primary_term',
'if_seq_no',
'version'
]
},
'watcher.query_watches': {
path: [],
body: [
'from',
'size',
'query',
'sort',
'search_after'
],
query: []
},
'watcher.start': {
path: [],
body: [],
query: [
'master_timeout'
]
},
'watcher.stats': {
path: [
'metric'
],
body: [],
query: [
'emit_stacktraces',
'metric'
]
},
'watcher.stop': {
path: [],
body: [],
query: [
'master_timeout'
]
},
'watcher.update_settings': {
path: [],
body: [
'index.auto_expand_replicas',
'index.number_of_replicas'
],
query: [
'master_timeout',
'timeout'
]
}
}
}
/**
@ -51,7 +187,10 @@ export default class Watcher {
async ackWatch (this: That, params: T.WatcherAckWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherAckWatchResponse, unknown>>
async ackWatch (this: That, params: T.WatcherAckWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherAckWatchResponse>
async ackWatch (this: That, params: T.WatcherAckWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['watch_id', 'action_id']
const {
path: acceptedPath
} = this.acceptedParams['watcher.ack_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -101,7 +240,10 @@ export default class Watcher {
async activateWatch (this: That, params: T.WatcherActivateWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherActivateWatchResponse, unknown>>
async activateWatch (this: That, params: T.WatcherActivateWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherActivateWatchResponse>
async activateWatch (this: That, params: T.WatcherActivateWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['watch_id']
const {
path: acceptedPath
} = this.acceptedParams['watcher.activate_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -143,7 +285,10 @@ export default class Watcher {
async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherDeactivateWatchResponse, unknown>>
async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherDeactivateWatchResponse>
async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['watch_id']
const {
path: acceptedPath
} = this.acceptedParams['watcher.deactivate_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -185,7 +330,10 @@ export default class Watcher {
async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherDeleteWatchResponse, unknown>>
async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherDeleteWatchResponse>
async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['watcher.delete_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -227,8 +375,12 @@ export default class Watcher {
async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherExecuteWatchResponse, unknown>>
async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherExecuteWatchResponse>
async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['action_modes', 'alternative_input', 'ignore_condition', 'record_execution', 'simulated_actions', 'trigger_data', 'watch']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['watcher.execute_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -251,8 +403,14 @@ export default class Watcher {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -282,7 +440,10 @@ export default class Watcher {
async getSettings (this: That, params?: T.WatcherGetSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherGetSettingsResponse, unknown>>
async getSettings (this: That, params?: T.WatcherGetSettingsRequest, options?: TransportRequestOptions): Promise<T.WatcherGetSettingsResponse>
async getSettings (this: That, params?: T.WatcherGetSettingsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['watcher.get_settings']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -322,7 +483,10 @@ export default class Watcher {
async getWatch (this: That, params: T.WatcherGetWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherGetWatchResponse, unknown>>
async getWatch (this: That, params: T.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherGetWatchResponse>
async getWatch (this: That, params: T.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['watcher.get_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -364,8 +528,12 @@ export default class Watcher {
async putWatch (this: That, params: T.WatcherPutWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherPutWatchResponse, unknown>>
async putWatch (this: That, params: T.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherPutWatchResponse>
async putWatch (this: That, params: T.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const acceptedBody: string[] = ['actions', 'condition', 'input', 'metadata', 'throttle_period', 'throttle_period_in_millis', 'transform', 'trigger']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['watcher.put_watch']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -387,8 +555,14 @@ export default class Watcher {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -411,8 +585,12 @@ export default class Watcher {
async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherQueryWatchesResponse, unknown>>
async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest, options?: TransportRequestOptions): Promise<T.WatcherQueryWatchesResponse>
async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['from', 'size', 'query', 'sort', 'search_after']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['watcher.query_watches']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -435,8 +613,14 @@ export default class Watcher {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}
@ -456,7 +640,10 @@ export default class Watcher {
async start (this: That, params?: T.WatcherStartRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherStartResponse, unknown>>
async start (this: That, params?: T.WatcherStartRequest, options?: TransportRequestOptions): Promise<T.WatcherStartResponse>
async start (this: That, params?: T.WatcherStartRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['watcher.start']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -496,7 +683,10 @@ export default class Watcher {
async stats (this: That, params?: T.WatcherStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherStatsResponse, unknown>>
async stats (this: That, params?: T.WatcherStatsRequest, options?: TransportRequestOptions): Promise<T.WatcherStatsResponse>
async stats (this: That, params?: T.WatcherStatsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['metric']
const {
path: acceptedPath
} = this.acceptedParams['watcher.stats']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -546,7 +736,10 @@ export default class Watcher {
async stop (this: That, params?: T.WatcherStopRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherStopResponse, unknown>>
async stop (this: That, params?: T.WatcherStopRequest, options?: TransportRequestOptions): Promise<T.WatcherStopResponse>
async stop (this: That, params?: T.WatcherStopRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['watcher.stop']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -586,8 +779,12 @@ export default class Watcher {
async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherUpdateSettingsResponse, unknown>>
async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest, options?: TransportRequestOptions): Promise<T.WatcherUpdateSettingsResponse>
async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['index.auto_expand_replicas', 'index.number_of_replicas']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['watcher.update_settings']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -610,8 +807,14 @@ export default class Watcher {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

View File

@ -35,12 +35,35 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }
interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}
export default class Xpack {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'xpack.info': {
path: [],
body: [],
query: [
'categories',
'accept_enterprise',
'human'
]
},
'xpack.usage': {
path: [],
body: [],
query: [
'master_timeout'
]
}
}
}
/**
@ -51,7 +74,10 @@ export default class Xpack {
async info (this: That, params?: T.XpackInfoRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.XpackInfoResponse, unknown>>
async info (this: That, params?: T.XpackInfoRequest, options?: TransportRequestOptions): Promise<T.XpackInfoResponse>
async info (this: That, params?: T.XpackInfoRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['xpack.info']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
@ -91,7 +117,10 @@ export default class Xpack {
async usage (this: That, params?: T.XpackUsageRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.XpackUsageResponse, unknown>>
async usage (this: That, params?: T.XpackUsageRequest, options?: TransportRequestOptions): Promise<T.XpackUsageResponse>
async usage (this: That, params?: T.XpackUsageRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['xpack.usage']
const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

View File

@ -212,12 +212,22 @@ export interface CreateRequest<TDocument = unknown> extends RequestBase {
id: Id
/** The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn't exist and doesnt match a data stream template, this request creates the index. */
index: IndexName
/** Only perform the operation if the document has this primary term. */
if_primary_term?: long
/** Only perform the operation if the document has this sequence number. */
if_seq_no?: SequenceNumber
/** True or false if to include the document source in the error message in case of parsing errors. */
include_source_on_error?: boolean
/** Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. The behavior is the same as using the `<index>/_create` endpoint. If a document ID is specified, this paramater defaults to `index`. Otherwise, it defaults to `create`. If the request targets a data stream, an `op_type` of `create` is required. */
op_type?: OpType
/** The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final pipeline is configured, it will always run regardless of the value of this parameter. */
pipeline?: string
/** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. */
refresh?: Refresh
/** If `true`, the destination must be an index alias. */
require_alias?: boolean
/** If `true`, the request's actions must target a data stream (existing or to be created). */
require_data_stream?: boolean
/** A custom value that is used to route operations to a specific shard. */
routing?: Routing
/** The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. Elasticsearch waits for at least the specified timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur. This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur. */
@ -230,9 +240,9 @@ export interface CreateRequest<TDocument = unknown> extends RequestBase {
wait_for_active_shards?: WaitForActiveShards
document?: TDocument
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { id?: never, index?: never, include_source_on_error?: never, pipeline?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, document?: never }
body?: string | { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, include_source_on_error?: never, op_type?: never, pipeline?: never, refresh?: never, require_alias?: never, require_data_stream?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, document?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { id?: never, index?: never, include_source_on_error?: never, pipeline?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, document?: never }
querystring?: { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, include_source_on_error?: never, op_type?: never, pipeline?: never, refresh?: never, require_alias?: never, require_data_stream?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, document?: never }
}
export type CreateResponse = WriteResponseBase
@ -2514,7 +2524,17 @@ export interface TermvectorsRequest<TDocument = unknown> extends RequestBase {
index: IndexName
/** A unique identifier for the document. */
id?: Id
/** A comma-separated list or wildcard expressions of fields to include in the statistics. It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. */
/** The node or shard the operation should be performed on. It is random by default. */
preference?: string
/** If true, the request is real-time as opposed to near-real-time. */
realtime?: boolean
/** An artificial document (a document not present in the index) for which you want to retrieve term vectors. */
doc?: TDocument
/** Filter terms based on their tf-idf scores. This could be useful in order find out a good characteristic vector of a document. This feature works in a similar manner to the second phase of the More Like This Query. */
filter?: TermvectorsFilter
/** Override the default per-field analyzer. This is useful in order to generate term vectors in any fashion, especially when using artificial documents. When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. */
per_field_analyzer?: Record<Field, string>
/** A list of fields to include in the statistics. It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. */
fields?: Fields
/** If `true`, the response includes: * The document count (how many documents contain this field). * The sum of document frequencies (the sum of document frequencies for all terms in this field). * The sum of total term frequencies (the sum of total term frequencies of each term in this field). */
field_statistics?: boolean
@ -2524,28 +2544,18 @@ export interface TermvectorsRequest<TDocument = unknown> extends RequestBase {
payloads?: boolean
/** If `true`, the response includes term positions. */
positions?: boolean
/** The node or shard the operation should be performed on. It is random by default. */
preference?: string
/** If true, the request is real-time as opposed to near-real-time. */
realtime?: boolean
/** A custom value that is used to route operations to a specific shard. */
routing?: Routing
/** If `true`, the response includes: * The total term frequency (how often a term occurs in all documents). * The document frequency (the number of documents containing the current term). By default these values are not returned since term statistics can have a serious performance impact. */
term_statistics?: boolean
/** A custom value that is used to route operations to a specific shard. */
routing?: Routing
/** If `true`, returns the document version as part of a hit. */
version?: VersionNumber
/** The version type. */
version_type?: VersionType
/** An artificial document (a document not present in the index) for which you want to retrieve term vectors. */
doc?: TDocument
/** Filter terms based on their tf-idf scores. This could be useful in order find out a good characteristic vector of a document. This feature works in a similar manner to the second phase of the More Like This Query. */
filter?: TermvectorsFilter
/** Override the default per-field analyzer. This is useful in order to generate term vectors in any fashion, especially when using artificial documents. When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. */
per_field_analyzer?: Record<Field, string>
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { index?: never, id?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, preference?: never, realtime?: never, routing?: never, term_statistics?: never, version?: never, version_type?: never, doc?: never, filter?: never, per_field_analyzer?: never }
body?: string | { [key: string]: any } & { index?: never, id?: never, preference?: never, realtime?: never, doc?: never, filter?: never, per_field_analyzer?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, term_statistics?: never, routing?: never, version?: never, version_type?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { index?: never, id?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, preference?: never, realtime?: never, routing?: never, term_statistics?: never, version?: never, version_type?: never, doc?: never, filter?: never, per_field_analyzer?: never }
querystring?: { [key: string]: any } & { index?: never, id?: never, preference?: never, realtime?: never, doc?: never, filter?: never, per_field_analyzer?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, term_statistics?: never, routing?: never, version?: never, version_type?: never }
}
export interface TermvectorsResponse {
@ -2775,7 +2785,6 @@ export interface BulkIndexByScrollFailure {
id: Id
index: IndexName
status: integer
type: string
}
export interface BulkStats {
@ -5045,7 +5054,7 @@ export interface AggregationsWeightedAverageValue {
export interface AggregationsWeightedAvgAggregate extends AggregationsSingleMetricAggregateBase {
}
export type AnalysisAnalyzer = AnalysisCustomAnalyzer | AnalysisFingerprintAnalyzer | AnalysisKeywordAnalyzer | AnalysisLanguageAnalyzer | AnalysisNoriAnalyzer | AnalysisPatternAnalyzer | AnalysisSimpleAnalyzer | AnalysisStandardAnalyzer | AnalysisStopAnalyzer | AnalysisWhitespaceAnalyzer | AnalysisIcuAnalyzer | AnalysisKuromojiAnalyzer | AnalysisSnowballAnalyzer | AnalysisArabicAnalyzer | AnalysisArmenianAnalyzer | AnalysisBasqueAnalyzer | AnalysisBengaliAnalyzer | AnalysisBrazilianAnalyzer | AnalysisBulgarianAnalyzer | AnalysisCatalanAnalyzer | AnalysisChineseAnalyzer | AnalysisCjkAnalyzer | AnalysisCzechAnalyzer | AnalysisDanishAnalyzer | AnalysisDutchAnalyzer | AnalysisEnglishAnalyzer | AnalysisEstonianAnalyzer | AnalysisFinnishAnalyzer | AnalysisFrenchAnalyzer | AnalysisGalicianAnalyzer | AnalysisGermanAnalyzer | AnalysisGreekAnalyzer | AnalysisHindiAnalyzer | AnalysisHungarianAnalyzer | AnalysisIndonesianAnalyzer | AnalysisIrishAnalyzer | AnalysisItalianAnalyzer | AnalysisLatvianAnalyzer | AnalysisLithuanianAnalyzer | AnalysisNorwegianAnalyzer | AnalysisPersianAnalyzer | AnalysisPortugueseAnalyzer | AnalysisRomanianAnalyzer | AnalysisRussianAnalyzer | AnalysisSerbianAnalyzer | AnalysisSoraniAnalyzer | AnalysisSpanishAnalyzer | AnalysisSwedishAnalyzer | AnalysisTurkishAnalyzer | AnalysisThaiAnalyzer
export type AnalysisAnalyzer = AnalysisCustomAnalyzer | AnalysisFingerprintAnalyzer | AnalysisKeywordAnalyzer | AnalysisNoriAnalyzer | AnalysisPatternAnalyzer | AnalysisSimpleAnalyzer | AnalysisStandardAnalyzer | AnalysisStopAnalyzer | AnalysisWhitespaceAnalyzer | AnalysisIcuAnalyzer | AnalysisKuromojiAnalyzer | AnalysisSnowballAnalyzer | AnalysisArabicAnalyzer | AnalysisArmenianAnalyzer | AnalysisBasqueAnalyzer | AnalysisBengaliAnalyzer | AnalysisBrazilianAnalyzer | AnalysisBulgarianAnalyzer | AnalysisCatalanAnalyzer | AnalysisChineseAnalyzer | AnalysisCjkAnalyzer | AnalysisCzechAnalyzer | AnalysisDanishAnalyzer | AnalysisDutchAnalyzer | AnalysisEnglishAnalyzer | AnalysisEstonianAnalyzer | AnalysisFinnishAnalyzer | AnalysisFrenchAnalyzer | AnalysisGalicianAnalyzer | AnalysisGermanAnalyzer | AnalysisGreekAnalyzer | AnalysisHindiAnalyzer | AnalysisHungarianAnalyzer | AnalysisIndonesianAnalyzer | AnalysisIrishAnalyzer | AnalysisItalianAnalyzer | AnalysisLatvianAnalyzer | AnalysisLithuanianAnalyzer | AnalysisNorwegianAnalyzer | AnalysisPersianAnalyzer | AnalysisPortugueseAnalyzer | AnalysisRomanianAnalyzer | AnalysisRussianAnalyzer | AnalysisSerbianAnalyzer | AnalysisSoraniAnalyzer | AnalysisSpanishAnalyzer | AnalysisSwedishAnalyzer | AnalysisTurkishAnalyzer | AnalysisThaiAnalyzer
export interface AnalysisArabicAnalyzer {
type: 'arabic'
@ -5481,17 +5490,6 @@ export interface AnalysisKuromojiTokenizer extends AnalysisTokenizerBase {
discard_compound_token?: boolean
}
export type AnalysisLanguage = 'Arabic' | 'Armenian' | 'Basque' | 'Brazilian' | 'Bulgarian' | 'Catalan' | 'Chinese' | 'Cjk' | 'Czech' | 'Danish' | 'Dutch' | 'English' | 'Estonian' | 'Finnish' | 'French' | 'Galician' | 'German' | 'Greek' | 'Hindi' | 'Hungarian' | 'Indonesian' | 'Irish' | 'Italian' | 'Latvian' | 'Norwegian' | 'Persian' | 'Portuguese' | 'Romanian' | 'Russian' | 'Sorani' | 'Spanish' | 'Swedish' | 'Turkish' | 'Thai'
export interface AnalysisLanguageAnalyzer {
type: 'language'
version?: VersionString
language: AnalysisLanguage
stem_exclusion: string[]
stopwords?: AnalysisStopWords
stopwords_path?: string
}
export interface AnalysisLatvianAnalyzer {
type: 'latvian'
stopwords?: AnalysisStopWords
@ -6016,6 +6014,8 @@ export interface MappingDateNanosProperty extends MappingDocValuesPropertyBase {
format?: string
ignore_malformed?: boolean
index?: boolean
script?: Script | string
on_script_error?: MappingOnScriptError
null_value?: DateTime
precision_step?: integer
type: 'date_nanos'
@ -6027,6 +6027,8 @@ export interface MappingDateProperty extends MappingDocValuesPropertyBase {
format?: string
ignore_malformed?: boolean
index?: boolean
script?: Script | string
on_script_error?: MappingOnScriptError
null_value?: DateTime
precision_step?: integer
locale?: string
@ -6103,7 +6105,7 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase {
export interface MappingDynamicTemplate {
mapping?: MappingProperty
runtime?: MappingProperty
runtime?: MappingRuntimeField
match?: string | string[]
path_match?: string | string[]
unmatch?: string | string[]
@ -6167,6 +6169,7 @@ export interface MappingGeoShapeProperty extends MappingDocValuesPropertyBase {
coerce?: boolean
ignore_malformed?: boolean
ignore_z_value?: boolean
index?: boolean
orientation?: MappingGeoOrientation
strategy?: MappingGeoStrategy
type: 'geo_shape'
@ -6298,7 +6301,7 @@ export interface MappingNumberPropertyBase extends MappingDocValuesPropertyBase
export interface MappingObjectProperty extends MappingCorePropertyBase {
enabled?: boolean
subobjects?: boolean
subobjects?: MappingSubobjects
type?: 'object'
}
@ -6369,7 +6372,7 @@ export interface MappingRuntimeFieldFetchFields {
format?: string
}
export type MappingRuntimeFieldType = 'boolean' | 'composite' | 'date' | 'double' | 'geo_point' | 'ip' | 'keyword' | 'long' | 'lookup'
export type MappingRuntimeFieldType = 'boolean' | 'composite' | 'date' | 'double' | 'geo_point' | 'geo_shape' | 'ip' | 'keyword' | 'long' | 'lookup'
export type MappingRuntimeFields = Record<Field, MappingRuntimeField>
@ -6395,7 +6398,8 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase
export interface MappingSemanticTextProperty {
type: 'semantic_text'
meta?: Record<string, string>
inference_id: Id
inference_id?: Id
search_inference_id?: Id
}
export interface MappingShapeProperty extends MappingDocValuesPropertyBase {
@ -6430,6 +6434,8 @@ export interface MappingSparseVectorProperty extends MappingPropertyBase {
type: 'sparse_vector'
}
export type MappingSubobjects = boolean | 'true' | 'false' | 'auto'
export interface MappingSuggestContext {
name: Name
path?: Field
@ -6481,7 +6487,7 @@ export interface MappingTypeMapping {
date_detection?: boolean
dynamic?: MappingDynamicMapping
dynamic_date_formats?: string[]
dynamic_templates?: Record<string, MappingDynamicTemplate>[]
dynamic_templates?: Partial<Record<string, MappingDynamicTemplate>>[]
_field_names?: MappingFieldNamesField
index_field?: MappingIndexField
_meta?: Metadata
@ -6492,7 +6498,7 @@ export interface MappingTypeMapping {
_source?: MappingSourceField
runtime?: Record<string, MappingRuntimeField>
enabled?: boolean
subobjects?: boolean
subobjects?: MappingSubobjects
_data_stream_timestamp?: MappingDataStreamTimestamp
}
@ -6677,6 +6683,12 @@ export type QueryDslGeoDistanceQuery = QueryDslGeoDistanceQueryKeys
export type QueryDslGeoExecution = 'memory' | 'indexed'
export interface QueryDslGeoGridQuery extends QueryDslQueryBase {
geogrid?: GeoTile
geohash?: GeoHash
geohex?: GeoHexCell
}
export interface QueryDslGeoPolygonPoints {
points: GeoLocation[]
}
@ -6972,6 +6984,7 @@ export interface QueryDslQueryContainer {
fuzzy?: Partial<Record<Field, QueryDslFuzzyQuery | string | double | boolean>>
geo_bounding_box?: QueryDslGeoBoundingBoxQuery
geo_distance?: QueryDslGeoDistanceQuery
geo_grid?: Partial<Record<Field, QueryDslGeoGridQuery>>
geo_polygon?: QueryDslGeoPolygonQuery
geo_shape?: QueryDslGeoShapeQuery
has_child?: QueryDslHasChildQuery
@ -11937,8 +11950,6 @@ export interface EsqlAsyncQueryRequest extends RequestBase {
keep_alive?: Duration
/** Indicates whether the query and its results are stored in the cluster. If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the `wait_for_completion_timeout` parameter. */
keep_on_completion?: boolean
/** The period to wait for the request to finish. By default, the request waits for 1 second for the query results. If the query completes during this period, results are returned Otherwise, a query ID is returned that can later be used to retrieve the results. */
wait_for_completion_timeout?: Duration
/** By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. */
columnar?: boolean
/** Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. */
@ -11954,10 +11965,12 @@ export interface EsqlAsyncQueryRequest extends RequestBase {
tables?: Record<string, Record<string, EsqlTableValuesContainer>>
/** When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as shards count. */
include_ccs_metadata?: boolean
/** The period to wait for the request to finish. By default, the request waits for 1 second for the query results. If the query completes during this period, results are returned Otherwise, a query ID is returned that can later be used to retrieve the results. */
wait_for_completion_timeout?: Duration
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { delimiter?: never, drop_null_columns?: never, format?: never, keep_alive?: never, keep_on_completion?: never, wait_for_completion_timeout?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never, include_ccs_metadata?: never }
body?: string | { [key: string]: any } & { delimiter?: never, drop_null_columns?: never, format?: never, keep_alive?: never, keep_on_completion?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never, include_ccs_metadata?: never, wait_for_completion_timeout?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { delimiter?: never, drop_null_columns?: never, format?: never, keep_alive?: never, keep_on_completion?: never, wait_for_completion_timeout?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never, include_ccs_metadata?: never }
querystring?: { [key: string]: any } & { delimiter?: never, drop_null_columns?: never, format?: never, keep_alive?: never, keep_on_completion?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never, include_ccs_metadata?: never, wait_for_completion_timeout?: never }
}
export type EsqlAsyncQueryResponse = EsqlResult
@ -12800,7 +12813,7 @@ export interface IndicesIndexSettingsKeys {
routing_partition_size?: SpecUtilsStringified<integer>
load_fixed_bitset_filters_eagerly?: boolean
hidden?: boolean | string
auto_expand_replicas?: string
auto_expand_replicas?: SpecUtilsWithNullValue<string>
merge?: IndicesMerge
search?: IndicesSettingsSearch
refresh_interval?: Duration
@ -13097,7 +13110,7 @@ export interface IndicesSoftDeletes {
retention_lease?: IndicesRetentionLease
}
export type IndicesSourceMode = 'DISABLED' | 'STORED' | 'SYNTHETIC'
export type IndicesSourceMode = 'disabled' | 'stored' | 'synthetic'
export interface IndicesStorage {
type: IndicesStorageType
@ -13618,12 +13631,16 @@ export type IndicesExistsAliasResponse = boolean
export interface IndicesExistsIndexTemplateRequest extends RequestBase {
/** Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. */
name: Name
/** If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. */
local?: boolean
/** If true, returns settings in flat format. */
flat_settings?: boolean
/** Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. */
master_timeout?: Duration
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { name?: never, master_timeout?: never }
body?: string | { [key: string]: any } & { name?: never, local?: never, flat_settings?: never, master_timeout?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { name?: never, master_timeout?: never }
querystring?: { [key: string]: any } & { name?: never, local?: never, flat_settings?: never, master_timeout?: never }
}
export type IndicesExistsIndexTemplateResponse = boolean
@ -13712,12 +13729,10 @@ export interface IndicesFieldUsageStatsRequest extends RequestBase {
ignore_unavailable?: boolean
/** Comma-separated list or wildcard expressions of fields to include in the statistics. */
fields?: Fields
/** The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */
wait_for_active_shards?: WaitForActiveShards
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, fields?: never, wait_for_active_shards?: never }
body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, fields?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, fields?: never, wait_for_active_shards?: never }
querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, fields?: never }
}
export type IndicesFieldUsageStatsResponse = IndicesFieldUsageStatsFieldsUsageBody
@ -13922,10 +13937,12 @@ export interface IndicesGetFieldMappingRequest extends RequestBase {
ignore_unavailable?: boolean
/** If `true`, return all default settings in the response. */
include_defaults?: boolean
/** If `true`, the request retrieves information from the local node only. */
local?: boolean
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { fields?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_defaults?: never }
body?: string | { [key: string]: any } & { fields?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_defaults?: never, local?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { fields?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_defaults?: never }
querystring?: { [key: string]: any } & { fields?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_defaults?: never, local?: never }
}
export type IndicesGetFieldMappingResponse = Record<IndexName, IndicesGetFieldMappingTypeFieldMappings>
@ -14275,7 +14292,7 @@ export interface IndicesPutMappingRequest extends RequestBase {
/** If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string. */
dynamic_date_formats?: string[]
/** Specify dynamic templates for the mapping. */
dynamic_templates?: Record<string, MappingDynamicTemplate> | Record<string, MappingDynamicTemplate>[]
dynamic_templates?: Partial<Record<string, MappingDynamicTemplate>>[]
/** Control whether field names are enabled for the index. */
_field_names?: MappingFieldNamesField
/** A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata. */
@ -14313,13 +14330,15 @@ export interface IndicesPutSettingsRequest extends RequestBase {
master_timeout?: Duration
/** If `true`, existing index settings remain unchanged. */
preserve_existing?: boolean
/** Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. */
reopen?: boolean
/** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */
timeout?: Duration
settings?: IndicesIndexSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, master_timeout?: never, preserve_existing?: never, timeout?: never, settings?: never }
body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, master_timeout?: never, preserve_existing?: never, reopen?: never, timeout?: never, settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, master_timeout?: never, preserve_existing?: never, timeout?: never, settings?: never }
querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, master_timeout?: never, preserve_existing?: never, reopen?: never, timeout?: never, settings?: never }
}
export type IndicesPutSettingsResponse = AcknowledgedResponseBase
@ -14503,10 +14522,12 @@ export interface IndicesReloadSearchAnalyzersRequest extends RequestBase {
expand_wildcards?: ExpandWildcards
/** Whether specified concrete indices should be ignored when unavailable (missing or closed) */
ignore_unavailable?: boolean
/** Changed resource to reload analyzers from if applicable */
resource?: string
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never }
body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, resource?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never }
querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, resource?: never }
}
export type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult
@ -14592,6 +14613,8 @@ export interface IndicesRolloverRequest extends RequestBase {
timeout?: Duration
/** The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */
wait_for_active_shards?: WaitForActiveShards
/** If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams. */
lazy?: boolean
/** Aliases for the target index. Data streams do not support this parameter. */
aliases?: Record<IndexName, IndicesAlias>
/** Conditions for the rollover. If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. If this parameter is not specified, Elasticsearch performs the rollover unconditionally. If conditions are specified, at least one of them must be a `max_*` condition. The index will rollover if any `max_*` condition is satisfied and all `min_*` conditions are satisfied. */
@ -14601,9 +14624,9 @@ export interface IndicesRolloverRequest extends RequestBase {
/** Configuration options for the index. Data streams do not support this parameter. */
settings?: Record<string, any>
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { alias?: never, new_index?: never, dry_run?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, conditions?: never, mappings?: never, settings?: never }
body?: string | { [key: string]: any } & { alias?: never, new_index?: never, dry_run?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, lazy?: never, aliases?: never, conditions?: never, mappings?: never, settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { alias?: never, new_index?: never, dry_run?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, conditions?: never, mappings?: never, settings?: never }
querystring?: { [key: string]: any } & { alias?: never, new_index?: never, dry_run?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, lazy?: never, aliases?: never, conditions?: never, mappings?: never, settings?: never }
}
export interface IndicesRolloverResponse {
@ -14768,14 +14791,18 @@ export interface IndicesShrinkResponse {
export interface IndicesSimulateIndexTemplateRequest extends RequestBase {
/** Name of the index to simulate */
name: Name
/** Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one */
create?: boolean
/** User defined reason for dry-run creating the new template for simulation purposes */
cause?: string
/** Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. */
master_timeout?: Duration
/** If true, returns all relevant default configurations for the index template. */
include_defaults?: boolean
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, include_defaults?: never }
body?: string | { [key: string]: any } & { name?: never, create?: never, cause?: never, master_timeout?: never, include_defaults?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, include_defaults?: never }
querystring?: { [key: string]: any } & { name?: never, create?: never, cause?: never, master_timeout?: never, include_defaults?: never }
}
export interface IndicesSimulateIndexTemplateResponse {
@ -14793,6 +14820,8 @@ export interface IndicesSimulateTemplateRequest extends RequestBase {
name?: Name
/** If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. */
create?: boolean
/** User defined reason for dry-run creating the new template for simulation purposes */
cause?: string
/** Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. */
master_timeout?: Duration
/** If true, returns all relevant default configurations for the index template. */
@ -14818,9 +14847,9 @@ export interface IndicesSimulateTemplateRequest extends RequestBase {
/** Marks this index template as deprecated. When creating or updating a non-deprecated index template that uses deprecated components, Elasticsearch will emit a deprecation warning. */
deprecated?: boolean
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, include_defaults?: never, allow_auto_create?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, ignore_missing_component_templates?: never, deprecated?: never }
body?: string | { [key: string]: any } & { name?: never, create?: never, cause?: never, master_timeout?: never, include_defaults?: never, allow_auto_create?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, ignore_missing_component_templates?: never, deprecated?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, include_defaults?: never, allow_auto_create?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, ignore_missing_component_templates?: never, deprecated?: never }
querystring?: { [key: string]: any } & { name?: never, create?: never, cause?: never, master_timeout?: never, include_defaults?: never, allow_auto_create?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, ignore_missing_component_templates?: never, deprecated?: never }
}
export interface IndicesSimulateTemplateResponse {
@ -15126,6 +15155,10 @@ export interface IndicesValidateQueryResponse {
error?: string
}
export interface InferenceCompletionInferenceResult {
completion: InferenceCompletionResult[]
}
export interface InferenceCompletionResult {
result: string
}
@ -15157,23 +15190,26 @@ export interface InferenceInferenceEndpointInfo extends InferenceInferenceEndpoi
task_type: InferenceTaskType
}
export interface InferenceInferenceResult {
text_embedding_bytes?: InferenceTextEmbeddingByteResult[]
text_embedding_bits?: InferenceTextEmbeddingByteResult[]
text_embedding?: InferenceTextEmbeddingResult[]
sparse_embedding?: InferenceSparseEmbeddingResult[]
completion?: InferenceCompletionResult[]
rerank?: InferenceRankedDocument[]
}
export interface InferenceRankedDocument {
index: integer
relevance_score: float
text?: string
}
export interface InferenceRateLimitSetting {
requests_per_minute?: integer
}
export interface InferenceRerankedInferenceResult {
rerank: InferenceRankedDocument[]
}
export type InferenceServiceSettings = any
export interface InferenceSparseEmbeddingInferenceResult {
sparse_embedding: InferenceSparseEmbeddingResult[]
}
export interface InferenceSparseEmbeddingResult {
embedding: InferenceSparseVector
}
@ -15182,16 +15218,116 @@ export type InferenceSparseVector = Record<string, float>
export type InferenceTaskSettings = any
export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion'
export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion' | 'chat_completion'
export interface InferenceTextEmbeddingByteResult {
embedding: InferenceDenseByteVector
}
export interface InferenceTextEmbeddingInferenceResult {
text_embedding_bytes?: InferenceTextEmbeddingByteResult[]
text_embedding_bits?: InferenceTextEmbeddingByteResult[]
text_embedding?: InferenceTextEmbeddingResult[]
}
export interface InferenceTextEmbeddingResult {
embedding: InferenceDenseVector
}
export interface InferenceChatCompletionUnifiedCompletionTool {
type: string
function: InferenceChatCompletionUnifiedCompletionToolFunction
}
export interface InferenceChatCompletionUnifiedCompletionToolChoice {
type: string
function: InferenceChatCompletionUnifiedCompletionToolChoiceFunction
}
export interface InferenceChatCompletionUnifiedCompletionToolChoiceFunction {
name: string
}
export interface InferenceChatCompletionUnifiedCompletionToolFunction {
description?: string
name: string
parameters?: any
strict?: boolean
}
export type InferenceChatCompletionUnifiedCompletionToolType = string | InferenceChatCompletionUnifiedCompletionToolChoice
export interface InferenceChatCompletionUnifiedContentObject {
text: string
type: string
}
export interface InferenceChatCompletionUnifiedMessage {
content?: InferenceChatCompletionUnifiedMessageContent
role: string
tool_call_id?: Id
tool_calls?: InferenceChatCompletionUnifiedToolCall[]
}
export type InferenceChatCompletionUnifiedMessageContent = string | InferenceChatCompletionUnifiedContentObject[]
export interface InferenceChatCompletionUnifiedRequest extends RequestBase {
/** The inference Id */
inference_id: Id
/** Specifies the amount of time to wait for the inference request to complete. */
timeout?: Duration
/** A list of objects representing the conversation. */
messages: InferenceChatCompletionUnifiedMessage[]
/** The ID of the model to use. */
model?: string
/** The upper bound limit for the number of tokens that can be generated for a completion request. */
max_completion_tokens?: long
/** A sequence of strings to control when the model should stop generating additional tokens. */
stop?: string[]
/** The sampling temperature to use. */
temperature?: float
/** Controls which tool is called by the model. */
tool_choice?: InferenceChatCompletionUnifiedCompletionToolType
/** A list of tools that the model can call. */
tools?: InferenceChatCompletionUnifiedCompletionTool[]
/** Nucleus sampling, an alternative to sampling with temperature. */
top_p?: float
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { inference_id?: never, timeout?: never, messages?: never, model?: never, max_completion_tokens?: never, stop?: never, temperature?: never, tool_choice?: never, tools?: never, top_p?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { inference_id?: never, timeout?: never, messages?: never, model?: never, max_completion_tokens?: never, stop?: never, temperature?: never, tool_choice?: never, tools?: never, top_p?: never }
}
export type InferenceChatCompletionUnifiedResponse = StreamResult
export interface InferenceChatCompletionUnifiedToolCall {
id: Id
function: InferenceChatCompletionUnifiedToolCallFunction
type: string
}
export interface InferenceChatCompletionUnifiedToolCallFunction {
arguments: string
name: string
}
export interface InferenceCompletionRequest extends RequestBase {
/** The inference Id */
inference_id: Id
/** Specifies the amount of time to wait for the inference request to complete. */
timeout?: Duration
/** Inference input. Either a string or an array of strings. */
input: string | string[]
/** Optional task settings */
task_settings?: InferenceTaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { inference_id?: never, timeout?: never, input?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { inference_id?: never, timeout?: never, input?: never, task_settings?: never }
}
export type InferenceCompletionResponse = InferenceCompletionInferenceResult
export interface InferenceDeleteRequest extends RequestBase {
/** The task type */
task_type?: InferenceTaskType
@ -15224,27 +15360,6 @@ export interface InferenceGetResponse {
endpoints: InferenceInferenceEndpointInfo[]
}
export interface InferenceInferenceRequest extends RequestBase {
/** The type of inference task that the model performs. */
task_type?: InferenceTaskType
/** The unique identifier for the inference endpoint. */
inference_id: Id
/** The amount of time to wait for the inference request to complete. */
timeout?: Duration
/** The query input, which is required only for the `rerank` task. It is not required for other tasks. */
query?: string
/** The text on which you want to perform the inference task. It can be a single string or an array. > info > Inference endpoints for the `completion` task type currently only support a single string as input. */
input: string | string[]
/** Task settings for the individual inference request. These settings are specific to the task type you specified and override the task settings specified when initializing the service. */
task_settings?: InferenceTaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, query?: never, input?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, query?: never, input?: never, task_settings?: never }
}
export type InferenceInferenceResponse = InferenceInferenceResult
export interface InferencePutRequest extends RequestBase {
/** The task type */
task_type?: InferenceTaskType
@ -15259,100 +15374,142 @@ export interface InferencePutRequest extends RequestBase {
export type InferencePutResponse = InferenceInferenceEndpointInfo
export interface InferenceStreamInferenceRequest extends RequestBase {
export interface InferencePutOpenaiOpenAIServiceSettings {
api_key: string
dimensions?: integer
model_id: string
organization_id?: string
rate_limit?: InferenceRateLimitSetting
url?: string
}
export interface InferencePutOpenaiOpenAITaskSettings {
user?: string
}
export type InferencePutOpenaiOpenAITaskType = 'chat_completion' | 'completion' | 'text_embedding'
export interface InferencePutOpenaiRequest extends RequestBase {
/** The type of the inference task that the model will perform. NOTE: The `chat_completion` task type only supports streaming and only through the _stream API. */
task_type: InferencePutOpenaiOpenAITaskType
/** The unique identifier of the inference endpoint. */
openai_inference_id: Id
/** The chunking configuration object. */
chunking_settings?: InferenceInferenceChunkingSettings
/** The type of service supported for the specified task type. In this case, `openai`. */
service: InferencePutOpenaiServiceType
/** Settings used to install the inference model. These settings are specific to the `openai` service. */
service_settings: InferencePutOpenaiOpenAIServiceSettings
/** Settings to configure the inference task. These settings are specific to the task type you specified. */
task_settings?: InferencePutOpenaiOpenAITaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { task_type?: never, openai_inference_id?: never, chunking_settings?: never, service?: never, service_settings?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { task_type?: never, openai_inference_id?: never, chunking_settings?: never, service?: never, service_settings?: never, task_settings?: never }
}
export type InferencePutOpenaiResponse = InferenceInferenceEndpointInfo
export type InferencePutOpenaiServiceType = 'openai'
export interface InferencePutWatsonxRequest extends RequestBase {
/** The task type. The only valid task type for the model to perform is `text_embedding`. */
task_type: InferencePutWatsonxWatsonxTaskType
/** The unique identifier of the inference endpoint. */
watsonx_inference_id: Id
/** The type of service supported for the specified task type. In this case, `watsonxai`. */
service: InferencePutWatsonxServiceType
/** Settings used to install the inference model. These settings are specific to the `watsonxai` service. */
service_settings: InferencePutWatsonxWatsonxServiceSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { task_type?: never, watsonx_inference_id?: never, service?: never, service_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { task_type?: never, watsonx_inference_id?: never, service?: never, service_settings?: never }
}
export type InferencePutWatsonxResponse = InferenceInferenceEndpointInfo
export type InferencePutWatsonxServiceType = 'watsonxai'
export interface InferencePutWatsonxWatsonxServiceSettings {
api_key: string
api_version: string
model_id: string
project_id: string
rate_limit?: InferenceRateLimitSetting
url: string
}
export type InferencePutWatsonxWatsonxTaskType = 'text_embedding'
export interface InferenceRerankRequest extends RequestBase {
/** The unique identifier for the inference endpoint. */
inference_id: Id
/** The type of task that the model performs. */
task_type?: InferenceTaskType
/** The text on which you want to perform the inference task. It can be a single string or an array. NOTE: Inference endpoints for the completion task type currently only support a single string as input. */
/** The amount of time to wait for the inference request to complete. */
timeout?: Duration
/** Query input. */
query: string
/** The text on which you want to perform the inference task. It can be a single string or an array. > info > Inference endpoints for the `completion` task type currently only support a single string as input. */
input: string | string[]
/** Task settings for the individual inference request. These settings are specific to the task type you specified and override the task settings specified when initializing the service. */
task_settings?: InferenceTaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { inference_id?: never, task_type?: never, input?: never }
body?: string | { [key: string]: any } & { inference_id?: never, timeout?: never, query?: never, input?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { inference_id?: never, task_type?: never, input?: never }
querystring?: { [key: string]: any } & { inference_id?: never, timeout?: never, query?: never, input?: never, task_settings?: never }
}
export type InferenceStreamInferenceResponse = StreamResult
export type InferenceRerankResponse = InferenceRerankedInferenceResult
export interface InferenceUnifiedInferenceCompletionTool {
type: string
function: InferenceUnifiedInferenceCompletionToolFunction
}
export interface InferenceUnifiedInferenceCompletionToolChoice {
type: string
function: InferenceUnifiedInferenceCompletionToolChoiceFunction
}
export interface InferenceUnifiedInferenceCompletionToolChoiceFunction {
name: string
}
export interface InferenceUnifiedInferenceCompletionToolFunction {
description?: string
name: string
parameters?: any
strict?: boolean
}
export type InferenceUnifiedInferenceCompletionToolType = string | InferenceUnifiedInferenceCompletionToolChoice
export interface InferenceUnifiedInferenceContentObject {
text: string
type: string
}
export interface InferenceUnifiedInferenceMessage {
content?: InferenceUnifiedInferenceMessageContent
role: string
tool_call_id?: Id
tool_calls?: InferenceUnifiedInferenceToolCall[]
}
export type InferenceUnifiedInferenceMessageContent = string | InferenceUnifiedInferenceContentObject[]
export interface InferenceUnifiedInferenceRequest extends RequestBase {
/** The task type */
task_type?: InferenceTaskType
export interface InferenceSparseEmbeddingRequest extends RequestBase {
/** The inference Id */
inference_id: Id
/** Specifies the amount of time to wait for the inference request to complete. */
timeout?: Duration
/** A list of objects representing the conversation. */
messages: InferenceUnifiedInferenceMessage[]
/** The ID of the model to use. */
model?: string
/** The upper bound limit for the number of tokens that can be generated for a completion request. */
max_completion_tokens?: long
/** A sequence of strings to control when the model should stop generating additional tokens. */
stop?: string[]
/** The sampling temperature to use. */
temperature?: float
/** Controls which tool is called by the model. */
tool_choice?: InferenceUnifiedInferenceCompletionToolType
/** A list of tools that the model can call. */
tools?: InferenceUnifiedInferenceCompletionTool[]
/** Nucleus sampling, an alternative to sampling with temperature. */
top_p?: float
/** Inference input. Either a string or an array of strings. */
input: string | string[]
/** Optional task settings */
task_settings?: InferenceTaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, messages?: never, model?: never, max_completion_tokens?: never, stop?: never, temperature?: never, tool_choice?: never, tools?: never, top_p?: never }
body?: string | { [key: string]: any } & { inference_id?: never, timeout?: never, input?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, messages?: never, model?: never, max_completion_tokens?: never, stop?: never, temperature?: never, tool_choice?: never, tools?: never, top_p?: never }
querystring?: { [key: string]: any } & { inference_id?: never, timeout?: never, input?: never, task_settings?: never }
}
export type InferenceUnifiedInferenceResponse = StreamResult
export type InferenceSparseEmbeddingResponse = InferenceSparseEmbeddingInferenceResult
export interface InferenceUnifiedInferenceToolCall {
id: Id
function: InferenceUnifiedInferenceToolCallFunction
type: string
export interface InferenceStreamCompletionRequest extends RequestBase {
/** The unique identifier for the inference endpoint. */
inference_id: Id
/** The text on which you want to perform the inference task. It can be a single string or an array. NOTE: Inference endpoints for the completion task type currently only support a single string as input. */
input: string | string[]
/** Optional task settings */
task_settings?: InferenceTaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { inference_id?: never, input?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { inference_id?: never, input?: never, task_settings?: never }
}
export interface InferenceUnifiedInferenceToolCallFunction {
arguments: string
name: string
export type InferenceStreamCompletionResponse = StreamResult
export interface InferenceTextEmbeddingRequest extends RequestBase {
/** The inference Id */
inference_id: Id
/** Specifies the amount of time to wait for the inference request to complete. */
timeout?: Duration
/** Inference input. Either a string or an array of strings. */
input: string | string[]
/** Optional task settings */
task_settings?: InferenceTaskSettings
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { inference_id?: never, timeout?: never, input?: never, task_settings?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { inference_id?: never, timeout?: never, input?: never, task_settings?: never }
}
export type InferenceTextEmbeddingResponse = InferenceTextEmbeddingInferenceResult
export interface InferenceUpdateRequest extends RequestBase {
/** The unique identifier of the inference endpoint. */
inference_id: Id
@ -18530,16 +18687,14 @@ export interface MlGetTrainedModelsRequest extends RequestBase {
from?: integer
/** A comma delimited string of optional fields to include in the response body. */
include?: MlInclude
/** parameter is deprecated! Use [include=definition] instead */
include_model_definition?: boolean
/** Specifies the maximum number of models to obtain. */
size?: integer
/** A comma delimited string of tags. A trained model can have many tags, or none. When supplied, only trained models that contain all the supplied tags are returned. */
tags?: string | string[]
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { model_id?: never, allow_no_match?: never, decompress_definition?: never, exclude_generated?: never, from?: never, include?: never, include_model_definition?: never, size?: never, tags?: never }
body?: string | { [key: string]: any } & { model_id?: never, allow_no_match?: never, decompress_definition?: never, exclude_generated?: never, from?: never, include?: never, size?: never, tags?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { model_id?: never, allow_no_match?: never, decompress_definition?: never, exclude_generated?: never, from?: never, include?: never, include_model_definition?: never, size?: never, tags?: never }
querystring?: { [key: string]: any } & { model_id?: never, allow_no_match?: never, decompress_definition?: never, exclude_generated?: never, from?: never, include?: never, size?: never, tags?: never }
}
export interface MlGetTrainedModelsResponse {
@ -18840,10 +18995,10 @@ export interface MlPutDatafeedRequest extends RequestBase {
delayed_data_check_config?: MlDelayedDataCheckConfig
/** The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. When `frequency` is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation. */
frequency?: Duration
/** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the `remote_cluster_client` role. */
/** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the master nodes and the machine learning nodes must have the `remote_cluster_client` role. */
indices?: Indices
/** @alias indices */
/** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the `remote_cluster_client` role. */
/** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the master nodes and the machine learning nodes must have the `remote_cluster_client` role. */
indexes?: Indices
/** Specifies index expansion options that are used during search */
indices_options?: IndicesOptions
@ -19887,13 +20042,11 @@ export interface NodesNodeBufferPool {
used_in_bytes?: long
}
export interface NodesNodeReloadError {
export interface NodesNodeReloadResult {
name: Name
reload_exception?: ErrorCause
}
export type NodesNodeReloadResult = NodesStats | NodesNodeReloadError
export interface NodesNodesResponseBase {
_nodes?: NodeStatistics
}
@ -21310,12 +21463,6 @@ export interface SecurityCreatedStatus {
created: boolean
}
export interface SecurityFieldRule {
username?: Names
dn?: Names
groups?: Names
}
export interface SecurityFieldSecurity {
except?: Fields
grant?: Fields
@ -21364,6 +21511,15 @@ export interface SecurityRemoteIndicesPrivileges {
allow_restricted_indices?: boolean
}
export interface SecurityRemoteUserIndicesPrivileges {
field_security?: SecurityFieldSecurity[]
names: IndexName | IndexName[]
privileges: SecurityIndexPrivilege[]
query?: SecurityIndicesPrivilegesQuery[]
allow_restricted_indices: boolean
clusters: string[]
}
export interface SecurityReplicationAccess {
names: IndexName | IndexName[]
allow_restricted_indices?: boolean
@ -21416,7 +21572,7 @@ export interface SecurityRoleMapping {
export interface SecurityRoleMappingRule {
any?: SecurityRoleMappingRule[]
all?: SecurityRoleMappingRule[]
field?: SecurityFieldRule
field?: Partial<Record<Field, FieldValue | FieldValue[]>>
except?: SecurityRoleMappingRule
}
@ -22051,7 +22207,8 @@ export interface SecurityGetRoleRole {
remote_indices?: SecurityRemoteIndicesPrivileges[]
remote_cluster?: SecurityRemoteClusterPrivileges[]
metadata: Metadata
run_as: string[]
description?: string
run_as?: string[]
transient_metadata?: Record<string, any>
applications: SecurityApplicationPrivileges[]
role_templates?: SecurityRoleTemplate[]
@ -22204,8 +22361,10 @@ export interface SecurityGetUserPrivilegesRequest extends RequestBase {
export interface SecurityGetUserPrivilegesResponse {
applications: SecurityApplicationPrivileges[]
cluster: string[]
remote_cluster?: SecurityRemoteClusterPrivileges[]
global: SecurityGlobalPrivilege[]
indices: SecurityUserIndicesPrivileges[]
remote_indices?: SecurityRemoteUserIndicesPrivileges[]
run_as: string[]
}
@ -22403,13 +22562,13 @@ export interface SecurityOidcAuthenticateResponse {
export interface SecurityOidcLogoutRequest extends RequestBase {
/** The access token to be invalidated. */
access_token: string
token: string
/** The refresh token to be invalidated. */
refresh_token?: string
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { access_token?: never, refresh_token?: never }
body?: string | { [key: string]: any } & { token?: never, refresh_token?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { access_token?: never, refresh_token?: never }
querystring?: { [key: string]: any } & { token?: never, refresh_token?: never }
}
export interface SecurityOidcLogoutResponse {
@ -23027,14 +23186,14 @@ export interface SimulateIngestRequest extends RequestBase {
/** A map of component template names to substitute component template definition objects. */
component_template_substitutions?: Record<string, ClusterComponentTemplateNode>
/** A map of index template names to substitute index template definition objects. */
index_template_subtitutions?: Record<string, IndicesIndexTemplate>
index_template_substitutions?: Record<string, IndicesIndexTemplate>
mapping_addition?: MappingTypeMapping
/** Pipelines to test. If you dont specify the `pipeline` request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter. */
pipeline_substitutions?: Record<string, IngestPipeline>
/** All values in `body` will be added to the request body. */
body?: string | { [key: string]: any } & { index?: never, pipeline?: never, docs?: never, component_template_substitutions?: never, index_template_subtitutions?: never, mapping_addition?: never, pipeline_substitutions?: never }
body?: string | { [key: string]: any } & { index?: never, pipeline?: never, docs?: never, component_template_substitutions?: never, index_template_substitutions?: never, mapping_addition?: never, pipeline_substitutions?: never }
/** All values in `querystring` will be added to the request querystring. */
querystring?: { [key: string]: any } & { index?: never, pipeline?: never, docs?: never, component_template_substitutions?: never, index_template_subtitutions?: never, mapping_addition?: never, pipeline_substitutions?: never }
querystring?: { [key: string]: any } & { index?: never, pipeline?: never, docs?: never, component_template_substitutions?: never, index_template_substitutions?: never, mapping_addition?: never, pipeline_substitutions?: never }
}
export interface SimulateIngestResponse {