@@ -14,22 +14,25 @@ class Bridge
1414
1515 use QueryBuilder, IndexInterpreter;
1616
17- protected Client $ client ;
17+ protected $ client ;
1818
19- protected mixed $ queryLogger = false ;
19+ protected $ queryLogger = false ;
2020
21- protected mixed $ queryLoggerOnErrorOnly = true ;
21+ protected $ queryLoggerOnErrorOnly = true ;
2222
23- protected int | null $ maxSize = 10 ; //ES default
23+ protected $ maxSize = 10 ; //ES default
2424
25- private string | null $ index ;
25+ private $ index ;
2626
27+ private $ indexPrefix ;
2728
28- public function __construct (Client $ client , $ index , $ maxSize )
29+
30+ public function __construct (Client $ client , $ index , $ maxSize , $ indexPrefix = null )
2931 {
3032 $ this ->client = $ client ;
3133 $ this ->index = $ index ;
3234 $ this ->maxSize = $ maxSize ;
35+ $ this ->indexPrefix = $ indexPrefix ;
3336
3437 if (!empty (config ('database.connections.elasticsearch.logging.index ' ))) {
3538 $ this ->queryLogger = config ('database.connections.elasticsearch.logging.index ' );
@@ -488,7 +491,7 @@ public function processIndexModify($settings): bool
488491 */
489492 public function processReIndex ($ oldIndex , $ newIndex ): Results
490493 {
491- $ prefix = str_replace ( ' * ' , '' , $ this ->index ) ;
494+ $ prefix = $ this ->indexPrefix ;
492495 if ($ prefix ) {
493496 $ oldIndex = $ prefix .'_ ' .$ oldIndex ;
494497 $ newIndex = $ prefix .'_ ' .$ newIndex ;
0 commit comments