发布日期: 2026-07-20
版本号: v1.50.0

Meilisearch v1.50 版本对动态搜索规则进行了重大改进,增强了在分片配置下的联邦文档获取功能,并包含多项优化与修复。

本版本引入了针对使用实验性功能用户的破坏性变更。主要变化集中在动态搜索规则和网络功能上:

  1. 动态搜索规则API进行了重构:参数priority更名为precedenceconditions从数组改为包含querytime两个字段的对象;新增QueryConditionTimeCondition类型;操作(Action)的selector现在必须指定id;列出规则的过滤参数从filter.attributePatterns改为filter.query;在分片配置中修改或删除规则现在会正确返回异步任务而非错误。
  2. 对于使用网络实验功能并配置了分片(leader不为null)的用户,默认行为发生改变:GET/POST文档相关路由现在会从所有分片获取文档,而非仅本地。用户需在请求中设置useNetworkfalse以保持原行为。

主要改进包括:

  • 动态搜索规则扩展至75,000条且不影响搜索性能,API简化并引入了“DSR燃料”机制来控制资源消耗。
  • 新增DELETE /dynamic-search-rules路由用于批量删除所有动态搜索规则。
  • conditions.query.words的匹配逻辑改变:现要求查询q中包含所有指定单词(规范化后),而非简单的子串包含。
  • 在分片配置下,动态搜索规则现在会从领导者复制到跟随者。
  • 联邦文档获取路由(GET/POST文档相关)现在会从配置网络中的所有分片获取文档。
  • 搜索和联邦搜索中的facets参数现在支持部分通配符(如dogs.*),以匹配更多符合条件的过滤属性。

主要修复有:

  • 修复了从v1.48及更早版本迁移时,处理空同义词可能导致的失败问题。
  • 解决了在特定条件下,过滤器内存消耗随长度二次方增长的问题。
  • 修正了部分正确转义的过滤器(如包含\\)导致搜索请求失败的问题。
  • 提升了创建S3快照时的容错能力。
  • 修复了Windows平台上频繁失败的测试。

此外,还包括文档补充、代码维护性改进和测试修复等杂项更新。完整变更日志可查阅其GitHub比较页面。

更新内容 (中文)

Meilisearch v1.50 对 动态搜索规则 进行了重大改进,新增分片配置下的联合文档检索支持,并包含其他多项优化。

破坏性变更

本次更新对使用部分实验性功能的用户引入了破坏性变更

dynamicSearchRules 实验性功能

请求类型变更

  1. priority 已替换为 precedence,该字段能更准确地反映规则执行逻辑(数值越低规则优先级越高)
  2. conditions 从数组类型变更为包含两个字段的对象结构:QueryCondition 类型的 query 字段和 TimeCondition 类型的 time 字段
  3. 新增 QueryCondition 类型,包含 isEmpty 字段(与之前相同)以及替换 containswords 字段(类型相同)
  4. 现在允许在 QueryCondition 中同时传递 isEmpty: falsewords 字段。若传递 isEmpty:truewords 仍会触发同步错误
  5. 新增 TimeCondition 类型,包含 startend 字段(语义与原类型相同)
  6. 指定 Actionselector 时,现在必须指定 id 字段。此前该字段为可选,但缺少该字段会导致操作永不触发
  7. 通过 POST /dynamic-search-rules 列出规则时,filter.attributePatterns 已替换为可选字符串参数 filter.query,该参数会搜索规则的 descriptionconditions.query.words 字段
  8. 在分片配置中调用 DELETE /dynamic-search-rules/{:ruleUid}PATCH /dynamic-search-rules/{:ruleUid} 时,若请求发送到非主节点的远程节点,接口将不再返回 HTTP 400 错误

响应变更

  1. PATCH /dynamic-search-rules/{:ruleUid}DELETE /dynamic-search-rules/{:ruleUid} 现在会注册异步任务
  2. 响应格式调整为返回已注册的任务信息,而非修改后的动态搜索规则
  3. 当 URL 中的 {:ruleUid} 部分指向不存在的规则时,不再返回 HTTP 404 错误。这是因为规则采用异步处理机制,与 DELETE /indexes/{:indexUid}/documents/{:docId} 针对不存在文档的处理行为保持一致

network 实验性功能

对于已配置分片(leader 不为 null)并使用 network 实验性功能的用户,以下接口的默认行为将发生变更:

  • GET indexes/:uid/documents
  • GET indexes/:uid/documents/:document_id
  • POST indexes/:uid/documents/fetch

Meilisearch 处理这些请求时将从所有分片获取文档,而非仅从本地节点获取。为保持原有行为,用户需在请求中设置 useNetworkfalse

🌈 功能改进

动态搜索规则能力扩展

  • 动态搜索规则现在支持最多 75,000 条规则且不会影响搜索性能
  • 动态搜索规则 API 已简化
    • 降低了发送永不会生效的条件规则的可能性
  • 此改进为未来功能奠定基础,例如为搜索规则添加过滤激活条件

