Skip to content

Commit 4359f79

Browse files
committed
feat: Adding support for index renaming.
1 parent b50209a commit 4359f79

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

meilisearch/client.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -999,50 +999,3 @@ def _valid_uuid(uuid: str) -> bool:
999999
)
10001000
match = uuid4hex.match(uuid)
10011001
return bool(match)
1002-
1003-
def get_experimental_features(self) -> dict:
1004-
"""Get current experimental features settings."""
1005-
return self.http.get(self.config.paths.experimental_features)
1006-
1007-
def update_experimental_features(self, features: dict) -> dict:
1008-
"""Update experimental features settings."""
1009-
return self.http.patch(self.config.paths.experimental_features, body=features)
1010-
1011-
def enable_multimodal(self) -> dict:
1012-
"""Enable multimodal experimental feature."""
1013-
return self.update_experimental_features({"multimodal": True})
1014-
1015-
def disable_multimodal(self) -> dict:
1016-
"""Disable multimodal experimental feature."""
1017-
return self.update_experimental_features({"multimodal": False})
1018-
1019-
def swap_indexes(self, swaps: List[Dict[str, list]]) -> TaskInfo:
1020-
"""
1021-
Swap or rename indexes in Meilisearch.
1022-
This method accepts a list of swap instructions.
1023-
Each instruction must contain:
1024-
1025-
- "indexes": a list of exactly two index UIDs
1026-
- "rename" (optional): boolean flag
1027-
* False (default): swap two existing indexes
1028-
* True: rename index_a → index_b (index_b must NOT exist)
1029-
1030-
A single request can perform multiple swap or rename operations.
1031-
All operations in the request are atomic—either all succeed, or none do.
1032-
1033-
Example:
1034-
[
1035-
{"indexes": ["A", "B"]},
1036-
{"indexes": ["C_tmp", "C"], "rename": True}
1037-
]
1038-
1039-
Returns
1040-
-------
1041-
TaskInfo
1042-
Task information for the asynchronous swap/rename task.
1043-
"""
1044-
if not swaps or not all("indexes" in s and len(s["indexes"]) == 2 for s in swaps):
1045-
raise ValueError("Each swap must contain exactly two index UIDs under 'indexes' key.")
1046-
1047-
task = self.http.post("/swap-indexes",swaps)
1048-
return TaskInfo(**task)

0 commit comments

Comments
 (0)