Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection with username/password #2

Closed
jbrenna opened this issue Jul 24, 2015 · 1 comment
Closed

Connection with username/password #2

jbrenna opened this issue Jul 24, 2015 · 1 comment

Comments

@jbrenna
Copy link

jbrenna commented Jul 24, 2015

I'm trying to connect to Elasticsearch behind Nginx.
I can do it this way using the official Elasticsearch-php:

$params['hosts'] = array (
'http://example.com:8080',
);
$params['connectionParams']['auth'] = array(
'user',
'pass',
'Basic'
);

Is it possible to use ['connectionParams']['auth'] with ElasticsearchServiceProvider?

Unfortunately, this does not work for me (401 error):
http://user:pass@example.com:8080

@xmarcos
Copy link
Owner

xmarcos commented Jul 25, 2015

You can use any parameter that is supported by the Elasticsearch-PHP official library, using the Inline Authentication example from the HTTP Authentication guide, you should be able to do:

$app->register(new ElasticsearchServiceProvider(), [
    'elasticsearch.params' => [
        'hosts' => [
            'http://user:pass@localhost:9200'
        ]
    ]
]);

$app['elasticsearch']->ping();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants