33namespace PDPhilip \Elasticsearch ;
44
55use PDPhilip \Elasticsearch \DSL \Bridge ;
6- use Elasticsearch \ClientBuilder ;
6+ use Elastic \ Elasticsearch \ClientBuilder ;
77use Illuminate \Database \Connection as BaseConnection ;
88use Illuminate \Support \Arr ;
99use Illuminate \Support \Str ;
@@ -142,15 +142,15 @@ protected function buildConnection()
142142 {
143143 $ type = config ('database.connections.elasticsearch.auth_type ' ) ?? null ;
144144 $ type = strtolower ($ type );
145- if (!in_array ($ type , ['http ' , 'cloud ' , ' api ' ])) {
145+ if (!in_array ($ type , ['https ' , 'cloud ' ,])) {
146146 throw new RuntimeException ('Invalid [auth_type] in database config. Must be: http, cloud or api ' );
147147 }
148148
149149 return $ this ->{'_ ' .$ type .'Connection ' }();
150150
151151 }
152152
153- protected function _httpConnection ()
153+ protected function _httpsConnection ()
154154 {
155155 $ hosts = config ('database.connections.elasticsearch.hosts ' ) ?? null ;
156156 $ username = config ('database.connections.elasticsearch.username ' ) ?? null ;
@@ -161,7 +161,7 @@ protected function _httpConnection()
161161 $ cb ->setBasicAuthentication ($ username , $ pass )->build ();
162162 }
163163 if ($ certPath ) {
164- $ cb ->setSSLVerification ($ certPath );
164+ $ cb ->setCABundle ($ certPath );
165165 }
166166
167167 return $ cb ->build ();
@@ -187,21 +187,7 @@ protected function _cloudConnection()
187187
188188 return $ cb ->build ();
189189 }
190-
191-
192- protected function _apiConnection ()
193- {
194- $ apiId = config ('database.connections.elasticsearch.api_id ' ) ?? null ;
195- $ apiKey = config ('database.connections.elasticsearch.api_key ' ) ?? null ;
196- $ certPath = config ('database.connections.elasticsearch.ssl_cert ' ) ?? null ;
197- $ cb = ClientBuilder::create ()->setApiKey ($ apiId , $ apiKey );
198- if ($ certPath ) {
199- $ cb ->setSSLVerification ($ certPath );
200- }
201-
202- return $ cb ->build ();
203- }
204-
190+
205191
206192 //----------------------------------------------------------------------
207193 // Dynamic call routing to DSL bridge
0 commit comments