Fixes gh-21291

Comment From: wilkinsona

Thanks very much for the PR, @evgeniycheban

Could you please take a look at adding some tests for the new functionality? I think they could be implemented as additions to org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfigurationTests. It looks like you can get the nodes from the RestClient to verify that the configuration has been applied correctly. As part of the tests, it would be good to verify the behaviour of URIs with and without any user info and how the separate username and password properties are used.

Comment From: evgeniycheban

Thanks very much for the PR, @evgeniycheban

Could you please take a look at adding some tests for the new functionality? I think they could be implemented as additions to org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfigurationTests. It looks like you can get the nodes from the RestClient to verify that the configuration has been applied correctly. As part of the tests, it would be good to verify the behaviour of URIs with and without any user info and how the separate username and password properties are used.

Thanks for the review, @wilkinsona

Sure, I will add tests.

Comment From: evgeniycheban

@wilkinsona I added tests.

When you have a moment, please take a look.

Comment From: evgeniycheban

@wilkinsona Could you please take a look at the latest changes when you have a moment?

Comment From: murdos

@wilkinsona : is there any chance to get this in 2.3.x ? Indeed this feature was available with Jest, but support has been removed in 2.3.

Comment From: wilkinsona

Yes. Given the situation with Jest, it seems reasonable to include this in 2.3.x.

Comment From: philwebb

Thanks very much for the PR @evgeniycheban, this is now in 2.3.x and master. I made some minor tweaks in f8982bdc14af90b590c8131c09b95b05edebdd79 (mainly to protect against URL parse exceptions).