@@ -17,11 +17,12 @@ class Connection extends BaseConnection
1717 protected $ index ;
1818 protected $ maxSize ;
1919 protected $ indexPrefix ;
20- protected $ retires = null ; //null will use default
20+ protected $ allowIdSort = false ;
2121 protected $ sslVerification = true ;
22- protected $ elasticMetaHeader = true ;
22+ protected $ retires = null ; //null will use default
23+ protected $ elasticMetaHeader = null ;
2324 protected $ rebuild = false ;
24- protected $ allowIdSort = false ;
25+
2526
2627 public function __construct (array $ config )
2728 {
@@ -44,16 +45,16 @@ public function setOptions($config)
4445 if (!empty ($ config ['index_prefix ' ])) {
4546 $ this ->indexPrefix = $ config ['index_prefix ' ];
4647 }
47- if (! empty ($ config ['options ' ]['allow_id_sort ' ])) {
48+ if (isset ($ config ['options ' ]['allow_id_sort ' ])) {
4849 $ this ->allowIdSort = $ config ['options ' ]['allow_id_sort ' ];
4950 }
50- if (! empty ($ config ['options ' ]['ssl_verification ' ])) {
51+ if (isset ($ config ['options ' ]['ssl_verification ' ])) {
5152 $ this ->sslVerification = $ config ['options ' ]['ssl_verification ' ];
5253 }
53- if (! empty ($ config ['options ' ]['retires ' ])) {
54+ if (isset ($ config ['options ' ]['retires ' ])) {
5455 $ this ->retires = $ config ['options ' ]['retires ' ];
5556 }
56- if (! empty ($ config ['options ' ]['meta_header ' ])) {
57+ if (isset ($ config ['options ' ]['meta_header ' ])) {
5758 $ this ->elasticMetaHeader = $ config ['options ' ]['meta_header ' ];
5859 }
5960 }
@@ -239,8 +240,11 @@ protected function _cloudConnection(): Client
239240 protected function _builderOptions ($ cb )
240241 {
241242 $ cb ->setSSLVerification ($ this ->sslVerification );
242- $ cb ->setElasticMetaHeader ($ this ->elasticMetaHeader );
243- if ($ this ->retires ) {
243+ if (isset ($ this ->elasticMetaHeader )) {
244+ $ cb ->setElasticMetaHeader ($ this ->elasticMetaHeader );
245+ }
246+
247+ if (isset ($ this ->retires )) {
244248 $ cb ->setRetries ($ this ->retires );
245249 }
246250 $ caBundle = config ('database.connections.elasticsearch.ssl_cert ' ) ?? null ;
0 commit comments