Java high-level REST client
To start using the OpenSearch Java high-level REST client, ensure that you have the following dependency in your project’s file:
You can now start your OpenSearch cluster. The OpenSearch 1.x high-level REST client works with the 1.x versions of OpenSearch.
If you’re using certificates from a trusted Certificate Authority (CA), you don’t need to configure the truststore.
You can now point your Java client to the truststore and set basic authentication credentials that can access a secure cluster (refer to the sample code below on how to do so).
This code example uses basic credentials that come with the default OpenSearch configuration. If you’re using the OpenSearch Java high-level REST client with your own OpenSearch cluster, be sure to change the code to use your own credentials.
We recommend using the OpenSearch client to connect to OpenSearch clusters, but if you must use the Elasticsearch OSS Java high-level REST client, version 7.10.2 of the Elasticsearch OSS client also works with the 1.x versions of OpenSearch.
Afterward, change all references of to , and you’re ready to start submitting requests to your OpenSearch cluster.