Defined in common/config/main.php:
‘elasticsearch’ => [
‘class’ => ‘yii\elasticsearch\Connection’,
‘‘defaultProtocol’ => ‘https’,
‘nodes’ => [
[
‘http_address’ => ‘xxxx.aws.cloud.es.io:9243’,
‘auth’ = [‘username’ => ‘xxx’, ‘password’ => xxx’],
],
]
],
The elastic search model:
class EsTest extends ActiveRecord {
public static function index() {
return 'xxxxx';
}
public function attributes() {
return [
'username',
];
}
}
When run with curl via command line with the same credential, i have no problem accessing the elasticsearch table.
However when trying to access as elastic search model, I get 401 unauthorized error. What could be the problem?