meilisearch v1.41.0 版本更新介绍
发布日期: 2026-03-30
版本号: v1.41.0
Meilisearch 发布了多项功能增强与优化。引入了实验性功能“动态搜索规则”,允许通过查询条件或时间窗口将特定文档固定在搜索结果的指定位置,该功能需启用相应实验性标志。在分片实例中,当配置了网络时,搜索请求的
useNetwork参数默认值更改为true,这意味着未明确指定时将自动执行跨分片的联合搜索以覆盖所有数据分片;此变更属于破坏性更新,需注意兼容性。同时,优化了 FST 构建流程,移除了对单词文档 ID 数据库的全量扫描需求,显著提升了大量文档插入时的性能。此外,还包括若干错误修复与文档更新。
更新内容 (中文)
✨ 增强功能
-
支持带固定功能的动态搜索规则 by @YoEight in https://github.com/meilisearch/meilisearch/pull/6182 引入动态搜索规则实验性功能,通过灵活、基于条件的固定功能,轻松为正确的搜索推广正确的内容。在此首个版本中,规则可通过基于查询的条件(如空查询或字面子串匹配)以及时间窗口来触发。多个文档可以按定义的顺序固定,并且固定功能仍可与过滤、分页、分面分布、混合搜索和联邦搜索配合使用。此功能位于
dynamicSearchRules实验性功能标志之后。规则可通过
PATCH /dynamic-search-rules/{uid}创建或更新,并通过DELETE /dynamic-search-rules/{uid}删除。在此首个版本中,规则可以定义基于查询或时间的条件,并在结果列表的固定位置固定特定文档。规则创建/更新示例
// PATCH /dynamic-search-rules/featured-wireless-headphones { \"description\": \"为无线耳机搜索推广精选产品\", \"active\": true, \"conditions\": [ { \"scope\": \"query\", \"contains\": \"headphone\" } ], \"actions\": [ { \"selector\": { \"indexUid\": \"products\", \"id\": \"featured-headphones-001\" }, \"action\": { \"type\": \"pin\", \"position\": 0 } }, { \"selector\": { \"indexUid\": \"products\", \"id\": \"featured-headphones-002\" }, \"action\": { \"type\": \"pin\", \"position\": 1 } } ] } -
在分片实例中默认将
useNetwork设置为trueby @dureuill in https://github.com/meilisearch/meilisearch/pull/6278此版本对使用
network实验性功能的用户包含破坏性变更。当启用(复制)分片时,搜索请求现在默认使用网络
<a id="search-requests-breaking-changes">§ 破坏性变更
当实例中设置了
network.leader时,搜索请求中省略useNetwork时现在默认为true。因此,当配置了网络时,以下内容:
未显式指定 useNetwork 的搜索请求
// POST /indexes/movies/search { \"q\": \"Batman dark knight returns 1\", \"filter\": \"genres IN [Action, Adventure]\", \"facets\": [\"genres\"], \"limit\": 5 // 未传递 `useNetwork` }现在等效于在多个远程节点上进行联邦搜索,以便网络中的所有分片恰好被覆盖一次。
等效的联邦搜索请求
// POST /multi-search { \"federation\": { \"limit\": 5, \"facetsByIndex\": { \"movies\": [ \"genres\" ] }, \"merge\": {} }, // 假设有3个远程节点 0, 1, 2 和 3个分片 a, b, c,其中 // 0 拥有 a, b // 1 拥有 b, c // 2 拥有 c, a \"queries\": [ { \"indexUid\": \"movies\", \"federationOptions\": { \"remote\": \"0\" }, \"q\": \"Batman dark knight returns 1\", \"filter\": [\"genres IN [Action, Adventure]\", \"_shard = a\"] }, { \"indexUid\": \"movies\", \"federationOptions\": { \"remote\": \"0\" // useNetwork 为分片 a 和 b 选择了远程节点 0 }, \"q\": \"Batman dark knight returns 1\", \"filter\": [\"genres IN [Action, Adventure]\", \"_shard = b\"] }, { \"indexUid\": \"movies\", \"federationOptions\": { \"remote\": \"2\" }, \"q\": \"Batman dark knight returns 1\", \"filter\": [\"genres IN [Action, Adventure]\", \"_shard = c\"] } ] }返回来自所有分片的文档:
响应
{ \"hits\": [ { \"id\": 123025, \"title\": \"Batman: The Dark Knight Returns, Part 1\", \"overview\": \"Batman has not been seen for ten years. A new breed of criminal ravages Gotham City, forcing 55-year-old Bruce Wayne back into the cape and cowl. But, does he still have what it takes to fight crime in a new era?\", \"genres\": [ \"Action\", \"Animation\", \"Mystery\" ], \"poster\": \"https://image.tmdb.org/t/p/w500/kkjTbwV1Xnj8wBL52PjOcXzTbnb.jpg\", \"release_date\": 1345507200, \"_federation\": { \"indexUid\": \"mieli\", \"queriesPosition\": 2, \"weightedRankingScore\": 0.9894586894586894, \"remote\": \"2\" } }, { \"id\": 142061, \"title\": \"Batman: The Dark Knight Returns, Part 2\", \"overview\": \"Batman has stopped the reign of terror that The Mutants had cast upon his city. Now an old foe wants a reunion and the government wants The Man of Steel to put a stop to Batman.\", \"genres\": [ \"Action\", \"Animation\", \"Mystery\" ], \"poster\": \"https://image.tmdb.org/t/p/w500/arEZYd6uMOFTILne9Ux0A8qctMe.jpg\", \"release_date\": 1357171200, \"_federation\": { \"indexUid\": \"mieli\", \"queriesPosition\": 1, \"weightedRankingScore\": 0.9894558963186414, \"remote\": \"0\" } }, { \"id\": 16234, \"title\": \"Batman Beyond: Return of the Joker\", \"overview\": \"The Joker is back with a vengeance, and Gotham's newest Dark Knight needs answers as he stands alone to face Gotham's most infamous Clown Prince of Crime.\", \"genres\": [ \"Animation\", \"Family\", \"Action\", \"Science Fiction\" ], \"poster\": \"https://image.tmdb.org/t/p/w500/7RlBs0An83fqAuKfwH5gKMcqgMc.jpg\", \"release_date\": 976579200, \"_federation\": { \"indexUid\": \"mieli\", \"queriesPosition\": 1, \"weightedRankingScore\": 0.9427964918160996, \"remote\": \"0\" } }, { \"id\": 155, \"title\": \"The Dark Knight\", \"overview\": \"Batman raises the stakes in his war on crime. With the help of Lt. Jim Gordon and District Attorney Harvey Dent, Batman sets out to dismantle the remaining criminal organizations that plague the streets. The partnership proves to be effective, but they soon find themselves prey to a reign of chaos unleashed by a rising criminal mastermind known to the terrified citizens of Gotham as the Joker.\", \"genres\": [ \"Drama\", \"Action\", \"Crime\", \"Thriller\" ], \"poster\": \"https://image.tmdb.org/t/p/w500/qJ2tW6WMUDux911r6m7haRef0WH.jpg\", \"release_date\": 1216166400, \"_federation\": { \"indexUid\": \"mieli\", \"queriesPosition\": 1, \"weightedRankingScore\": 0.5784178187403994, \"remote\": \"0\" } }, { \"id\": 49026, \"title\": \"The Dark Knight Rises\", \"overview\": \"Following the death of District Attorney Harvey Dent, Batman assumes responsibility for Dent's crimes to protect the late attorney's reputation and is subsequently hunted by the Gotham City Police Department. Eight years later, Batman encounters the mysterious Selina Kyle and the villainous Bane, a new terrorist leader who overwhelms Gotham's finest. The Dark Knight resurfaces to protect a city that has branded him an enemy.\", \"genres\": [ \"Action\", \"Crime\", \"Drama\", \"Thriller\" ], \"poster\": \"https://image.tmdb.org/t/p/w500/vzvKcPQ4o7TjWeGIn0aGC9FeVNu.jpg\", \"release_date\": 1342396800, \"_federation\": { \"indexUid\": \"mieli\", \"queriesPosition\": 2, \"weightedRankingScore\": 0.5772657450076805, \"remote\": \"2\" } } ], \"query\": \"Batman dark knight returns 1\", \"processingTimeMs\": 173, \"limit\": 5, \"offset\": 0, \"estimatedTotalHits\": 47, \"facetDistribution\": { \"genres\": { \"Action\": 46, \"Adventure\": 15, \"Animation\": 34, \"Comedy\": 3, \"Crime\": 14, \"Drama\": 6, \"Family\": 15, \"Fantasy\": 8, \"Horror\": 1, \"Mystery\": 4, \"Romance\": 1, \"Science Fiction\": 14, \"TV Movie\": 4, \"Thriller\": 4, \"Western\": 1 } }, \"facetStats\": {}, \"requestUid\": \"019bbcf4-a609-7701-8d82-d370611adfb3\", \"remoteErrors\": {} }此更改允许在分片上下文中自然查询所有文档。 当不存在
network.leader时(特别是在未定义network时),行为与先前版本相同。 -
useNetwork在本地实例拥有分片时选择本地实例 by @dureuill in https://github.com/meilisearch/meilisearch/pull/6287 为了防止不必要的网络活动,在决定通过网络搜索哪个远程节点提供分片时,Meilisearch 现在如果本地实例拥有该分片,则始终选择本地实例。 -
更高效的 FST 构建 by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6279 通过消除完全扫描单词文档ID数据库的需要,改进了单词 FST(单词词典)的构建。这应该会显著提高插入大量文档时的数据库性能,即使只插入少量文档也是如此。
🪲 错误修复
- 将空 VERSION 文件视为缺失处理 by @themavik in https://github.com/meilisearch/meilisearch/pull/6275
🔩 杂项
- 重新映射后处理目标以提高基准测试可读性 by @ManyTheFish in https://github.com/meilisearch/meilisearch/pull/6285
- 更新获取任务的文档负载路由的描述 by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6284
新贡献者
- @themavik 在 https://github.com/meilisearch/meilisearch/pull/6275 中做出了他们的首次贡献
更新内容 (原始)
✨ Enhancement
-
Support dynamic search rules with pinning by @YoEight in https://github.com/meilisearch/meilisearch/pull/6182 Introduce the Dynamic Search Rules (DSR) experimental feature, making it easy to promote the right content for the right searches with flexible, condition-based pinning. In this first version, rules can be triggered by query-based conditions such as empty queries or literal substring matches, as well as time windows. Multiple documents can be pinned in a defined order, and pins still work with filtering, pagination, facet distribution, hybrid search, and federated search. This feature is behind the
dynamicSearchRulesexperimental feature flag.Rules can be created or updated with
PATCH /dynamic-search-rules/{uid}and removed withDELETE /dynamic-search-rules/{uid}. In this first version, a rule can define query- or time-based conditions and pin specific documents at fixed positions in the results list.Example of rule creation/update
// PATCH /dynamic-search-rules/featured-wireless-headphones { "description": "Promote featured products for wireless headphone searches", "active": true, "conditions": [ { "scope": "query", "contains": "headphone" } ], "actions": [ { "selector": { "indexUid": "products", "id": "featured-headphones-001" }, "action": { "type": "pin", "position": 0 } }, { "selector": { "indexUid": "products", "id": "featured-headphones-002" }, "action": { "type": "pin", "position": 1 } } ] } -
Default to
useNetwork: truein sharded instances by @dureuill in https://github.com/meilisearch/meilisearch/pull/6278This release contains breaking changes for users of the
networkexperimental feature.Search requests now use the network by default when (replicated) sharding is enabled
§ Breaking changes
When
network.leaderis set in the instance,useNetworknow defaults totruein search requests when omitted.So, when a network is configured, the following:
Search request without an explicit useNetwork
// POST /indexes/movies/search { "q": "Batman dark knight returns 1", "filter": "genres IN [Action, Adventure]", "facets": ["genres"], "limit": 5 // No `useNetwork` is passed }is now equivalent to a federated search over multiples remotes so that all shards in the network are covered exactly once.
Equivalent federated search request
// POST /multi-search { "federation": { "limit": 5, "facetsByIndex": { "movies": [ "genres" ] }, "merge": {} }, // assuming 3 remotes 0, 1, 2 and 3 shards a, b, c such that // 0 owns a, b // 1 owns b, c // 2 owns c, a "queries": [ { "indexUid": "movies", "federationOptions": { "remote": "0" }, "q": "Batman dark knight returns 1", "filter": ["genres IN [Action, Adventure]", "_shard = a"] }, { "indexUid": "movies", "federationOptions": { "remote": "0" // useNetwork picked remote 0 for both shard a and b }, "q": "Batman dark knight returns 1", "filter": ["genres IN [Action, Adventure]", "_shard = b"] }, { "indexUid": "movies", "federationOptions": { "remote": "2" }, "q": "Batman dark knight returns 1", "filter": ["genres IN [Action, Adventure]", "_shard = c"] } ] }Responding with documents from all the shards:
Response
{ "hits": [ { "id": 123025, "title": "Batman: The Dark Knight Returns, Part 1", "overview": "Batman has not been seen for ten years. A new breed of criminal ravages Gotham City, forcing 55-year-old Bruce Wayne back into the cape and cowl. But, does he still have what it takes to fight crime in a new era?", "genres": [ "Action", "Animation", "Mystery" ], "poster": "https://image.tmdb.org/t/p/w500/kkjTbwV1Xnj8wBL52PjOcXzTbnb.jpg", "release_date": 1345507200, "_federation": { "indexUid": "mieli", "queriesPosition": 2, "weightedRankingScore": 0.9894586894586894, "remote": "2" } }, { "id": 142061, "title": "Batman: The Dark Knight Returns, Part 2", "overview": "Batman has stopped the reign of terror that The Mutants had cast upon his city. Now an old foe wants a reunion and the government wants The Man of Steel to put a stop to Batman.", "genres": [ "Action", "Animation", "Mystery" ], "poster": "https://image.tmdb.org/t/p/w500/arEZYd6uMOFTILne9Ux0A8qctMe.jpg", "release_date": 1357171200, "_federation": { "indexUid": "mieli", "queriesPosition": 1, "weightedRankingScore": 0.9894558963186414, "remote": "0" } }, { "id": 16234, "title": "Batman Beyond: Return of the Joker", "overview": "The Joker is back with a vengeance, and Gotham's newest Dark Knight needs answers as he stands alone to face Gotham's most infamous Clown Prince of Crime.", "genres": [ "Animation", "Family", "Action", "Science Fiction" ], "poster": "https://image.tmdb.org/t/p/w500/7RlBs0An83fqAuKfwH5gKMcqgMc.jpg", "release_date": 976579200, "_federation": { "indexUid": "mieli", "queriesPosition": 1, "weightedRankingScore": 0.9427964918160996, "remote": "0" } }, { "id": 155, "title": "The Dark Knight", "overview": "Batman raises the stakes in his war on crime. With the help of Lt. Jim Gordon and District Attorney Harvey Dent, Batman sets out to dismantle the remaining criminal organizations that plague the streets. The partnership proves to be effective, but they soon find themselves prey to a reign of chaos unleashed by a rising criminal mastermind known to the terrified citizens of Gotham as the Joker.", "genres": [ "Drama", "Action", "Crime", "Thriller" ], "poster": "https://image.tmdb.org/t/p/w500/qJ2tW6WMUDux911r6m7haRef0WH.jpg", "release_date": 1216166400, "_federation": { "indexUid": "mieli", "queriesPosition": 1, "weightedRankingScore": 0.5784178187403994, "remote": "0" } }, { "id": 49026, "title": "The Dark Knight Rises", "overview": "Following the death of District Attorney Harvey Dent, Batman assumes responsibility for Dent's crimes to protect the late attorney's reputation and is subsequently hunted by the Gotham City Police Department. Eight years later, Batman encounters the mysterious Selina Kyle and the villainous Bane, a new terrorist leader who overwhelms Gotham's finest. The Dark Knight resurfaces to protect a city that has branded him an enemy.", "genres": [ "Action", "Crime", "Drama", "Thriller" ], "poster": "https://image.tmdb.org/t/p/w500/vzvKcPQ4o7TjWeGIn0aGC9FeVNu.jpg", "release_date": 1342396800, "_federation": { "indexUid": "mieli", "queriesPosition": 2, "weightedRankingScore": 0.5772657450076805, "remote": "2" } } ], "query": "Batman dark knight returns 1", "processingTimeMs": 173, "limit": 5, "offset": 0, "estimatedTotalHits": 47, "facetDistribution": { "genres": { "Action": 46, "Adventure": 15, "Animation": 34, "Comedy": 3, "Crime": 14, "Drama": 6, "Family": 15, "Fantasy": 8, "Horror": 1, "Mystery": 4, "Romance": 1, "Science Fiction": 14, "TV Movie": 4, "Thriller": 4, "Western": 1 } }, "facetStats": {}, "requestUid": "019bbcf4-a609-7701-8d82-d370611adfb3", "remoteErrors": {} }This change allows to naturally query all the documents in a sharded context. When
network.leaderis not present (in particular, when nonetworkwas defined), then the behavior is identical to previous versions. -
useNetworkpicks local instance if it owns the shard by @dureuill in https://github.com/meilisearch/meilisearch/pull/6287 To prevent unnecessary network activity, when deciding which remote to ask for a shard in a search over the network, Meilisearch will now always pick the local instance if it owns the shard. -
More efficient FST building by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6279 It improves the construction of the word FST (word dictionary) by removing the need for a full scan of the word docids database. This should drastically improve the database’s performance when inserting a large number of documents, even when inserting only a few.
🪲 Bug fixes
- Handle empty VERSION file as missing by @themavik in https://github.com/meilisearch/meilisearch/pull/6275
🔩 Miscellaneous
- Remap post processing targets for better benchmark readability by @ManyTheFish in https://github.com/meilisearch/meilisearch/pull/6285
- Update the description of the get task’s document payload route by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6284
New Contributors
- @themavik made their first contribution in https://github.com/meilisearch/meilisearch/pull/6275
下载链接
- 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