{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/192","repository_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch","labels_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/192/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/192/events","html_url":"https://github.com/yiisoft/yii2-elasticsearch/issues/192","id":349882218,"node_id":"MDU6SXNzdWUzNDk4ODIyMTg=","number":192,"title":"error when connect with Aliyun Elasticsearch 5.3 Service","user":{"login":"purevirtual","id":1276840,"node_id":"MDQ6VXNlcjEyNzY4NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1276840?v=4","gravatar_id":"","url":"https://api.github.com/users/purevirtual","html_url":"https://github.com/purevirtual","followers_url":"https://api.github.com/users/purevirtual/followers","following_url":"https://api.github.com/users/purevirtual/following{/other_user}","gists_url":"https://api.github.com/users/purevirtual/gists{/gist_id}","starred_url":"https://api.github.com/users/purevirtual/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purevirtual/subscriptions","organizations_url":"https://api.github.com/users/purevirtual/orgs","repos_url":"https://api.github.com/users/purevirtual/repos","events_url":"https://api.github.com/users/purevirtual/events{/privacy}","received_events_url":"https://api.github.com/users/purevirtual/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-13T04:11:59Z","updated_at":"2018-08-15T03:46:33Z","closed_at":"2018-08-15T03:46:33Z","author_association":"NONE","body":"**I use yii2-elasticsearch 2.1 cause I want to connect with Aliyun-es-service[version 5.3]\r\nBut If failed when start to connect...**\r\n\r\n### What steps will reproduce the problem?\r\nI'm using yii2-elasticsearch 2.1, and this is my component configuration.\r\n'elasticsearch' => [\r\n     'class' => 'yii\\elasticsearch\\Connection',\r\n     'nodes' => [\r\n         // configure more hosts if you have a cluster\r\n         [\r\n             'http_address' => '**.elasticsearch.aliyuncs.com:9200',\r\n         ],\r\n     ],\r\n     'auth' => ['username' => '**', 'password' => '**'],\r\n],\r\n\r\nProducing following error\r\n2018-08-13 11:49:38 [-][-][-][error][yii\\elasticsearch\\Exception] yii\\elasticsearch\\Exception: Elasticsearch request failed: 7 - Failed connect to 192.168.7.211:9200; Connection t\r\nimed out in /home/yangchao/project1/vendor/yiisoft/yii2-elasticsearch/Connection.php:504\r\nStack trace:\r\n#0 /home/yangchao/project1/vendor/yiisoft/yii2-elasticsearch/Connection.php(303): yii\\elasticsearch\\Connection->httpRequest('GET', 'http://192.168....', NULL, false)\r\n#1 /home/yangchao/project1/vendor/yiisoft/yii2-elasticsearch/Command.php(156): yii\\elasticsearch\\Connection->get(Array, Array)\r\n#2 /home/yangchao/project1/vendor/yiisoft/yii2-elasticsearch/ActiveRecord.php(149): yii\\elasticsearch\\Command->get('test-1', 'default', 1, Array)\r\n#3 /home/yangchao/project1/console/controllers/UpTestController.php(36): yii\\elasticsearch\\ActiveRecord::get(1)\r\n#4 [internal function]: console\\controllers\\UpTestController->actionEs()\r\n#5 /home/yangchao/project1/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)\r\n#6 /home/yangchao/project1/vendor/yiisoft/yii2/base/Controller.php(157): yii\\base\\InlineAction->runWithParams(Array)\r\n#7 /home/yangchao/project1/vendor/yiisoft/yii2/console/Controller.php(148): yii\\base\\Controller->runAction('es', Array)\r\n#8 /home/yangchao/project1/vendor/yiisoft/yii2/base/Module.php(528): yii\\console\\Controller->runAction('es', Array)\r\n#9 /home/yangchao/project1/vendor/yiisoft/yii2/console/Application.php(180): yii\\base\\Module->runAction('up-test/es', Array)\r\n#10 /home/yangchao/project1/vendor/yiisoft/yii2/console/Application.php(147): yii\\console\\Application->runAction('up-test/es', Array)\r\n#11 /home/yangchao/project1/vendor/yiisoft/yii2/base/Application.php(386): yii\\console\\Application->handleRequest(Object(yii\\console\\Request))\r\n#12 /home/yangchao/project1/yii(27): yii\\base\\Application->run()\r\n#13 {main}\r\nAdditional Information:\r\nArray\r\n(\r\n    [requestMethod] => GET\r\n    [requestUrl] => http://192.168.7.211:9200/test-1/default/1\r\n    [requestBody] =>\r\n    [responseHeaders] => Array\r\n        (\r\n        )\r\n\r\n    [responseBody] =>\r\n)\r\n\r\n\r\n\r\n### What's expected?\r\nIt should be connect. but as per connection.php. It is simply ignoring nodes where http:publish_address key is not available in the response.\r\n\r\n\r\n### What do you get instead?\r\nmentioned above\r\n\r\n### Additional info\r\n| Q                | A\r\n| ---------------- | ---\r\n| Yii version      | 2.0.15.1\r\n| PHP version      | 7.1.13\r\n| Operating system | CentOS Linux release 7.4.1708 (Core)\r\n\r\n### What I know and suggest\r\n1 Why?\r\n    Aliyun (a china compute cloud service provider like AWS) has SLB and access controller after its main node address [.elasticsearch.aliyuncs.com], so I should and just need to directly use the host rather than node address\r\n2 How?\r\n   So far, I just add one line code in Connection.php after \"$node['http_address'] = $node['http']['publish_address'];\"\r\n    \"$node['http_address'] = $host;\", and it works\r\n   so, I suggest, maybe, could you add a member called \"$forceUseHost\" in Connection.php?\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/comments/413085788","html_url":"https://github.com/yiisoft/yii2-elasticsearch/issues/192#issuecomment-413085788","issue_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/192","id":413085788,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzA4NTc4OA==","user":{"login":"purevirtual","id":1276840,"node_id":"MDQ6VXNlcjEyNzY4NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1276840?v=4","gravatar_id":"","url":"https://api.github.com/users/purevirtual","html_url":"https://github.com/purevirtual","followers_url":"https://api.github.com/users/purevirtual/followers","following_url":"https://api.github.com/users/purevirtual/following{/other_user}","gists_url":"https://api.github.com/users/purevirtual/gists{/gist_id}","starred_url":"https://api.github.com/users/purevirtual/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purevirtual/subscriptions","organizations_url":"https://api.github.com/users/purevirtual/orgs","repos_url":"https://api.github.com/users/purevirtual/repos","events_url":"https://api.github.com/users/purevirtual/events{/privacy}","received_events_url":"https://api.github.com/users/purevirtual/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T03:46:33Z","updated_at":"2018-08-15T03:46:33Z","author_association":"NONE","body":"Find the solution after reading the source code carefully...\r\nhttps://github.com/yiisoft/yii2-elasticsearch/pull/193"}}
{"actor":{"display_login":"purevirtual"}}