/// import { ApiResponse, Client, ClientOptions } from '@elastic/elasticsearch'; import { CountResponse, IndicesCreateRequest, IndicesRefreshResponse, MappingProperty, MappingTypeMapping, PropertyName, QueryDslQueryContainer, SearchHighlight, SearchHit, SearchHitsMetadata, SearchRequest, SearchResponse } from '@elastic/elasticsearch/api/types'; import { EventEmitter } from 'events'; import { Document, Model, PopulateOptions, QueryOptions } from 'mongoose'; declare interface FilterFn { (doc: Document): boolean; } declare interface TransformFn { (body: Record, doc: Document): any; } declare interface RoutingFn { (doc: Document): any; } declare interface GeneratedMapping extends MappingTypeMapping { cast?(doc: any): any; } declare interface HydratedSearchResults extends SearchResponse { hits: HydratedSearchHits; } declare interface HydratedSearchHits extends SearchHitsMetadata { hydrated: Array; } declare type IndexInstruction = { index: { _index: string; _id: string; }; }; declare type DeleteInstruction = { delete: { _index: string; _id: string; }; }; declare type BulkInstruction = IndexInstruction | DeleteInstruction | Record; declare interface BulkOptions { batch: number; delay: number; size: number; } declare interface IndexMethodOptions { index?: string; } declare interface SynchronizeOptions { saveOnSynchronize?: boolean; } declare interface BulkIndexOptions { body: any; bulk?: BulkOptions; id: string; index: string; model: MongoosasticModel; refresh?: boolean; routing?: RoutingFn; } declare interface BulkUnIndexOptions { bulk?: BulkOptions; id: string; index: string; model: MongoosasticModel; routing?: RoutingFn; tries?: number; } declare interface DeleteByIdOptions { client: Client; id: string; index: string; tries: number; } declare type Options = { esClient?: Client; alwaysHydrate?: boolean; bulk?: BulkOptions; clientOptions?: ClientOptions; customSerialize?(model: Document | MongoosasticModel, ...args: any): any; filter?: FilterFn; forceIndexRefresh?: boolean; hydrateOptions?: QueryOptions; index?: string; indexAutomatically?: boolean; populate?: PopulateOptions[]; properties?: any; routing?: RoutingFn; saveOnSynchronize?: boolean; transform?: TransformFn; }; declare type EsSearchOptions = { aggs?: any; highlight?: SearchHighlight; hydrate?: boolean; hydrateOptions?: QueryOptions; hydrateWithESResults?: any; index?: string; min_score?: any; routing?: any; sort?: any; suggest?: any; }; declare interface MongoosasticDocument extends Document, EventEmitter { _highlight?: Record | undefined; _esResult?: SearchHit; esClient(): Client; esOptions(): Options; index(opts?: IndexMethodOptions): Promise; unIndex(): Promise; } interface MongoosasticModel extends Model { bulkError(): EventEmitter; createMapping(body?: IndicesCreateRequest['body']): Promise>; esClient(): Client; esCount(query?: QueryDslQueryContainer): Promise>; esOptions(): Options; esSearch(query: SearchRequest['body'], options?: EsSearchOptions): Promise>>; esTruncate(): Promise; flush(): Promise; getCleanTree(): Record; getMapping(): Record; refresh(): Promise>; search(query: QueryDslQueryContainer, options?: EsSearchOptions): Promise>>; synchronize(query?: any, options?: SynchronizeOptions): EventEmitter; } export { BulkIndexOptions, BulkInstruction, BulkOptions, BulkUnIndexOptions, DeleteByIdOptions, EsSearchOptions, GeneratedMapping, HydratedSearchResults, IndexMethodOptions, MongoosasticDocument, MongoosasticModel, Options, SynchronizeOptions, };