1. 全文搜索选型
1.1 全文搜索
Elasticsearch https://github.com/elastic/elasticsearch 72.1K
Meilisearch https://github.com/meilisearch/meilisearch 49.9K (选用)
typesense https://github.com/typesense/typesense 22.5K
sonice https://github.com/valeriansaliou/sonic 20.6K
zincsearch https://github.com/zincsearch/zincsearch 17.3K (备选)
Bleve https://github.com/blevesearch/bleve 10.3K
1.2 向量搜索(语义搜索)
Qdrant https://github.com/qdrant/qdrant 22.7k
Weaviate https://github.com/weaviate/weaviate?tab=readme-ov-file 12.9K
1.3 结论 (meilisearch)
- 如果需要全面的搜索功能且有运维能力:Elasticsearch
- 如果需要简单部署的全文搜索:Meilisearch
- 如果需要最高性能和专注的向量搜索:Qdrant 或 Weaviate
- 如果已有 PostgreSQL:考虑 pgvector 扩展
- 如果希望纯 Go 实现且内嵌:Bleve
2. meilisearch 介绍
2.1 索引 (Index)
- 定义:索引是 Meilisearch 中存储文档的容器,类似于数据库中的表
- 特点:每个索引都有自己的配置,如排序规则、可搜索字段、过滤规则等
- 用途:通常按数据类型或业务领域创建不同索引,如 “products”、”users” 等
2.2 文档 (Documents)
- 定义:文档是存储在索引中的数据单元,通常是 JSON 对象
- 特点:每个文档必须有一个唯一标识符 (Primary Key)
- 结构:文档是由字段 - 值对组成的集合,如
{"id": 1, "title": "iPhone", "price": 999}
2.3 Primary Field (主键字段)
- 定义:Primary Field (主键字段) 用于唯一标识索引中的每个文档
- 作用:确保文档唯一性,用于文档更新和删除操作,作为内部索引的引用键
3. meilisearch 使用
3.1 安装
1 | # 拉取镜像并启动容器 |
3.2 部署

- 暂时不支持集群部署

3.3 使用
golang client : https://github.com/meilisearch/meilisearch-go
三方 UI: https://github.com/riccox/meilisearch-ui
自带 UI 展示封面图: 使用 cover_image 属性,就兼容

4. meilisearch 向量搜索
向量数据需要预先计算,Meilisearch 不会自动生成向量,Meilisearch 不提供嵌入向量的生成工具。你需要使用外部工具(如 Sentence-BERT、OpenAI Embeddings API)生成向量。
向量搜索教程:https://www.meilisearch.com/docs/learn/ai_powered_search/getting_started_with_ai_search
openai 三方代理: https://api.uniapi.ai/dashboard/log
1 | # 创建向量模型 |