Skip to content

NOTE

本页由仓库元数据、API reports 或示例目录生成;包名、export subpaths、TypeScript 声明和源码链接保留原文,便于与发布产物逐项核对。

声明内容来自仓库 API report,保留英文注释和 TypeScript 原文,便于与发布产物逐项核对。

@loggerjs/elastic API

Generated from packages/elastic/dist/**/*.d.ts. 源报告:api-reports/loggerjs-elastic.api.md.

index.d.ts

ts
import { type LogEvent, type LoggerLevel, type Transport } from "@loggerjs/core";
export type ElasticIndexSelector = string | ((event: LogEvent) => string);
export type ElasticOpType = "create" | "index";
export interface ElasticTransportOptions {
    url: string;
    name?: string;
    minLevel?: LoggerLevel;
    index?: ElasticIndexSelector;
    opType?: ElasticOpType;
    pipeline?: string | ((event: LogEvent) => string | undefined);
    id?: (event: LogEvent) => string | undefined;
    headers?: Record<string, string>;
    apiKey?: string;
    refresh?: boolean | "wait_for";
    checkBulkErrors?: boolean;
    document?: (event: LogEvent) => Record<string, unknown>;
    fetchFn?: typeof fetch;
}
export interface ElasticBulkActionMetadata {
    _index?: string;
    _id?: string;
    pipeline?: string;
}
export type ElasticBulkAction = {
    create: ElasticBulkActionMetadata;
} | {
    index: ElasticBulkActionMetadata;
};
export declare function toElasticDocument(event: LogEvent): Record<string, unknown>;
export declare function createElasticBulkPayload(events: readonly LogEvent[], options?: Pick<ElasticTransportOptions, "document" | "id" | "index" | "opType" | "pipeline">): string;
export declare function elasticTransport(options: ElasticTransportOptions): Transport;

基于 MIT License 发布。