import { Model, StorageService, StdObject } from 'chen/core';
import { SearchParams } from 'elasticsearch';
import { ElasticSearchClient } from './connection';
export * from './connection';
/**
 * ElasticSearchModel class
 */
export declare abstract class ElasticModel extends Model {
    /**
     * Index name in database
     * @type {string}
     */
    protected abstract index: string;
    /**
     * Type name in database
     * @type {string[]}
     */
    protected abstract type: string;
    /**
     * Primary key in the attributes list
     * @type {string}
     */
    protected primaryKey: string;
    /**
     * Client / Connection name
     * @type {string}
     */
    protected clientName: string;
    /**
     * Client / Connection Instance
     * @type {ElasticSearchClient}
     */
    protected client: ElasticSearchClient;
    /**
     * Create instance then save to database
     * @param  {StdObject} attributes
     * @return {Promise<ElasticModel>}
     */
    static create(attributes: StdObject): Promise<ElasticModel>;
    /**
     * Save model attributes to database
     * @return {Promise<boolean>}
     */
    save(): Promise<boolean>;
    /**
     * Set client
     * @param {string} name
     * @returns {this}
     */
    setClient(name?: string): this;
    /**
     * Get model current client instance
     *
     * @returns {ElasticSearchClient}
     */
    getClient(): ElasticSearchClient;
    /**
     * Get primary field value
     * @return {any}
     */
    getId(): any;
    /**
     * Set primary field value
     * @param  {string | number} id
     * @return {this}
     */
    setId(id: string | number): this;
    /**
     * Search for records in database
     * @param {SearchParams} query
     * @return {Promise<any>}
     */
    static query(query: SearchParams): Promise<any>;
}
/**
 * ElasticSearchService class
 */
export declare abstract class ElasticSearchService<T extends ElasticModel> extends StorageService<T> {
    /**
     * Model Class for this service
     * @type {typeof ElasticModel}
     */
    protected abstract model: typeof ElasticModel;
    /**
     * Add new record
     * @param  {StdObject} data
     * @param  {boolean = true} validate
     * @return {Promise<T>}
     */
    create(data: StdObject, validate?: boolean): Promise<T>;
    /**
     * save model changes with validation
     * @param  {T} model
     * @param  {boolean = true} validate
     * @return {null}
     */
    save(model: T, validate: boolean): Promise<any>;
    /**
     * update record by specified id
     * @param  {number} id
     * @param  {StdObject} data
     * @param  {boolean = true} validate
     * @return {Promise<boolean>}
     */
    update(id: number, data: StdObject, validate?: boolean): Promise<number>;
    /**
     * remove record by specified id
     * @param  {number} id
     * @return {Promise<boolean>}
     */
    destroy(id: number): Promise<number>;
    /**
     * retrieves first record by specific field
     * @param  {string} field
     * @param  {any} optOrValue sql operator or value
     * @param  {any} value
     * @return {Promise<T>}
     */
    getOneBy(field: string, optOrValue: any, value?: any): Promise<T>;
}
