meilisearch/MeiliSearch

Support target index names in the support route

开放

#6,049 创建于 2025年12月11日

 (6 条评论) (0 个反应) (0 位负责人)Rust (2,542 个派生)batch import
Retentionfeature/enhancementgood first issueimpacts docsimpacts integrations

仓库指标

星标
 (57,572 个星标)
PR 合并指标
 (平均合并 11天 20小时) (30 天内合并 41 个 PR)

描述

We recently introduced the export route, which is very useful for exporting documents between instances. However, there is one missing feature that could be useful in practice: the support for target index names. This feature would allow using a defined name for each exported index.

This way we would be able to:

  • Merge indexes into a single one,
  • Target the same instance but into indexes with different names and settings,
  • Create indexes dedicated to specific time ranges (using filters and names).

The API I would like to see resembles the following. It would be possible to use the special $name variable to construct target index names dynamically. If the $name variable is not present, the index name would be static and corresponds precisely to the provided value (raw). Users can also omit the name field, and it will use the original index name, the current and default behavior.

I am still asking myself a question: Should we introduce the $name variable that results in the whole index name, or rather a $pattern one that only corresponds to what the * matches. I still think the second option would be more challenging to work with and prone to more errors; a missing * can result in an empty string, while the $name will always correspond to a valid index name.

// POST /export

{
  "url": "http://ms-xxx-yy.fra.meilisearch.com",
  "indexes": {
    "super-*": { // matches "super-toto" and "super-boby"
      "name": "mega-$name", // will result in "mega-super-toto" and "mega-super-boby"
      "filter": "super-power = laser"
    }
  }
}
// POST /export

{
  "url": "http://ms-xxx-yy.fra.meilisearch.com",
  "indexes": {
    "super-*": { // matches "super-toto", "super-boby"
      "name": "everyone", // no pattern so results in "everyone"
      "filter": "super-power = laser"
    }
  }
}

贡献者指南