@@ -51,6 +51,8 @@ public function _reindex($safe = true, $setSettings = true, $mergeOldSettings =
5151 for ($ i = 0 ; $ i < count ($ indices ); $ i ++) {
5252 $ modelHelper ->algolia ->moveIndex ($ indicesTmp [$ i ]->indexName , $ indices [$ i ]->indexName );
5353 }
54+
55+ $ this ->_setSettings (false ); // To a setSettings to set the slave on the master
5456 }
5557 }
5658
@@ -211,6 +213,13 @@ public function _setSettings($setToTmpIndices = false, $mergeOldSettings = false
211213 $ index ->clearSynonyms (true );
212214 }
213215
216+ // If we move the index the setSettings should not contains slave or replica.
217+ if ($ setToTmpIndices && $ b ) {
218+ $ b = false ;
219+ unset($ settings ['replicas ' ]);
220+ unset($ settings ['slaves ' ]); // backward compatibility
221+ }
222+
214223 if (count (array_keys ($ settings )) > 0 ) {
215224 // Synonyms cannot be pushed into "setSettings", it's got rejected from API and throwing exception
216225 // Synonyms cannot be removed directly from $settings var, because then synonym would not be set to other indices
@@ -220,13 +229,10 @@ public function _setSettings($setToTmpIndices = false, $mergeOldSettings = false
220229 $ index ->setSettings ($ settingsWithoutSynonyms );
221230 }
222231
223- if ($ b && isset ( $ settings [ ' replicas ' ]) ) {
232+ if ($ b ) {
224233 $ b = false ;
225234 unset($ settings ['replicas ' ]);
226- } else if ($ b && isset ($ settings ['slaves ' ])) {
227- // Backward compatibility
228- $ b = false ;
229- unset($ settings ['slaves ' ]);
235+ unset($ settings ['slaves ' ]); // backward compatibility
230236 }
231237 }
232238
0 commit comments