@@ -83,21 +83,25 @@ def create_index(client: MongoClient, filename: Path) -> None:
83
83
indexes = [index ["name" ] for index in collection .list_search_indexes ()]
84
84
if index_name not in indexes :
85
85
collection .create_search_index (search_index )
86
- logger .debug ("waiting for search index to be ready..." )
87
- wait_until_complete = 60
88
- _wait_for_predicate (
89
- predicate = lambda : _is_index_ready (collection , index_name ),
90
- err = f"Index { index_name } update did not complete in { wait_until_complete } !" ,
91
- timeout = wait_until_complete ,
92
- )
93
- logger .debug ("waiting for search index to be ready... done." )
86
+
94
87
else :
95
88
logger .debug (
96
- "search index already exists! : %s on %s.%s" ,
89
+ "search index already exists, updating : %s on %s.%s" ,
97
90
index_name ,
98
91
database_name ,
99
92
collection_name ,
100
93
)
94
+ collection .update_search_index (index_name , loaded_index_configuration )
95
+
96
+ logger .debug ("waiting for search index to be ready..." )
97
+ wait_until_complete = 60
98
+ _wait_for_predicate (
99
+ predicate = lambda : _is_index_ready (collection , index_name ),
100
+ err = f"Index { index_name } update did not complete in { wait_until_complete } !" ,
101
+ timeout = wait_until_complete ,
102
+ )
103
+ logger .debug ("waiting for search index to be ready... done." )
104
+
101
105
logger .debug (
102
106
"creating search index: %s on %s.%s... done" ,
103
107
index_name ,
0 commit comments