# es示例 **Repository Path**: persist-art/es-example ## Basic Information - **Project Name**: es示例 - **Description**: 学习es的demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-12 - **Last Updated**: 2026-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README es_demo/ ├── main.go # 入口:初始化各组件 + 启动 Gin ├── es_client.go # ES 客户端 ├── go.mod ├── config/ │ ├── es.go # ES 配置(地址、索引映射) │ └── mysql.go # MySQL 配置(DSN、表名映射) ├── handler/ │ ├── search_handler.go # 搜索接口 │ └── health_handler.go # 健康检查(可选,也可放 main 里) ├── model/ │ └── knowledge.go # 知识条目结构体 └── service/ └── search_service.go # 搜索业务逻辑(ES优先 + MySQL兜底) 最小可用 demo 示例: main.go:Gin 路由 + 搜索接口 config/es.go:ES 客户端初始化 handler/search_handler.go:关键词搜索(类似知识库检索)