Errors rebuilding the indexes after upgrading to elasticsearch 8

Infos:

    • Used Zammad version: 7.1.3-1789383559.f56648e.ubuntu22
    • Used Zammad installation type: Ubuntu package
    • Operating system: Ubuntu 22.04.5 LTS

After upgrading to elasticsearch 8 (from 7), following Aktualisieren von Elasticsearch 7 auf 9 - YouTube and Migrating Elasticsearch from 7 to 9 - Opengist I cannot rebuild the index. Which is needed to upgrade to elasticsearch 9.

I set the URL with

sudo zammad run rails r "Setting.set('es_url', '``https://localhost:9200``')"

and the password with

zammad run rails r "Setting.set('es_password', '<password>')"

Expected behavior:

  • Rebuild index

Actual behavior:

  • Unable to process GET request to elasticsearch URL 'https://localhost:9200'. Check the response and payload for detailed information:
    
    Response:
    
    #<UserAgent::Result:0x000071c346b10dc0 @success=false, @body="{\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"missing authentication credentials for REST request [/]\",\"header\":{\"WWW-Authenticate\":[\"Basic realm=\\\"security\\\", charset=\\\"UTF-8\\\"\",\"Bearer realm=\\\"security\\\"\",\"ApiKey\"]}}],\"type\":\"security_exception\",\"reason\":\"missing authentication credentials for REST request [/]\",\"header\":{\"WWW-Authenticate\":[\"Basic realm=\\\"security\\\", charset=\\\"UTF-8\\\"\",\"Bearer realm=\\\"security\\\"\",\"ApiKey\"]}},\"status\":401}", @data=nil, @code="401", @content_type=nil, @error="Client Error: #<Net::HTTPUnauthorized 401 Unauthorized readbody=true>!", @header={"www-authenticate" => "Basic realm=\"security\", charset=\"UTF-8\", Bearer realm=\"security\", ApiKey", "content-type" => "application/json", "content-length" => "461"}>
    

Steps to reproduce the behavior:

  • sudo zammad run rake zammad:searchindex:rebuild[2]

Hello,

the error tells you the issue:

missing authentication credentials for REST request

Did you setup the credentials in ES and Zammad according to the documentation?

This is how I upgraded from 7 to 9

I followed the documentation and thought that I set all credentials needed.

What I did for the credentials:

sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto

sudo zammad run rails r "Setting.set('es_url', 'https://localhost:9200')"

zammad run rails r "Setting.set('es_password', '<password>')"

Where I replaced with the one I got for user elastic in the first step.

Am I something missing?

Kann es sein, dass ich einfach nur

zammad run rails r "Setting.set('es_ssl_verify', false)"

vergessen habe?

If these are the only steps you took, then setting the `es_user` is missing here.

This is an english only board.

And the short answer is no, the error message tells you, that the credentials are invalid.

I’m also confused… Didn’t you say here Errors while upgrading elasticsearch from version 7 to 9 that you solved the problem? So did you rerun on another host and not repeat the same steps?

I am sorry for my german post in between. That wasn’t on purpose.

I solved the errors I got from the precheck (“sudo curl --insecure -uelastic:${es_password} https://127.0.0.1:9200/_migration/deprecations| jq”). Then I went on and ran into other errors. I opened one moe post because the other one was already closed. And the system asked me kind of to do so. Was that not the right way to go?

I thought if I did not change the user I would not have to set it again.

Zammad defaults to an empty `es_user`. It’s not needed if you’re using it unauthenticated. So if you begin to use authentication, setting a password is not enough - you’ll also need the elasticsearch user to be known to Zammad.

`elastic` is the default administrative account - Zammad doesn’t force you on a specific username (for good reasons) and thus you don’t have to provide elastic, but could use an own account, if you’d wanted to.

Setting the es_user solved my problem. Thanks a lot for all your help.