新增内容

  • 新增 DELETE /dynamic-search-rule 接口用于删除所有动态搜索规则
  • 引入"动态搜索规则资源"概念,用于控制搜索过程中解析规则的资源消耗。资源值通过以下环境变量配置(支持覆盖默认值):
    • MEILI_EXPERIMENTAL_DSR_FUEL_MAX_COUNTED_WORDS:搜索查询中用于匹配 conditions.query.words 约束条件的最大词数。默认值 10,最大值 255
    • MEILI_EXPERIMENTAL_DSR_FUEL_MAX_ACTIVE_RULES:需评估操作的最大活跃规则数。默认值 1000,最大值 4294967295
    • MEILI_EXPERIMENTAL_DSR_FUEL_MAX_PIN_ACTIONS:最大可执行的固定操作数量。默认值 100,最大值 4294967295
    • MEILI_EXPERIMENTAL_DSR_FUEL_WORD_FUEL:用于查找 conditions.query.words 约束条件的最大约束组合评估数。默认值 4096,最大值 4294967295

由 @dureuill 在 https://github.com/meilisearch/meilisearch/pull/6484https://github.com/meilisearch/meilisearch/pull/6506 中贡献

行为变更

  • conditions.query.words 的匹配逻辑已调整:此前规则匹配遵循 str::contains 的子串匹配规则,现在则要求 conditions.query.words 中的所有词项(经过标准化处理)必须完整出现在搜索词 q 中。例如对于 q = hero superquery.contains = super hero 不会匹配,而 conditions.query.words = super hero 现在可以匹配。此行为更接近常规搜索逻辑,并有助于提升性能
  • 在分片配置中,动态搜索规则现在会从主节点复制到从节点

联合文档检索路由

GET indexes/:uid/documentsGET indexes/:uid/documents/:document_idPOST indexes/:uid/documents/fetch 现在将从已配置网络中的所有分片获取文档。

新增 useNetwork 参数,用于控制是否启用网络调用功能。

由 @ManyTheFish 在 https://github.com/meilisearch/meilisearch/pull/6495 中贡献

支持分面查询部分通配符

搜索和联合搜索中的 facets 参数现已支持更灵活的通配符用法。此前仅支持单字符通配符 "*" 用于匹配所有可过滤字段。

现在支持包含 * 的模式匹配,匹配规则与 filterableAttributes.attributePatternslocalizedAttributes.attributePatterns 一致。例如 dogs.* 将匹配所有符合该模式的可过滤字段(如 dogs.inteldogs.kefir 等),并将其纳入分面分布计算。

由 @Kerollmops 在 https://github.com/meilisearch/meilisearch/pull/6497 中贡献

🦋 问题修复

修复从 v1.48 及更早版本迁移的问题

v1.49 版本中通过 --experimental-dumpless-upgrade 进行迁移时,若遇到空同义词(或仅包含分隔符如 & 的同义词)会导致迁移失败。

现在迁移过程会忽略此类同义词,避免了该问题。

由 @Kerollmops 在 https://github.com/meilisearch/meilisearch/pull/6501 中贡献

修复特定条件下的过滤器内存消耗问题

在某些条件下,过滤器的内存消耗会随着过滤器长度呈二次方增长。此问题在相关场景中已得到解决。

由 @ManyTheFish 在 https://github.com/meilisearch/meilisearch/pull/6509 中贡献

不再拒绝正确转义的部分过滤器

修复了包含转义字符(如 \\) 的过滤器会导致搜索请求返回 invalid_search_filter 错误的缺陷。

由 @dureuill 在 https://github.com/meilisearch/meilisearch/pull/6499 中贡献

提升 S3 快照容错性

可能修复了向 AWS S3 发送创建新分段上传请求时可能出现的问题,确保请求失败时能自动重试。

由 @Kerollmops 在 https://github.com/meilisearch/meilisearch/pull/6494 中贡献

🔩 其他变更

完整变更日志:https://github.com/meilisearch/meilisearch/compare/v1.49.0…v1.50.0

更新内容 (原始)

Meilisearch v1.50 revamps the Dynamic Search Rules, adds support for federated document fetch in sharded configurations, among other improvements

Breaking changes

This release introduces breaking changes for users using some experimental features

dynamicSearchRules experimental feature

Request type changes

  1. priority has been replaced with precedence, which better reflects the behavior (lower precedence means the rule is applied first)
  2. conditions has been modified from an array to an object with two fields: “query” of type QueryCondition and “time” of time TimeCondition
  3. New type QueryCondition that contains the fields isEmpty (as previously) and words instead of contains (same type)
  4. It is now possible to pass isEmpty: false with words in a QueryCondition. Passing isEmpty:true with words still results in a synchronous error.
  5. New type TimeCondition with fields start and end (unchanged semantics from previous type).
  6. When specifying the selector of an Action, it is now mandatory to specify an id. Previously, it was optional, but the action would never trigger.
  7. When listing rules with POST /dynamic-search-rules, filter.attributePatterns has been replaced with filter.query, an optional string that searches in rule description and conditions.query.words.
  8. When calling DELETE /dynamic-search-rules/{:ruleUid} or PATCH /dynamic-search-rules/{:ruleUid} in a sharded configuration, endpoint will not return a HTTP 400 error if called on a follower remote rather than on the leader.

