File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ public function getPrimaryIndex()
5757 */
5858 public function setPrimaryIndex ($ name )
5959 {
60+ $ this ->logger ->debug (sprintf ('Setting primary index to %s. ' , $ name ));
6061 $ params = [
6162 'body ' => [
6263 'actions ' => [
@@ -73,9 +74,15 @@ public function setPrimaryIndex($name)
7374 ]
7475 ]
7576 ]
76- ],
77- 'client ' => ['ignore ' => 404 ]
77+ ]
7878 ];
79- $ this ->engine ->indices ()->updateAliases ($ params );
79+ try {
80+ $ this ->engine ->indices ()->updateAliases ($ params );
81+ } catch (\Elasticsearch \Common \Exceptions \Missing404Exception $ e ) {
82+ $ this ->logger ->debug ('No aliases matched the pattern. Retrying without the removal of old indices. ' );
83+ array_shift ($ params ['body ' ]['actions ' ]);
84+ $ this ->engine ->indices ()->updateAliases ($ params );
85+ }
86+
8087 }
8188}
You can’t perform that action at this time.
0 commit comments