How to debug create_empty_index rake task

I have a problem creating the elastic indices for the advanced search.
When I run the rake job gitlab:elastic:index I get the error
Elasticsearch::Transport::Transport::Errors::NotFound: [404] {“statusCode”:404,“error”:“Not Found”,“message”:“Not Found”}
The connection settings (URL, user and password) are correct.
I can successfully send a request to the Elastic Service on the server using curl.
Is it possible to debug the requests to Elastic of the rake job?
Gitlab version: 16.4
Elastic Service: 8.10
Trace of the rake job:

gitlab-rake gitlab:elastic:index --trace
** Invoke gitlab:elastic:index (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute gitlab:elastic:index
** Invoke gitlab:elastic:recreate_index (first_time)
** Invoke environment 
** Execute gitlab:elastic:recreate_index
** Invoke gitlab:elastic:delete_index (first_time)
** Invoke environment 
** Execute gitlab:elastic:delete_index
Index/alias 'gitlab-production' was not found
Index 'gitlab-production-issues' with alias 'gitlab-production-issues' was not found
Index 'gitlab-production-notes' with alias 'gitlab-production-notes' was not found
Index 'gitlab-production-merge_requests' with alias 'gitlab-production-merge_requests' was not found
Index 'gitlab-production-commits' with alias 'gitlab-production-commits' was not found
Index 'gitlab-production-epics' with alias 'gitlab-production-epics' was not found
Index 'gitlab-production-users' with alias 'gitlab-production-users' was not found
Index 'gitlab-production-wikis' with alias 'gitlab-production-wikis' was not found
Index 'gitlab-production-projects' with alias 'gitlab-production-projects' was not found
Index/alias 'gitlab-production-migrations' was not found
** Invoke gitlab:elastic:create_empty_index (first_time)
** Invoke environment 
** Execute gitlab:elastic:create_empty_index
rake aborted!
Elasticsearch::Transport::Transport::Errors::NotFound: [404] {"statusCode":404,"error":"Not Found","message":"Not Found"}
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/transport/base.rb:218:in `__raise_transport_error'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/transport/base.rb:347:in `perform_request'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/transport/http/faraday.rb:37:in `perform_request'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/client.rb:192:in `perform_request'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/elasticsearch-api-7.13.3/lib/elasticsearch/api/namespace/common.rb:38:in `perform_request'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/elasticsearch-api-7.13.3/lib/elasticsearch/api/actions/indices/create.rb:48:in `create'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/elastic/helper.rb:424:in `create_index'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/elastic/helper.rb:192:in `create_empty_index'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/tasks/gitlab/elastic.rake:165:in `block (3 levels) in <top (required)>'