meilisearch v1.40.0 版本更新介绍
发布日期: 2026-03-23
版本号: v1.40.0
本次更新主要增强了联合搜索功能,支持在
federation对象中使用distinct属性,实现跨索引和跨远程的全局去重计算,并兼容分面分布与合并。性能方面显著优化,联合搜索速度提升约100毫秒,JSON文档生成效率提高以更好地处理大型文档,同时通过升级内存分配器大幅降低了高负载下的内存使用。此外,修复了多个安全漏洞和bug,包括密钥隐藏检查、网络问题、AWS Bedrock API支持以及虚拟文件系统兼容性等。新增了任务队列压缩API(需启用实验性功能标志),并进行了多项依赖升级和杂项改进。
更新内容 (中文)
本版本在联合搜索中新增了对 distinct 属性的支持,实现了跨索引的去重属性与分面分布统计功能。此外,还带来了显著的性能提升:联合搜索速度加快(约快100ms),优化了JSON文档生成机制以更好地处理大型文档,并大幅改善了大规模工作负载下的内存使用效率。
✨ 功能增强
-
在联合搜索中支持
distinct属性 — 由 @dureuill 提交于 https://github.com/meilisearch/meilisearch/pull/6214
现在可以在联合搜索的federation对象中传递distinct属性,对结果应用全局的、跨索引及跨远程的去重计算。包含去重功能的联合搜索请求示例
{ "federation": { "distinct": "genres", // ✨ 新增功能 "facetsByIndex": { // 去重功能同样支持分面分布恢复 "comics": ["genres"], "movies": ["genres"] }, "mergeFacets": {} // 去重功能同样支持分面分布合并 }, "queries": [ { "indexUid": "comics", "q": "batman", "attributesToRetrieve": ["title", "genres"], "useNetwork": true // 去重功能同样支持网络查询 }, { "indexUid": "movies", "q": "superman", "attributesToRetrieve": ["title", "genres"], "useNetwork": true } ] }包含去重功能的联合搜索响应示例
{ "hits": [ { "title": "Batman", "genres": ["Family","Adventure","Comedy","Science Fiction","Crime"], "_federation": { "indexUid": "comics", "queriesPosition": 0, "weightedRankingScore": 1.0, "remote": "ms2" } }, { "title": "Batman", "genres": ["Fantasy","Action"], "_federation": { "indexUid": "comics", "queriesPosition": 0, "weightedRankingScore": 1.0, "remote": "ms1" } }, { "title": "Batman & Bill", "genres": ["Documentary"], "_federation": { "indexUid": "comics", "queriesPosition": 0, "weightedRankingScore": 0.9848484848484848, "remote": "ms1" } }, { "title": "Superman: Red Son", "genres": [], "_federation": { "indexUid": "movies", "queriesPosition": 1, "weightedRankingScore": 0.9848484848484849, "remote": "ms0" } }, { "title": "Superman, Spider-Man or Batman", "genres": ["Drama"], "_federation": { "indexUid": "movies", "queriesPosition": 1, "weightedRankingScore": 0.9848484848484849, "remote": "ms0" } } ], "processingTimeMs": 15, "limit": 5, "offset": 0, "estimatedTotalHits": 11, "facetDistribution": { "genres": { "Action": 1, "Adventure": 1, "Comedy": 3, "Crime": 2, "Documentary": 1, "Drama": 1, "Family": 1, "Fantasy": 1, "Horror": 2, "Romance": 1, "Science Fiction": 1, "Thriller": 1, "Western": 1 } }, "facetStats": {}, "requestUid": "019d05c7-ea65-77a1-8274-22a8ba9e26db", "remoteErrors": {} }注意:在联合搜索层级应用去重属性时,需遵守以下规则:
- 禁止同时在查询层级和联合搜索层级应用
distinct,否则将返回 HTTP 400 错误。 - 所选的去重字段将应用于所有远程服务和索引,因此它必须是所有参与的远程服务和索引的可过滤属性。
- 尽管 Meilisearch 会尝试计算最精确的分面分布,但在分布式环境中无法保证这一点,因为去重算法并未应用于所有远程文档。
- 禁止同时在查询层级和联合搜索层级应用
-
提升联合搜索性能 — 由 @dureuill 提交于 https://github.com/meilisearch/meilisearch/pull/6229
提升了联合搜索性能:所有请求速度约快100ms。增强了HTTP服务器的可靠性:服务器在处理大量联合搜索请求时不再被阻塞。 -
优化JSON文档生成 — 由 @Kerollmops 提交于 https://github.com/meilisearch/meilisearch/pull/6257
解决了用户在请求大型文档时可能遇到的性能问题。此外,当用户仅请求大型文档的小部分字段时,性能也得到了提升。 -
使用最新版 mimalloc 以改善内存使用 — 由 @Kerollmops 提交于 https://github.com/meilisearch/meilisearch/pull/6201
将 mimalloc 从 v2 更新至 v3,改善了线程间的内存共享,并显著减少了大规模工作负载下的内存使用。同时,它在链接时覆盖了分配器以使用 mimalloc,允许 LMDB、Meilisearch 及其他C语言库共享分配,从而提升整体内存效率。@Kerollmops 撰写了关于此改进背后故事的博客文章。 -
新增
POST /tasks/compact端点用于任务队列压缩 — 由 @YoEight 提交于 https://github.com/meilisearch/meilisearch/pull/6193
压缩任务队列数据库并回收空间,使得新任务可以持续入队,而无需删除现有任务。此功能位于实验性功能标志taskQueueCompactionRoute之后。
[!WARNING]
任务队列压缩完成后,所有写入操作将被阻止,直到服务器重启。
🔐 安全
- 升级 rustls-webpki 从 0.103.8 到 0.103.10 — https://github.com/meilisearch/meilisearch/pull/6273
- 升级 tar 从 0.4.44 到 0.4.45 — https://github.com/meilisearch/meilisearch/pull/6271
- 升级 actix-web-lab 从 0.24.3 到 0.26.0 — https://github.com/meilisearch/meilisearch/pull/6218
- 升级 quinn-proto 从 0.11.13 到 0.11.14 — https://github.com/meilisearch/meilisearch/pull/6217
🪲 错误修复
- 隐藏机密信息时检查字符边界 — 由 @ManyTheFish 提交于 https://github.com/meilisearch/meilisearch/pull/6262
- 网络相关修复 — 由 @dureuill 提交于 https://github.com/meilisearch/meilisearch/pull/6255
- 使用配置中的源基础 URL 覆盖 “default”,以支持 AWS bedrock OpenAI API — 由 @dureuill 提交于 https://github.com/meilisearch/meilisearch/pull/5905
- 修复在 virtiofs 文件系统上的 panic 问题 — 由 @itsamine27 提交于 https://github.com/meilisearch/meilisearch/pull/6261
🔩 其他杂项
- 为
/logs/stream路由添加X-Accel-Buffering: no— 由 @YoEight 提交于 https://github.com/meilisearch/meilisearch/pull/6268 - 为
--experimental-allowed-ip-networks参数添加文档链接 — 由 @paulden 提交于 https://github.com/meilisearch/meilisearch/pull/6263 - 将 sysinfo 版本更新至
0.38.4— 由 @GuillaumeGomez 提交于 https://github.com/meilisearch/meilisearch/pull/6211 - 添加禁止代理的 AGENTS.md 文件,以防止过多的AI生成的PR — 由 @Kerollmops 提交于 https://github.com/meilisearch/meilisearch/pull/6256
新贡献者
- @GuillaumeGomez 在 https://github.com/meilisearch/meilisearch/pull/6211 中完成了首次贡献
- @itsamine27 在 https://github.com/meilisearch/meilisearch/pull/6261 中完成了首次贡献
更新内容 (原始)
This release introduced support for the distinct attribute in federated search, enabling cross-index distinct attributes with facet distribution support. Additionally, significant performance improvements were delivered, including faster federated search (approximately 100ms faster), optimized JSON document generation for better handling of large documents and a much better memory usage for large workloads.
✨ Enhancement
-
Support
distinctin federated search by @dureuill in https://github.com/meilisearch/meilisearch/pull/6214The
distinctattribute can now be passed to thefederationobject in federated search to apply a global, cross-index and cross-remote distinct computation to the results.Example of a federated search request with distinct
{ "federation": { "distinct": "genres", // ✨ NEW "facetsByIndex": { // recovering facet distribution is also supported with distinct "comics": [ "genres" ], "movies": [ "genres" ] }, "mergeFacets": {} // merging facet distributions is also supported with distinct }, "queries": [ { "indexUid": "comics", "q": "batman", "attributesToRetrieve": ["title", "genres"], "useNetwork": true // distinct is also supported with network queries }, { "indexUid": "movies", "q": "superman", "attributesToRetrieve": ["title", "genres"], "useNetwork": true } ] }Sample response to a federated search request with distinct
{ "hits": [ { "title": "Batman", "genres": [ "Family", "Adventure", "Comedy", "Science Fiction", "Crime" ], "_federation": { "indexUid": "comics", "queriesPosition": 0, "weightedRankingScore": 1.0, "remote": "ms2" } }, { "title": "Batman", "genres": [ "Fantasy", "Action" ], "_federation": { "indexUid": "comics", "queriesPosition": 0, "weightedRankingScore": 1.0, "remote": "ms1" } }, { "title": "Batman & Bill", "genres": [ "Documentary" ], "_federation": { "indexUid": "comics", "queriesPosition": 0, "weightedRankingScore": 0.9848484848484848, "remote": "ms1" } }, { "title": "Superman: Red Son", "genres": [], "_federation": { "indexUid": "movies", "queriesPosition": 1, "weightedRankingScore": 0.9848484848484849, "remote": "ms0" } }, { "title": "Superman, Spider-Man or Batman", "genres": [ "Drama" ], "_federation": { "indexUid": "movies", "queriesPosition": 1, "weightedRankingScore": 0.9848484848484849, "remote": "ms0" } } ], "processingTimeMs": 15, "limit": 5, "offset": 0, "estimatedTotalHits": 11, "facetDistribution": { "genres": { "Action": 1, "Adventure": 1, "Comedy": 3, "Crime": 2, "Documentary": 1, "Drama": 1, "Family": 1, "Fantasy": 1, "Horror": 2, "Romance": 1, "Science Fiction": 1, "Thriller": 1, "Western": 1 } }, "facetStats": {}, "requestUid": "019d05c7-ea65-77a1-8274-22a8ba9e26db", "remoteErrors": {} }Note the following to apply the distinct attribute at the federation level:
- Applying
distinctat the query level at the same time as the federation level is disallowed and will return a HTTP 400 error. - The chosen distinct field will apply to all remotes and indexes, so it must be a filterable attribute for all participating remotes and indexes.
- While Meilisearch attempts to compute the most accurate facet distribution, in distributed contexts this cannot be guaranteed as the distinct algorithm is not applied on all of the remote documents.
- Applying
-
Improve performance of federated search by @dureuill in https://github.com/meilisearch/meilisearch/pull/6229
Improves performance of federated search: about 100ms faster for all requests. Improves reliability of the HTTP server: the server will no longer be blocked when too many federated search requests are being processed.
-
Optimize the generation of JSON documents by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6257
Addresses performance issues that users might encounter when requesting large documents. Additionally, performance is enhanced when users request only a small subset of fields from large documents.
-
Use the latest version of mimalloc to improve memory usage by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6201
Updates mimalloc from v2 to v3, improving memory sharing between threads and significantly reducing memory usage on large workloads. It also overrides the allocator to use mimalloc at linking time, allowing LMDB, Meilisearch, and other C libraries to share their allocations for better overall memory efficiency. @Kerollmops wrote a blog post about the story behind this improvement.
-
Add
POST /tasks/compactfor task queue compaction by @YoEight in https://github.com/meilisearch/meilisearch/pull/6193Compacts the task queue database and reclaim space so new tasks can keep being enqueued, without deleting existing tasks. This feature is behind the
taskQueueCompactionRouteexperimental feature flag.
[!WARNING]
Once task queue compaction completes, all write operations are blocked until the server is restarted.
🔐 Security
- Bump rustls-webpki from 0.103.8 to 0.103.10 in https://github.com/meilisearch/meilisearch/pull/6273
- Bump tar from 0.4.44 to 0.4.45 in https://github.com/meilisearch/meilisearch/pull/6271
- Bump actix-web-lab from 0.24.3 to 0.26.0 in https://github.com/meilisearch/meilisearch/pull/6218
- Bump quinn-proto from 0.11.13 to 0.11.14 in https://github.com/meilisearch/meilisearch/pull/6217
🪲 Bug fixes
- Check char boundaries when hiding secrets by @ManyTheFish in https://github.com/meilisearch/meilisearch/pull/6262
- Network fixes by @dureuill in https://github.com/meilisearch/meilisearch/pull/6255
- Override “default” source base url with the config one to support AWS bedrock OpenAI API by @dureuill in https://github.com/meilisearch/meilisearch/pull/5905
- Fix panic on virtiofs filesystem by @itsamine27 in https://github.com/meilisearch/meilisearch/pull/6261
🔩 Miscellaneous
- Add
X-Accel-Buffering: nofor/logs/streamroute by @YoEight in https://github.com/meilisearch/meilisearch/pull/6268 - Add link to documentation on
--experimental-allowed-ip-networksparameter by @paulden in https://github.com/meilisearch/meilisearch/pull/6263 - Update sysinfo version to
0.38.4by @GuillaumeGomez in https://github.com/meilisearch/meilisearch/pull/6211 - Add a no-agent AGENTS.md file to prevent excessive AI-generated PRs by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6256
New Contributors
- @GuillaumeGomez made their first contribution in https://github.com/meilisearch/meilisearch/pull/6211
- @itsamine27 made their first contribution in https://github.com/meilisearch/meilisearch/pull/6261
下载链接
- meilisearch-enterprise-linux-aarch64
- meilisearch-enterprise-linux-amd64
- meilisearch-enterprise-macos-amd64
- meilisearch-enterprise-macos-apple-silicon
- meilisearch-enterprise-windows-amd64.exe
- meilisearch-linux-aarch64
- meilisearch-linux-amd64
- meilisearch-macos-amd64
- meilisearch-macos-apple-silicon
- meilisearch-openapi.json
- meilisearch-windows-amd64.exe
- meilisearch.deb