I get no data from Elastic via asp.net core

My Elastic server(7.16.2) is running on an on-prem server with certain Ip. (Free version)
I have the following setup for client creation in asp.net core:
var pool = new SingleNodeConnectionPool(new Uri("http://usernamepassword@Server:9200"));
var settings = new ConnectionSettings(pool)
.DefaultIndex("books");
var client = new ElasticClient(settings);
builder.Services.AddSingleton(client);

When I send a request through the client in a Controller class, I get no data and no exception either.
When I do the same kind of request via curl in the Elastic server, I get data. What is wrong with my setup in the asp.net core?
I would be glad if anybody send me a reply on the topic.
Best regards,