sdk

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistogramBucket

type HistogramBucket struct {
	Time  string `json:"time"`
	Count int64  `json:"count"`
}

HistogramBucket 定义直方图聚合的一个桶

type SearchRequest

type SearchRequest struct {
	Index     string    `json:"index"`      // 索引名称
	Query     string    `json:"query"`      // 搜索关键词 (KQL 或 query_string)
	StartTime time.Time `json:"start_time"` // 开始时间
	EndTime   time.Time `json:"end_time"`   // 结束时间
	Page      int       `json:"page"`       // 页码 (从 1 开始)
	Size      int       `json:"size"`       // 每页大小
	Interval  string    `json:"interval"`   // 聚合时间间隔 (如 "1h", "1d"),为空则不聚合
}

SearchRequest 定义搜索请求参数

type SearchResponse

type SearchResponse struct {
	Total     int64             `json:"total"`
	Hits      []interface{}     `json:"hits"`      // 原始日志数据
	Histogram []HistogramBucket `json:"histogram"` // 柱状图数据
}

SearchResponse 定义搜索响应结构

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(esClient *es.Client) *Service

func (*Service) GetIndices

func (s *Service) GetIndices(ctx context.Context) ([]string, error)

GetIndices 获取所有索引列表

func (*Service) GetMapping

func (s *Service) GetMapping(ctx context.Context, index string) (map[string]interface{}, error)

GetMapping 获取指定索引的字段映射

func (*Service) SearchLogs

func (s *Service) SearchLogs(ctx context.Context, req SearchRequest) (*SearchResponse, error)

SearchLogs 执行日志搜索

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL