11
11
12
12
trait ElasticquentClientTrait
13
13
{
14
-
15
14
use ElasticquentConfigTrait;
16
15
17
-
18
16
/**
19
- * Get ElasticSearch Client
17
+ * Get ElasticSearch Client.
20
18
*
21
19
* @return \Elasticsearch\Client
22
20
*/
@@ -27,7 +25,7 @@ public function getElasticSearchClient()
27
25
// elasticsearch v2.0 using builder
28
26
if (class_exists ('\Elasticsearch\ClientBuilder ' )) {
29
27
$ awsConfig = $ this ->getElasticConfig ('aws ' );
30
- if ( ! empty ($ awsConfig ) && array_get ($ this ->getElasticConfig ('aws ' ), 'iam ' , false )) {
28
+ if (! empty ($ awsConfig ) && array_get ($ this ->getElasticConfig ('aws ' ), 'iam ' , false )) {
31
29
if ($ handler = $ this ->getAwsESHandler ()) {
32
30
array_set ($ config , 'handler ' , $ handler );
33
31
}
@@ -40,7 +38,6 @@ public function getElasticSearchClient()
40
38
return new \Elasticsearch \Client ($ config );
41
39
}
42
40
43
-
44
41
/**
45
42
* @return bool|\Closure
46
43
*/
@@ -51,12 +48,12 @@ private function getAwsESHandler()
51
48
return false ;
52
49
}
53
50
54
- $ key = array_get ($ awsConfig , 'key ' );
51
+ $ key = array_get ($ awsConfig , 'key ' );
55
52
$ secret = array_get ($ awsConfig , 'secret ' );
56
53
$ region = array_get ($ awsConfig , 'region ' , 'us-west-2 ' );
57
54
58
55
$ psr7Handler = \Aws \default_http_handler ();
59
- $ signer = new SignatureV4 ('es ' , $ region );
56
+ $ signer = new SignatureV4 ('es ' , $ region );
60
57
61
58
$ handler = function (array $ request ) use (
62
59
$ psr7Handler ,
@@ -87,11 +84,10 @@ private function getAwsESHandler()
87
84
'headers ' => $ response ->getHeaders (),
88
85
'body ' => $ response ->getBody ()->detach (),
89
86
'transfer_stats ' => ['total_time ' => 0 ],
90
- 'effective_url ' => (string )$ psr7Request ->getUri (),
87
+ 'effective_url ' => (string ) $ psr7Request ->getUri (),
91
88
]);
92
89
};
93
90
94
91
return $ handler ;
95
92
}
96
-
97
93
}
0 commit comments