Password cannot be changed because it contains quotes

When I generate elastic I got a password which includes quotes. ( like 'xxxxx"xxxx' )
This is hard to use in code (C#) so I like to change the password.
But there I get exception because the quotes too.
How can I change the password with quotes in it?


POST /_security/user/elastic/_password
  "xxxxx\"xxxx" : "secret"

I get:

  "error" : {
    "root_cause" : [
        "type" : "parse_exception",
        "reason" : "failed to parse change password request. unexpected field [xxxxx\"xxxx]"
    "type" : "parse_exception",
    "reason" : "failed to parse change password request. unexpected field [xxxxx\"xxxx]"
  "status" : 400

You mean the auto generated password that you get on first run ? This should not happen as we would not include these characters in the generated password. Are you certain that this is the password ?

In any case you can reset the password for the elastic user if you have access to the file system of the node by running bin/elastisearch-reset-password without passing the existing password as a parameter

Hi Ioannis,

I tried this also before.
Looks like that:

>elasticsearch-reset-password -u elastic

ERROR: Failed to determine the health of the cluster.

And yes the auto generated password for the user elastic includes the quotes.

The code that generates the password is here : elasticsearch/ at master · elastic/elasticsearch · GitHub and it is impossible for it to generate one that contain quotes as " is not part of the character set that is used for the password generation./

It looks like your cluster is not Green and your cannot interact with it until you fix that first. The elasticsearch.log file would contain pointers as to what is wrong with your cluster. Please take a look there.

Thank you Ioannis! :slight_smile:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.