Allow option for setting Elasticsearch connection information via full URIs.

Description

In addition to the already available `hosts` and `protocol` configuration properties, can there be an option to supply the Elasticsearch connection information by supplying the full URLs directly (e.g. http://localhost:9200)? Providing URIs would supersede settings for host and protocol.

It seems that the HOSTS setting used to accept URIs but no longer does. Looks like the change came in on Beta3 (https://github.com/hibernate/hibernate-search/commit/61b3fb240dde943cd84d7e38aff6a5681d3c1e7f#diff-6af19971f8c19b4a8629a95d4086dfa06ecac93725e2764e2f24bd39c1a88659)

This would simplify configuration in some scenarios. Using Spring Boot as an example. Instead of having to manage two different structures for the same connection information:

A single structure could be managed:

Environment

None

Activity

Show:
Yoann Rodière
November 4, 2020, 4:26 PM

I suppose that could be useful. It's a bit late for feature requests, though... Tentatively targeting CR2, but if there is no CR2 I may postpone to 6.1.

Alternatively, I believe there are ways to use code in a ${...} in Spring configuration files? Or maybe #{...}? You may be able to simplify your configuration that way. Not sure how easy that would be, though, and it would definitely be more cumbersome than a built-in option in Hibernate Search.

Yoann Rodière
November 10, 2020, 12:23 PM

I think we can introduce a uris configuration property.

When using uris, we should make sure to infer the protocol from the URI scheme used in URIs: it's useful for automatic node discovery in particular.

Also, we'll have to introduce several checks:

  • both uris and hosts are set => ERROR

  • both uris and protocol are set => ERROR

  • uris is set to multiple values with different protocols => ERROR

  • More?

Fixed

Assignee

Fabio Massimo Ercoli

Reporter

Aaron Loes

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Minor
Configure