Setting the spring.elasticsearch.rest.uris with value http://login:password@host:port generates UnknownHostException: login:password@host: Name or service not known
It would be nice if the userInfo part of the URL could also be used as credentials (that would be overridden if spring.elasticsearch.rest.username or spring.elasticsearch.rest.password are defined)
FYI I encountered this issue while trying to use Bonsai with Heroku that sets a variable BONSAI_URL including login and token.
Comment From: philwebb
It looks like this should be possible, although it's a little involved since we support more than one URL in ElasticsearchRestClientProperties.
I think to implement it we'd need to change ElasticsearchRestClientConfigurations. I think we'd be able to parse the URL ourselves using java.net.URI to access the userInfo. The DefaultRestClientBuilderCustomizer would need to change to apply a custom CredentialsProvider that would be able to lookup the userinfo for a given host.
Comment From: evgeniycheban
Can I work on this issue?
Comment From: wilkinsona
While reviewing the PR from @evgeniycheban I've given some thought to the following:
It would be nice if the userInfo part of the URL could also be used as credentials (that would be overridden if spring.elasticsearch.rest.username or spring.elasticsearch.rest.password are defined)
I don't think the credentials from the URL should be overridden by the properties. The properties should only be used for URLs with no user info. This will align things with, for example, Boot's support for the addresses used to connect to RabbitMQ.
Comment From: philwebb
Closing in favor of PR #21381