/*
* 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 {
ClientOptions,
ConnectionPool,
BaseConnectionPool,
CloudConnectionPool,
Connection,
Serializer,
Transport,
errors,
RequestEvent,
ResurrectEvent,
ApiError,
NodeOptions,
events
} from '../index'
import Helpers from '../lib/Helpers'
import {
ApiResponse,
TransportRequestCallback,
TransportRequestPromise,
TransportRequestParams,
TransportRequestOptions
} from '../lib/Transport'
import * as T from './types'
/**
* We are still working on this type, it will arrive soon.
* If it's critical for you, please open an issue.
* https://github.com/elastic/elasticsearch-js
*/
type TODO = Record
// 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;
// /Extend API
declare type callbackFn = (err: ApiError, result: ApiResponse) => void;
declare class Client {
constructor(opts: ClientOptions)
connectionPool: ConnectionPool
transport: Transport
serializer: Serializer
extend(method: string, fn: extendsCallback): void
extend(method: string, opts: { force: boolean }, fn: extendsCallback): void;
helpers: Helpers
child(opts?: ClientOptions): Client
close(callback: Function): void;
close(): Promise;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: 'request', listener: (err: ApiError, meta: RequestEvent) => void): this;
on(event: 'response', listener: (err: ApiError, meta: RequestEvent) => void): this;
on(event: 'sniff', listener: (err: ApiError, meta: RequestEvent) => void): this;
on(event: 'resurrect', listener: (err: null, meta: ResurrectEvent) => void): this;
once(event: 'request', listener: (err: ApiError, meta: RequestEvent) => void): this;
once(event: 'response', listener: (err: ApiError, meta: RequestEvent) => void): this;
once(event: 'sniff', listener: (err: ApiError, meta: RequestEvent) => void): this;
once(event: 'resurrect', listener: (err: null, meta: ResurrectEvent) => void): this;
off(event: string | symbol, listener: (...args: any[]) => void): this;
asyncSearch: {
delete(params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): TransportRequestPromise>
delete(params: T.AsyncSearchDeleteRequest, callback: callbackFn): TransportRequestCallback
delete(params: T.AsyncSearchDeleteRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
get(params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): TransportRequestPromise, TContext>>
get(params: T.AsyncSearchGetRequest, callback: callbackFn, TContext>): TransportRequestCallback
get(params: T.AsyncSearchGetRequest, options: TransportRequestOptions, callback: callbackFn, TContext>): TransportRequestCallback
status(params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): TransportRequestPromise, TContext>>
status(params: T.AsyncSearchStatusRequest, callback: callbackFn, TContext>): TransportRequestCallback
status(params: T.AsyncSearchStatusRequest, options: TransportRequestOptions, callback: callbackFn, TContext>): TransportRequestCallback
submit(params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptions): TransportRequestPromise, TContext>>
submit(callback: callbackFn, TContext>): TransportRequestCallback
submit(params: T.AsyncSearchSubmitRequest, callback: callbackFn, TContext>): TransportRequestCallback
submit(params: T.AsyncSearchSubmitRequest, options: TransportRequestOptions, callback: callbackFn, TContext>): TransportRequestCallback
}
autoscaling: {
deleteAutoscalingPolicy(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise>
deleteAutoscalingPolicy(callback: callbackFn): TransportRequestCallback
deleteAutoscalingPolicy(params: TODO, callback: callbackFn): TransportRequestCallback
deleteAutoscalingPolicy(params: TODO, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
getAutoscalingCapacity(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise>
getAutoscalingCapacity(callback: callbackFn): TransportRequestCallback
getAutoscalingCapacity(params: TODO, callback: callbackFn): TransportRequestCallback
getAutoscalingCapacity(params: TODO, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
getAutoscalingPolicy(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise>
getAutoscalingPolicy(callback: callbackFn): TransportRequestCallback
getAutoscalingPolicy(params: TODO, callback: callbackFn): TransportRequestCallback
getAutoscalingPolicy(params: TODO, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
putAutoscalingPolicy(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise>
putAutoscalingPolicy(callback: callbackFn): TransportRequestCallback
putAutoscalingPolicy(params: TODO, callback: callbackFn): TransportRequestCallback
putAutoscalingPolicy(params: TODO, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
}
bulk(params: T.BulkRequest, options?: TransportRequestOptions): TransportRequestPromise>
bulk(params: T.BulkRequest, callback: callbackFn): TransportRequestCallback
bulk(params: T.BulkRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
cat: {
aliases(params?: T.CatAliasesRequest, options?: TransportRequestOptions): TransportRequestPromise>
aliases(callback: callbackFn): TransportRequestCallback
aliases(params: T.CatAliasesRequest, callback: callbackFn): TransportRequestCallback
aliases(params: T.CatAliasesRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
allocation(params?: T.CatAllocationRequest, options?: TransportRequestOptions): TransportRequestPromise>
allocation(callback: callbackFn): TransportRequestCallback
allocation(params: T.CatAllocationRequest, callback: callbackFn): TransportRequestCallback
allocation(params: T.CatAllocationRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
count(params?: T.CatCountRequest, options?: TransportRequestOptions): TransportRequestPromise>
count(callback: callbackFn): TransportRequestCallback
count(params: T.CatCountRequest, callback: callbackFn): TransportRequestCallback
count(params: T.CatCountRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
fielddata(params?: T.CatFielddataRequest, options?: TransportRequestOptions): TransportRequestPromise>
fielddata(callback: callbackFn): TransportRequestCallback
fielddata(params: T.CatFielddataRequest, callback: callbackFn): TransportRequestCallback
fielddata(params: T.CatFielddataRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
health(params?: T.CatHealthRequest, options?: TransportRequestOptions): TransportRequestPromise>
health(callback: callbackFn): TransportRequestCallback
health(params: T.CatHealthRequest, callback: callbackFn): TransportRequestCallback
health(params: T.CatHealthRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
help(params?: T.CatHelpRequest, options?: TransportRequestOptions): TransportRequestPromise>
help(callback: callbackFn): TransportRequestCallback
help(params: T.CatHelpRequest, callback: callbackFn): TransportRequestCallback
help(params: T.CatHelpRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
indices(params?: T.CatIndicesRequest, options?: TransportRequestOptions): TransportRequestPromise>
indices(callback: callbackFn): TransportRequestCallback
indices(params: T.CatIndicesRequest, callback: callbackFn): TransportRequestCallback
indices(params: T.CatIndicesRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
master(params?: T.CatMasterRequest, options?: TransportRequestOptions): TransportRequestPromise>
master(callback: callbackFn): TransportRequestCallback
master(params: T.CatMasterRequest, callback: callbackFn): TransportRequestCallback
master(params: T.CatMasterRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
mlDataFrameAnalytics(params?: T.CatDataFrameAnalyticsRequest, options?: TransportRequestOptions): TransportRequestPromise>
mlDataFrameAnalytics(callback: callbackFn): TransportRequestCallback
mlDataFrameAnalytics(params: T.CatDataFrameAnalyticsRequest, callback: callbackFn): TransportRequestCallback
mlDataFrameAnalytics(params: T.CatDataFrameAnalyticsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
mlDatafeeds(params?: T.CatDatafeedsRequest, options?: TransportRequestOptions): TransportRequestPromise>
mlDatafeeds(callback: callbackFn): TransportRequestCallback
mlDatafeeds(params: T.CatDatafeedsRequest, callback: callbackFn): TransportRequestCallback
mlDatafeeds(params: T.CatDatafeedsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
mlJobs(params?: T.CatJobsRequest, options?: TransportRequestOptions): TransportRequestPromise>
mlJobs(callback: callbackFn): TransportRequestCallback
mlJobs(params: T.CatJobsRequest, callback: callbackFn): TransportRequestCallback
mlJobs(params: T.CatJobsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
mlTrainedModels(params?: T.CatTrainedModelsRequest, options?: TransportRequestOptions): TransportRequestPromise>
mlTrainedModels(callback: callbackFn): TransportRequestCallback
mlTrainedModels(params: T.CatTrainedModelsRequest, callback: callbackFn): TransportRequestCallback
mlTrainedModels(params: T.CatTrainedModelsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
nodeattrs(params?: T.CatNodeAttributesRequest, options?: TransportRequestOptions): TransportRequestPromise>
nodeattrs(callback: callbackFn): TransportRequestCallback
nodeattrs(params: T.CatNodeAttributesRequest, callback: callbackFn): TransportRequestCallback
nodeattrs(params: T.CatNodeAttributesRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
nodes(params?: T.CatNodesRequest, options?: TransportRequestOptions): TransportRequestPromise>
nodes(callback: callbackFn): TransportRequestCallback
nodes(params: T.CatNodesRequest, callback: callbackFn): TransportRequestCallback
nodes(params: T.CatNodesRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
pendingTasks(params?: T.CatPendingTasksRequest, options?: TransportRequestOptions): TransportRequestPromise>
pendingTasks(callback: callbackFn): TransportRequestCallback
pendingTasks(params: T.CatPendingTasksRequest, callback: callbackFn): TransportRequestCallback
pendingTasks(params: T.CatPendingTasksRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
plugins(params?: T.CatPluginsRequest, options?: TransportRequestOptions): TransportRequestPromise>
plugins(callback: callbackFn): TransportRequestCallback
plugins(params: T.CatPluginsRequest, callback: callbackFn): TransportRequestCallback
plugins(params: T.CatPluginsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
recovery(params?: T.CatRecoveryRequest, options?: TransportRequestOptions): TransportRequestPromise>
recovery(callback: callbackFn): TransportRequestCallback
recovery(params: T.CatRecoveryRequest, callback: callbackFn): TransportRequestCallback
recovery(params: T.CatRecoveryRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
repositories(params?: T.CatRepositoriesRequest, options?: TransportRequestOptions): TransportRequestPromise>
repositories(callback: callbackFn): TransportRequestCallback
repositories(params: T.CatRepositoriesRequest, callback: callbackFn): TransportRequestCallback
repositories(params: T.CatRepositoriesRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
segments(params?: T.CatSegmentsRequest, options?: TransportRequestOptions): TransportRequestPromise>
segments(callback: callbackFn): TransportRequestCallback
segments(params: T.CatSegmentsRequest, callback: callbackFn): TransportRequestCallback
segments(params: T.CatSegmentsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
shards(params?: T.CatShardsRequest, options?: TransportRequestOptions): TransportRequestPromise>
shards(callback: callbackFn): TransportRequestCallback
shards(params: T.CatShardsRequest, callback: callbackFn): TransportRequestCallback
shards(params: T.CatShardsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
snapshots(params?: T.CatSnapshotsRequest, options?: TransportRequestOptions): TransportRequestPromise>
snapshots(callback: callbackFn): TransportRequestCallback
snapshots(params: T.CatSnapshotsRequest, callback: callbackFn): TransportRequestCallback
snapshots(params: T.CatSnapshotsRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
tasks(params?: T.CatTasksRequest, options?: TransportRequestOptions): TransportRequestPromise>
tasks(callback: callbackFn): TransportRequestCallback
tasks(params: T.CatTasksRequest, callback: callbackFn): TransportRequestCallback
tasks(params: T.CatTasksRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback
templates(params?: T.CatTemplatesRequest, options?: TransportRequestOptions): TransportRequestPromise>
templates(callback: callbackFn): TransportRequestCallback
templates(params: T.CatTemplatesRequest, callback: callbackFn): TransportRequestCallback
templates