Elasticsearch: Simplify configuration of servers

Instead of configuring each server in its own section with separate
values for protocol, host and port, i.e.:

  [elasticsearch "elastic1"]
    hostname = elastic1
    protocol = https
    port = 1234

  [elasticsearch "elastic2"]
    hostname = elastic2
    protocol = https
    port = 1234

Configure them all under the main "elasticsearch" section as multiple
values, i.e.

  [elasticsearch]
    server = https://elastic1:1234
    server = https://elastic2:1234

Allow the port to be omitted, and default it to 9200.

Require at least one server to be explicitly configured and throw a
provision exception if there are none.

During init prompt for the server, defaulting to http://localhost:9200.

Since the init framework doesn't support reading or setting string lists,
if there are multiple server values it will prompt the last one. Mention
in the documentation that configuration of multiple servers must be done
manually.

Since it is not expected that Elasticsearch is being used in production
anywhere, no backwards compatibility with the previous configuration is
provided. Users must adjust their configuration to the new format.

Add a new test, ElasticConfigurationTest, which in this initial version
only tests the configuration of the elasticsearch.server. More tests may
be added in follow-up commits.

Bug: Issue 9372
Bug: Issue 9383
Change-Id: Iad2c547ae82ba89b7ede777072e0869bc77d2025
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index e14e041..a0f211b 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -2812,6 +2812,18 @@
 +
 Not set by default.
 
+[[elasticsearch.server]]elasticsearch.server::
++
+Elasticsearch server URI in the form `http[s]://hostname:port`. The `port` is
+optional and defaults to `9200` if not specified.
++
+At least one server must be specified. May be specified multiple times to
+configure multiple Elasticsearch servers.
++
+Note that the site initialization program only allows to configure a single
+server. To configure multiple servers the `gerrit.config` file must be edited
+manually.
+
 [[elasticsearch.maxRetryTimeout]]elasticsearch.maxRetryTimeout::
 +
 Sets the maximum timeout to honor in case of multiple retries of the same request.
@@ -2844,28 +2856,6 @@
 +
 Not set by default.
 
-==== Elasticsearch server(s) configuration
-
-Each section corresponds to one Elasticsearch server.
-
-[[elasticsearch.name.protocol]]elasticsearch.name.protocol::
-+
-Elasticsearch server protocol. Can be `http` or `https`.
-+
-Defaults to `http`.
-
-[[elasticsearch.name.hostname]]elasticsearch.name.hostname::
-+
-Elasticsearch server hostname.
-+
-Defaults to `localhost`.
-
-[[elasticsearch.name.port]]elasticsearch.name.port::
-+
-Elasticsearch server port.
-+
-Defaults to `9200`.
-
 [[ldap]]
 === Section ldap