IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Initialization
editInitialization
editA RestHighLevelClient
instance needs a REST low-level client builder
to be built as follows:
RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("localhost", 9200, "http"), new HttpHost("localhost", 9201, "http")));
The high-level client will internally create the low-level client used to perform requests based on the provided builder, and manage its lifecycle.
The high-level client instance needs to be closed when no longer needed so that
all the resources used by it get properly released, as well as the underlying
http client instance and its threads. This can be done through the close
method, which will close the internal RestClient
instance.
client.close();
In the rest of this documentation about the Java High Level Client, the RestHighLevelClient
instance
will be referenced as client
.