0

I've setup users and roles on my ElasticSearch and while it works like a charm with curl it doesn't seem to work through FOSElastica. I'm using it to populate my ElasticSearch indices.

I've tried to setup username and password through fos_elastica config file (like shown here) with no success :

fos_elastica:
    serializer: 
        serializer: jms_serializer
    clients:
        default: 
            host: localhost 
            port: 9200
            username: 'elastic'
            paswword: 'password'

I've even tried to hard setup username and password in Http.php in Elastica files, same no success and no changes in the error message, it keeps telling me :

In Http.php line 182:

  action [indices:admin/create] is unauthorized for user [anonymous_user]

Like there's no username/password at all. Anyone encountered that problem ?

EDIT : I found something interesting : line 107 of Http.php in Elastica files is

curl_setopt($conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);

And it doesn't work for ElasticSearch Xpack authentication.

But, if you change CURLATUH_ANY to CURLAUTH_BASIC, it actually works.

I'll open an issue on github.

EDIT : issue opened here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.