/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
///
import { EventEmitter } from 'events';
import { SecureContextOptions } from 'tls';
import Transport, {
ApiResponse,
RequestEvent,
TransportRequestParams,
TransportRequestOptions,
nodeFilterFn,
nodeSelectorFn,
generateRequestIdFn,
TransportRequestCallback
} from './lib/Transport';
import Connection, { AgentOptions, agentFn } from './lib/Connection';
import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool';
import Serializer from './lib/Serializer';
import * as RequestParams from './api/requestParams';
import * as errors from './lib/errors';
declare type anyObject = {
[key: string]: any;
};
declare type callbackFn = (err: Error | null, result: ApiResponse) => void;
interface ApiMethod {
// Promise API
(): Promise>;
(params: TParams): Promise>;
(params: TParams, options: TransportRequestOptions): Promise>;
// Callback API
(callback: callbackFn): TransportRequestCallback;
(params: TParams, callback: callbackFn): TransportRequestCallback;
(params: TParams, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback;
}
// Extend API
interface ClientExtendsCallbackOptions {
ConfigurationError: errors.ConfigurationError,
makeRequest(params: TransportRequestParams, options?: TransportRequestOptions): Promise | void;
result: {
body: null,
statusCode: null,
headers: null,
warnings: null
}
}
declare type extendsCallback = (options: ClientExtendsCallbackOptions) => any;
interface ClientExtends {
(method: string, fn: extendsCallback): void;
(method: string, opts: { force: boolean }, fn: extendsCallback): void;
}
// /Extend API
interface ClientOptions {
node?: string | string[];
nodes?: string | string[];
Connection?: typeof Connection;
ConnectionPool?: typeof ConnectionPool;
Transport?: typeof Transport;
Serializer?: typeof Serializer;
maxRetries?: number;
requestTimeout?: number;
pingTimeout?: number;
sniffInterval?: number;
sniffOnStart?: boolean;
sniffEndpoint?: string;
sniffOnConnectionFault?: boolean;
resurrectStrategy?: 'ping' | 'optimistic' | 'none';
suggestCompression?: boolean;
compression?: 'gzip';
ssl?: SecureContextOptions;
agent?: AgentOptions | agentFn;
nodeFilter?: nodeFilterFn;
nodeSelector?: nodeSelectorFn | string;
headers?: anyObject;
generateRequestId?: generateRequestIdFn;
name?: string;
cloud?: {
id: string;
username: string;
password: string;
}
}
declare class Client extends EventEmitter {
constructor(opts?: ClientOptions);
connectionPool: ConnectionPool;
transport: Transport;
serializer: Serializer;
extend: ClientExtends;
child(opts?: ClientOptions): Client;
close(callback?: Function): Promise | void;
bulk: ApiMethod
cat: {
aliases: ApiMethod
allocation: ApiMethod
count: ApiMethod
fielddata: ApiMethod
health: ApiMethod
help: ApiMethod
indices: ApiMethod
master: ApiMethod
nodeattrs: ApiMethod
nodes: ApiMethod
pending_tasks: ApiMethod
pendingTasks: ApiMethod
plugins: ApiMethod
recovery: ApiMethod
repositories: ApiMethod
segments: ApiMethod
shards: ApiMethod
snapshots: ApiMethod
tasks: ApiMethod
templates: ApiMethod
thread_pool: ApiMethod
threadPool: ApiMethod
}
ccr: {
delete_auto_follow_pattern: ApiMethod
deleteAutoFollowPattern: ApiMethod
follow: ApiMethod
follow_info: ApiMethod
followInfo: ApiMethod
follow_stats: ApiMethod
followStats: ApiMethod
forget_follower: ApiMethod
forgetFollower: ApiMethod
get_auto_follow_pattern: ApiMethod
getAutoFollowPattern: ApiMethod
pause_follow: ApiMethod
pauseFollow: ApiMethod
put_auto_follow_pattern: ApiMethod
putAutoFollowPattern: ApiMethod
resume_follow: ApiMethod
resumeFollow: ApiMethod
stats: ApiMethod
unfollow: ApiMethod
}
clear_scroll: ApiMethod
clearScroll: ApiMethod
cluster: {
allocation_explain: ApiMethod
allocationExplain: ApiMethod
get_settings: ApiMethod
getSettings: ApiMethod
health: ApiMethod
pending_tasks: ApiMethod
pendingTasks: ApiMethod
put_settings: ApiMethod
putSettings: ApiMethod
remote_info: ApiMethod
remoteInfo: ApiMethod
reroute: ApiMethod
state: ApiMethod
stats: ApiMethod
}
count: ApiMethod
create: ApiMethod
data_frame: {
delete_data_frame_transform: ApiMethod
deleteDataFrameTransform: ApiMethod
get_data_frame_transform: ApiMethod
getDataFrameTransform: ApiMethod
get_data_frame_transform_stats: ApiMethod
getDataFrameTransformStats: ApiMethod
preview_data_frame_transform: ApiMethod
previewDataFrameTransform: ApiMethod
put_data_frame_transform: ApiMethod
putDataFrameTransform: ApiMethod
start_data_frame_transform: ApiMethod
startDataFrameTransform: ApiMethod
stop_data_frame_transform: ApiMethod
stopDataFrameTransform: ApiMethod
}
dataFrame: {
delete_data_frame_transform: ApiMethod
deleteDataFrameTransform: ApiMethod
get_data_frame_transform: ApiMethod
getDataFrameTransform: ApiMethod
get_data_frame_transform_stats: ApiMethod
getDataFrameTransformStats: ApiMethod
preview_data_frame_transform: ApiMethod
previewDataFrameTransform: ApiMethod
put_data_frame_transform: ApiMethod
putDataFrameTransform: ApiMethod
start_data_frame_transform: ApiMethod
startDataFrameTransform: ApiMethod
stop_data_frame_transform: ApiMethod
stopDataFrameTransform: ApiMethod
}
delete: ApiMethod
delete_by_query: ApiMethod
deleteByQuery: ApiMethod
delete_by_query_rethrottle: ApiMethod
deleteByQueryRethrottle: ApiMethod
delete_script: ApiMethod
deleteScript: ApiMethod
exists: ApiMethod
exists_source: ApiMethod
existsSource: ApiMethod
explain: ApiMethod
field_caps: ApiMethod
fieldCaps: ApiMethod
get: ApiMethod
get_script: ApiMethod
getScript: ApiMethod
get_source: ApiMethod
getSource: ApiMethod
graph: {
explore: ApiMethod
}
ilm: {
delete_lifecycle: ApiMethod
deleteLifecycle: ApiMethod
explain_lifecycle: ApiMethod
explainLifecycle: ApiMethod
get_lifecycle: ApiMethod
getLifecycle: ApiMethod
get_status: ApiMethod
getStatus: ApiMethod
move_to_step: ApiMethod
moveToStep: ApiMethod
put_lifecycle: ApiMethod
putLifecycle: ApiMethod
remove_policy: ApiMethod
removePolicy: ApiMethod
retry: ApiMethod
start: ApiMethod
stop: ApiMethod
}
index: ApiMethod
indices: {
analyze: ApiMethod
clear_cache: ApiMethod
clearCache: ApiMethod
close: ApiMethod
create: ApiMethod
delete: ApiMethod
delete_alias: ApiMethod
deleteAlias: ApiMethod
delete_template: ApiMethod
deleteTemplate: ApiMethod
exists: ApiMethod
exists_alias: ApiMethod
existsAlias: ApiMethod
exists_template: ApiMethod
existsTemplate: ApiMethod
exists_type: ApiMethod
existsType: ApiMethod
flush: ApiMethod
flush_synced: ApiMethod
flushSynced: ApiMethod
forcemerge: ApiMethod
freeze: ApiMethod
get: ApiMethod
get_alias: ApiMethod
getAlias: ApiMethod
get_field_mapping: ApiMethod
getFieldMapping: ApiMethod
get_mapping: ApiMethod
getMapping: ApiMethod
get_settings: ApiMethod
getSettings: ApiMethod
get_template: ApiMethod
getTemplate: ApiMethod
get_upgrade: ApiMethod
getUpgrade: ApiMethod
open: ApiMethod
put_alias: ApiMethod
putAlias: ApiMethod
put_mapping: ApiMethod
putMapping: ApiMethod
put_settings: ApiMethod
putSettings: ApiMethod
put_template: ApiMethod
putTemplate: ApiMethod
recovery: ApiMethod
refresh: ApiMethod
rollover: ApiMethod
segments: ApiMethod
shard_stores: ApiMethod
shardStores: ApiMethod
shrink: ApiMethod
split: ApiMethod
stats: ApiMethod
unfreeze: ApiMethod
update_aliases: ApiMethod
updateAliases: ApiMethod
upgrade: ApiMethod
validate_query: ApiMethod
validateQuery: ApiMethod
}
info: ApiMethod
ingest: {
delete_pipeline: ApiMethod
deletePipeline: ApiMethod
get_pipeline: ApiMethod
getPipeline: ApiMethod
processor_grok: ApiMethod
processorGrok: ApiMethod
put_pipeline: ApiMethod
putPipeline: ApiMethod
simulate: ApiMethod
}
license: {
delete: ApiMethod
get: ApiMethod
get_basic_status: ApiMethod
getBasicStatus: ApiMethod
get_trial_status: ApiMethod
getTrialStatus: ApiMethod
post: ApiMethod
post_start_basic: ApiMethod
postStartBasic: ApiMethod
post_start_trial: ApiMethod
postStartTrial: ApiMethod
}
mget: ApiMethod
migration: {
deprecations: ApiMethod
}
ml: {
close_job: ApiMethod
closeJob: ApiMethod
delete_calendar: ApiMethod
deleteCalendar: ApiMethod
delete_calendar_event: ApiMethod
deleteCalendarEvent: ApiMethod
delete_calendar_job: ApiMethod
deleteCalendarJob: ApiMethod
delete_datafeed: ApiMethod
deleteDatafeed: ApiMethod
delete_expired_data: ApiMethod
deleteExpiredData: ApiMethod
delete_filter: ApiMethod
deleteFilter: ApiMethod
delete_forecast: ApiMethod
deleteForecast: ApiMethod
delete_job: ApiMethod
deleteJob: ApiMethod
delete_model_snapshot: ApiMethod
deleteModelSnapshot: ApiMethod
find_file_structure: ApiMethod
findFileStructure: ApiMethod
flush_job: ApiMethod
flushJob: ApiMethod
forecast: ApiMethod
get_buckets: ApiMethod
getBuckets: ApiMethod
get_calendar_events: ApiMethod
getCalendarEvents: ApiMethod
get_calendars: ApiMethod
getCalendars: ApiMethod
get_categories: ApiMethod
getCategories: ApiMethod
get_datafeed_stats: ApiMethod
getDatafeedStats: ApiMethod
get_datafeeds: ApiMethod
getDatafeeds: ApiMethod
get_filters: ApiMethod
getFilters: ApiMethod