Response changes

  1. PATCH /dynamic-search-rules/{:ruleUid} and DELETE /dynamic-search-rules/{:ruleUid} now register an asynchronous task..
  2. The response is modified to return the registered task instead of the modified dynamic search rule.
  3. HTTP 404 is no longer returned if the {:ruleUid} portion of the URL refers to a rule that doesn’t exist. This is because rules are processed asynchronously, and is consistent with the behavior of DELETE /indexes/{:indexUid}/documents/{:docId} for {:docId}

network experimental feature

The default behavior for users using the network experimental feature with sharding configured (leader not null) will change on the following routes:

  • GET indexes/:uid/documents
  • GET indexes/:uid/documents/:document_id
  • POST indexes/:uid/documents/fetch

Meilisearch will now fetch the documents from all the shards and not only on the local machine when processing the request. To keep the same behavior as before, users will have to set useNetwork to false when making their request.

🌈 Improvements

Scaling up the Dynamic Search Rules

  • Dynamic search rules scale up to 75K rules without any impact on the search
  • The API of Dynamic Search Rules has been simplified
    • It is harder to send conditions that will result in the rules never activating
  • This also unlocks future improvements such as filter activation conditions for search rules

Additions

  • Add a new DELETE /dynamic-search-rule route that deletes all the DSRs
  • Add the concept of “DSR fuel” that determines how much energy is spent resolving DSR during a search. The fuel is initialized with some default variables that can be overridden using environment variables:
    • MEILI_EXPERIMENTAL_DSR_FUEL_MAX_COUNTED_WORDS: max number of words considered inside of a search query for the purpose of finding conditions.query.words constraints. Defaults to 10, max value is 255
    • MEILI_EXPERIMENTAL_DSR_FUEL_MAX_ACTIVE_RULES: max number of active rules whose actions are evaluated. Defaults to 1000, max value is 4294967295
    • MEILI_EXPERIMENTAL_DSR_FUEL_MAX_PIN_ACTIONS: max number of pin actions that are applied. Defaults to 100, max value is 4294967295
    • MEILI_EXPERIMENTAL_DSR_FUEL_WORD_FUEL: max number of constraint combinations that are evaluated for the purpose of finding conditions.query.words constraints. Defaults to 4096, max value is 4294967295

By @dureuill in https://github.com/meilisearch/meilisearch/pull/6484 and https://github.com/meilisearch/meilisearch/pull/6506

Behavior changes

  • The conditions.query.words behaves differently from query.contains: previously, a rule would match if its conditions query.contains would be substrings of q in the search query in the sense of str::contains. Now, a rule matches if all the words in conditions.query.words appear in q (after normalization). For q = hero super, query.contains = super hero would not match, whereas conditions.query.words = super hero does now match. This behavior is more in line with regular search, and allows improving performance.
  • Dynamic search rules are now replicated from the leader to its follower, when in a sharded configuration

Federated document fetch routes

GET indexes/:uid/documents, GET indexes/:uid/documents/:document_id and POST indexes/:uid/documents/fetch will now fetch the documents from all the shards in the configured network.

Moreover, a new useNetwork parameter is available to activate or deactivate the usage of the network.

By @ManyTheFish in https://github.com/meilisearch/meilisearch/pull/6495

Support partial wildcards when requesting facets

The facets parameter in search and federated search now supports more wildcards. Previously, only the single wildcard "*" was supported, requesting all filterable fields.

Now, patterns containing * are supported with the same matching rules as in filterableAttributes.attributePatterns and localizedAttributes.attributePatterns, such as dogs.*, which will add to the facet distribution all filterable fields that match the pattern (such as dogs.intel, dogs.kefir, etc.).

By @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6497

🦋 Fixes

Fix migration from v1.48 and earlier

Migration via --experimental-dumpless-upgrade would fail in some cases in v1.49, when trying to migrate synonyms that contained no words (empty synonyms, or containing only separator tokens such as &).

Such synonyms are now ignored during migration, avoiding the issue.

By @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6501

Fix filter memory consumption in some cases

In some conditions, the memory consumption of filters would increase quadratically with the length of the filter. This is now resolved for these cases.

By @ManyTheFish in https://github.com/meilisearch/meilisearch/pull/6509

No longer reject some correctly-escaped filters

Fix a bug where some filters containing escaped characters (such as \) would cause search requests to fail with invalid_search_filter

By @dureuill in https://github.com/meilisearch/meilisearch/pull/6499

More fault-tolerant S3 snapshots

Potentially fix an issue when sending a request to AWS S3 to create a new multipart upload, ensuring we resend the request if it fails.

By @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6494

🔩 Miscellaneous changes

Full Changelog: https://github.com/meilisearch/meilisearch/compare/v1.49.0...v1.50.0

下载链接